已注册事件的 Webhook 响应架构

如果注册了 Webhook,Kaizala 将为已注册的 objectId 上的每个事件返回 WebHook 响应,并针对已注册的事件进行筛选。 下面是不同事件的不同 Webhook 响应的架构详细信息。

响应正文

参数 类型 说明
objectId String 表示已在其中创建 Webhook 的上下文的 对象的标识符。对于 ObjectType=Group,其组的 Identifier,For ObjectType=Action,其 actionId,For ObjectType=ActionPackage,其 action-package-id
objectType String 枚举:“Group”/“Action”/“ActionPackage”
eventType String 已调用的已注册事件
eventId String 表示事件的标识符
data JSON 对象 表示特定于该事件的数据的对象。 下面为每个受支持的事件定义的参数。
context String 返回在参数“callbackContext”下注册 Webhook 时设置的值
fromUser String 发件人的电话号码
fromUserId String Sender 的 userId
fromUserName String 发件人的注册名称(带有 Kaizala)
fromUserProfilePic url 发件人个人资料图片

参数“data”因 WebHook 事件而异。 可以在下面找到每个事件的架构。

事件“TextMessageCreated”的数据

参数 类型 说明
text String 已发送的文本消息

“TextMessageCreated”的示例 webHook 响应

{
  "objectId": "8c2050-9be8-45d6-97f5-bb7013930027",
  "objectType": "Group",
  "eventType": "TextMessageCreated",
  "eventId": "55ed01-02b5-491e-8e7e-484726da976b",
  "data": {
    "text": "Test Message"
  },
  "context": "Any data which is required to be returned in callback",
  "fromUser": "+91xxxxxxxx",
  "fromUserId": "72e91-f3-4e7b-84eb-4e228406fb9b",
  "fromUserName": "Robin Richard",
  "fromUserProfilePic": "https://mobileonlyapps.blob.core.windows.net/72e29591-4e7b-84eb-4e228406fb9b/c34afc0d53614ae29285d08e6409e416.jpg"
}

事件“AttachmentCreated”的数据

参数 类型 说明
媒体 Array 每个项都包含 mediaUrl 和 mediaFileName
mediaUrl url 图像的 url
mediaFileName String Filename
actionType String 枚举值:“Image”
标题 String 与图像一起附加的标题

“AttachmentCreated”的示例 webHook 响应

{
  "objectId": "8c291050-9be8-45d6-97f5-bb7013930027",
  "objectType": "Group",
  "eventType": "AttachmentCreated",
  "eventId": "59e2e9f9-9b10-4b67-8bc5-3f85a04f2d91",
  "data": {
    "media": [
      {
        "mediaUrl": "https://cdn.inc-000.kms.osi.office.net/att/0ad142c52b30d797addebadb620c19bf6f018299ed4acdce5760e45e2e4bc4ae.jpg?sv=2015-12-11&sr=b&sig=Thbp46wdgoqbDaAF06v2Y2ijzny0jx2fBDo1EZab%2BNY%3D&st=2018-03-22T10:22:21Z&se=2292-01-05T11:22:21Z&sp=r",
        "mediaFileName": "IMG_18-03-22_165220084_1.jpg"
      }
    ],
    "actionType": "Image",
    "caption": "Testing."
  },
 "context": "Any data which is required to be returned in callback",
  "fromUser": "+91xxxxxxxx",
  "fromUserId": "72e91-f3-4e7b-84eb-4e228406fb9b",
  "fromUserName": "Robin Richard",
  "fromUserProfilePic": "https://mobileonlyapps.blob.core.windows.net/72e29591-4e7b-84eb-4e228406fb9b/c34afc0d53614ae29285d08e6409e416.jpg"
}

事件“公告”的数据

参数 类型 说明
title String 公告操作的标题
text String 公告操作的消息正文
媒体 Array 每个项都包含 mediaUrl 和 mediaFileName
mediaUrl url 图像的 url
mediaFileName String Filename

“公告”的示例 webHook 响应

