Last updated
Was this helpful?
Was this helpful?
type WebhookBody = {
type: "variables" | "session" | "rules",
data: { //WebhookData
orgSlug: string,
depSlug: string,
rows: (VariableWebhookData | SessionWebhookData | RuleWebhookData)[]
}
}type VariableWebhookData = {
identifier: string,
variables: Record<string, any>, //A map of variable name and value
};{
type: "variables",
data: {
orgSlug: "gmetri",
depSlug: "gmetridemo",
rows: [{
identifier: "amit@gmetri.com",
variables: {
score: 100,
quizCompleted: true,
}
}, {
identifier: "mitul@gmetri.com",
variables: {
score: 75,
quizCompleted: false,
}
}]
}
}type RuleWebhookData = {
identifier: string,
rules: {
cid: number, //rule id
cname: string, //rule name
scene_name: string, //scene name where the rule was triggered
timestamp: number, // epoch ms
}[]
};{
type: "rules",
data: {
orgSlug: "gmetri",
depSlug: "gmetridemo",
rows: [{
identifier: "amit@gmetri.com",
rules: [{
cid: 1,
cname: "Rule A",
scene_name: "scene 1",
timestamp: 123456
}]
}, {
identifier: "mitul@gmetri.com",
rules: [{
cid: 1,
cname: "Rule A",
scene_name: "scene 2",
timestamp: 123457
}, {
cid: 2,
cname: "Rule C",
scene_name: "scene 2",
timestamp: 123458
}]
}, {
identifier: "amit@gmetri.com",
rules: [{
cid: 10,
cname: "Rule G",
scene_name: "scene 4",
timestamp: 234561
}]
}]
}
}type SessionWebhookData = {
identifier: string,
session: Record<string, any>,
};{
type: "session",
data: {
orgSlug: "gmetri",
depSlug: "gmetridemo",
rows: [{
identifier: "amit@gmetri.com",
session: {
uuid: "12134-dffgs-2345-vfsd",
browser: "CHROME",
platform: "ANDROID,
device_id: "123",
created_at: 123455,
modified_at: 123455,
}
}, {
identifier: "mitul@gmetri.com",
session: {
uuid: "12134-dffgs-2345-vfsd",
browser: "CHROME",
platform: "ANDROID,
device_id: "123",
created_at: xyz,
modified_at: xyz,
}
}, {
identifier: "amit@gmetri.com",
session: {
uuid: "12134-3214-2345-vfsd",
browser: "CHROME 1",
platform: "IOS",
device_id: "456",
created_at: 123456,
modified_at: 123456,
}
}]
}