{
  "objectId": "8c291050-9be8-45d6-97f5-bb7013930027",
  "objectType": "Group",
  "eventType": "Announcement",
  "eventId": "3e49b367-acf6-48a7-a675-6bf4d372a070",
  "data": {
    "text": "Caption :Testing.",
    "title": "Sent by Robin Richard",
    "media": [
      {
        "url": "https://cdn.inc-000.kms.osi.office.net/contenthost/beb2cfef8732c6cc3b54652c1f6f99d64f529fd9be3d409e2966552639fb791f.jpeg",
        "fileName": "e3c145f1-5e6f-4ee9-bd83-49ec3a1c2550.jpeg"
      }
    ]
  },
 "context": "Any data which is required to be returned in callback",
  "fromUser": "+91xxxxxxxx",
  "fromUserId": "72e91-f3-4e7b-84eb-4e228406fb9b",
  "fromUserName": "Robin Richard",
  "fromUserProfilePic": "https://mobileonlyapps.blob.core.windows.net/72e29591-4e7b-84eb-4e228406fb9b/c34afc0d53614ae29285d08e6409e416.jpg"
}

事件“JobCreated”的数据

参数 类型 说明
title String 公告操作的标题
text String 公告操作的消息正文
actionId Id 作业操作的特定实例的标识符
dueDate 日期 作业到期的日期
assignedTo String Array 电话号码数组

“JobCreated”的示例 webHook 响应

{
  "objectId": "8c2950-9be8-45d6-97f5-bb7013930027",
  "objectType": "Group",
  "eventType": "JobCreated",
  "eventId": "3e49b367-acf6-48a7-a675-6bf4d372a070",
  "data": {
    "assignedTo": [
      "+919740797266"
    ],
    "title": "Test Job",
    "dueDate": "2018-03-22T18:29:59Z",
    "actionId": "aeb012-31a0-477a-a131-8a1e2791b36e",
    "groupId": "8c291050-9be8-6-97f5-bb7013930027"
  },
 "context": "Any data which is required to be returned in callback",
  "fromUser": "+91xxxxxxxx",
  "fromUserId": "72e91-f3-4e7b-84eb-4e228406fb9b",
  "fromUserName": "Robin Richard",
  "fromUserProfilePic": "https://mobileonlyapps.blob.core.windows.net/72e29591-4e7b-84eb-4e228406fb9b/c34afc0d53614ae29285d08e6409e416.jpg"
}

事件“JobResponse”的数据

参数 类型 说明
title String 公告操作的标题
text String 公告操作的消息正文
actionId Id 作业操作的特定实例的标识符
groupId String 组标识符
responseId String 用于标识该响应的 GUID
responseDetails String Array 响应对象数组
assignee String 被代理人的电话号码
assigneeName String 受让人姓名
assigneeProfilePic url 受让人个人资料图片的 url
isCompleted Boolean 作业是否已完成?

“JobResponse”的示例 webHook 响应

{
  "objectId": "8c2950-9be8-45d6-97f5-bb7013930027",
  "objectType": "Group",
  "eventType": "JobResponse",
  "eventId": "3e49b367-acf6-48a7-a675-6bf4d372a070",
  "data": {
    "actionId": "2ce34820-3d67-4807-9a1d-7cf099c2e7ae",
    "groupId": "8c291050-9be8-45d6-97f5-bb7013930027",
    "responseId": "80a883ec-e6c7-4dc8-979d-d268bbeeee8b",
    "responseDetails": {
      "response": {
        "assignee": "++91xxxxxxxx",
        "assigneeName": "Robin Richard",
        "assigneeProfilePic": "https://mobileonlyapps.blob.core.windows.net/72e29591-f391-4e7b-84eb-4e228406fb9b/c34afc0d536285d08e6409e416.jpg",
        "isCompleted": true
      }
    }
  },
  "context": "Any data which is required to be returned in callback",
  "fromUser": "+91xxxxxxxx",
  "fromUserId": "72e91-f3-4e7b-84eb-4e228406fb9b",
  "fromUserName": "Robin Richard",
  "fromUserProfilePic": "https://mobileonlyapps.blob.core.windows.net/72e29591-4e7b-84eb-4e228406fb9b/c34afc0d53614ae29285d08e6409e416.jpg"
}

事件“ActionCreated”/“SurveyCreated”的数据

参数 类型 说明
actionId Id 作业操作的特定实例的标识符
groupId String 组标识符
responseId String 用于标识该响应的 GUID
问题 String Array 对象数组
应答 String 响应者的电话号码
responderName String 响应者的名称
responderProfilePic url 响应者个人资料图片的 url
isAnonymous Boolean 调查答复是否已匿名提交
isUpdateResponse Boolean 响应方是否已更新响应,因为之前已提交响应

“responseWithQuestions”对象的架构详细信息

参数 类型 说明
title String 问题标题
type 字符串 QuestionType
选项 Array 适用于多选题 (键值对) 选项列表
isInvisible Boolean UI 中是否隐藏了问题

“ActionCreated”/“SurveyCreated”的示例 webHook 响应

{
  "objectId": "8c2950-9be8-45d6-97f5-bb7013930027",
  "objectType": "Group",
  "eventType": "ActionCreated",
  "eventId": "3e49b367-acf6-48a7-a675-6bf4d372a070",
  "data": {
   "actionId": "920f9802-62dafb-9bc2-8d3ba5c43609",
    "groupId": "8c291050-9be8-4d6-97f5-bb7013930027",
    "responseId": "420e9ef0-2a6d-405-a2bf-2688648ce79a",
    "isUpdateResponse": false,
    "responder": "+91xxxxxxxxx",
    "responderName": "Robin Richard",
    "responderProfilePic": "https://mobileonlyapps.blob.core.windows.net/72e29591-f391-4e7b-84eb-4e228406fb9b/c34afc0d53614ae29285d08e6409e416.jpg",
    "isAnonymous": false,
    "responseDetails": {
      "responseWithQuestions": [
        {
          "title": "1",
          "type": "Text",
          "options": [],
          "answer": "1"
        },
        {
          "title": "2",
          "type": "AttachmentList",
          "options": [],
          "answer": [
            {
              "mediaUrl": "https://cdn.inc-000.kms.osi.office.net/att/9841be297131449fba1123ec8545ab30fa72c2017555ba4bcd4ac18d5f7850b4.jpg?sv=2015-12-11&sr=b&sig=Egd4wDmAfGrIoklLj70SrV7D3QtwtMEWQx673U%3D&st=2018-03-23T09:26:24Z&se=2292-01-06T10:26:24Z&sp=r",
              "mediaFileName": "IMG_18-03-23_155619990_1.jpg"
            }
          ]
        },
        {
          "isInvisible": true,
          "title": "ResponseTime",
          "type": "DateTime",
          "options": [],
          "answer": 1521800782956
        }
      ]
    }
  },
  "context": "Any data which is required to be returned in callback",
  "fromUser": "+91xxxxxxxx",
  "fromUserId": "72e91-f3-4e7b-84eb-4e228406fb9b",
  "fromUserName": "Robin Richard",
  "fromUserProfilePic": "https://mobileonlyapps.blob.core.windows.net/72e29591-4e7b-84eb-4e228406fb9b/c34afc0d53614ae29285d08e6409e416.jpg"
}

事件“SurveyResponse”/“ActionResponse”的数据

参数 类型 说明
actionId Id 作业操作的特定实例的标识符
groupId String 组标识符
responseId String 用于标识该响应的 GUID
responseDetails String Array “responseWithQuestions”对象的数组
应答 String 响应者的电话号码
responderName String 响应者的名称
responderProfilePic url 响应者个人资料图片的 url
isAnonymous Boolean 调查答复是否已匿名提交
isUpdateResponse Boolean 响应方是否已更新响应,因为之前已提交响应

“responseWithQuestions”对象的架构详细信息

参数 类型 说明
title String 问题标题
type 字符串 QuestionType
选项 Array 适用于多选题的选项列表
回答 Json 对象的数组 答案
isInvisible Boolean UI 中是否隐藏了问题

“SurveyResponse”“ActionResponse”的示例 webHook 响应

{
  "objectId": "8c2950-9be8-45d6-97f5-bb7013930027",
  "objectType": "Group",
  "eventType": "SurveyResponse",
  "eventId": "3e49b367-acf6-48a7-a675-6bf4d372a070",
  "data": {
   "actionId": "920f9802-62dafb-9bc2-8d3ba5c43609",
    "groupId": "8c291050-9be8-4d6-97f5-bb7013930027",
    "responseId": "420e9ef0-2a6d-405-a2bf-2688648ce79a",
    "isUpdateResponse": false,
    "responder": "+91xxxxxxxxx",
    "responderName": "Robin Richard",
    "responderProfilePic": "https://mobileonlyapps.blob.core.windows.net/72e29591-f391-4e7b-84eb-4e228406fb9b/c34afc0d53614ae29285d08e6409e416.jpg",
    "isAnonymous": false,
    "responseDetails": {
      "responseWithQuestions": [
        {
          "title": "1",
          "type": "Text",
          "options": [],
          "answer": "1"
        },
        {
          "title": "2",
          "type": "AttachmentList",
          "options": [],
          "answer": [
            {
              "mediaUrl": "https://cdn.inc-000.kms.osi.office.net/att/9841be297131449fba1123ec8545ab30fa72c2017555ba4bcd4ac18d5f7850b4.jpg?sv=2015-12-11&sr=b&sig=Egd4wDmAfGrIoklLj70SrV7D3QtwtMEWQx673U%3D&st=2018-03-23T09:26:24Z&se=2292-01-06T10:26:24Z&sp=r",
              "mediaFileName": "IMG_18-03-23_155619990_1.jpg"
            }
          ]
        },
        {
          "isInvisible": true,
          "title": "ResponseTime",
          "type": "DateTime",
          "options": [],
          "answer": 1521800782956
        }
      ]
    }
  },
  "context": "Any data which is required to be returned in callback",
  "fromUser": "+91xxxxxxxx",
  "fromUserId": "72e91-f3-4e7b-84eb-4e228406fb9b",
  "fromUserName": "Robin Richard",
  "fromUserProfilePic": "https://mobileonlyapps.blob.core.windows.net/72e29591-4e7b-84eb-4e228406fb9b/c34afc0d53614ae29285d08e6409e416.jpg"
}

事件“MemberAdded”/“MemberRemoved”的数据

参数 类型 说明
成员 String 已添加成员的电话号码
memberName String 已添加成员的名称
type 字符串 已添加成员的成员身份角色
memberProfilePic url 受让人个人资料图片的 url

“MemberAdded”/“MemberRemoved”的示例 webHook 响应

{
  "objectId": "8c2950-9be8-45d6-97f5-bb7013930027",
  "objectType": "Group",
  "eventType": "JobResponse",
  "eventId": "3e49b367-acf6-48a7-a675-6bf4d372a070",
  "data": {
    "member": "+91xxxxxxxx",
    "memberName": "Jan Decker",
    "memberProfilePic": "https://mobileonlyapps.blob.core.windows.net/polymer-7ebb8d90e1324b5cbd61d1e10a30ada7/bbac582a4364860679d40fda7c6b.jpg",
    "type": "Member"
  },
  "context": "Any data which is required to be returned in callback",
  "fromUser": "+91xxxxxxxx",
  "fromUserId": "72e91-f3-4e7b-84eb-4e228406fb9b",
  "fromUserName": "Robin Richard",
  "fromUserProfilePic": "https://mobileonlyapps.blob.core.windows.net/72e29591-4e7b-84eb-4e228406fb9b/c34afc0d53614ae29285d08e6409e416.jpg"
}