如果您正在构建广泛使用 Dialogflow Fulfillment 的 Dialogflow Agent,您会发现渠道提供商传递的数据对您的应用程序很有用。 此数据将使用原始探测信息请求字段从回复.io平台传递到对话流。
为了允许更高级的使用 API,联系人对象被附加到平台的请求中。 联系人对象中的 cId 项目反映了在联系人API中使用的相同值。
"contact":
"cId": "60133386712",
"contactId": 123456,
"channelId": 7890
}
“originalDetectIntentRequest”:{
“有效载荷”:{
“来源”:“facebook”,
“联系人”:{
“cId”:“3854977680200098”,
“contactId”:“123456”,
“channelId”:“7890”
},
“附件”:\[
{
“类型”:“位置”,
“有效载荷”:{
“纬度”:3.146642,
“经度”:101.695847,
"address": "吉隆坡市中心"
}
}
\],
"body": {
"entry": \[
{
"messaging": \[
{
"recipient": {
"id": "177689475607202"
},
"message": {
"text": "hi",
"mid": “D3DJuA0YlOgDgOybFG1M2ZHoJg9hq9IAjMQE2ps6RIN4QJ25rNPMi”
},
“时间戳”:1564743055901,
“发送者”:{
“id”:“2254108171328398”
}
}
\],
“id”:“177689475607202”,
“时间”:1564743056313
}
\],
"object": "页面"
}
}
}
“originalDetectIntentRequest”:{
“有效载荷”:{
“源”:“线”,
“联系人”:{
“cId”:“U905251b5f5759acde5e4788681c04269”,
“contactId”:123456,
“channelId”:7890
},
“附件”:\[
{
“类型”:“位置”,
“有效载荷”:{
“纬度”:3.146642,
“经度”: 101.695847,
"address": "吉隆坡市中心"
}
}
\],
"body": {
"events": \[
{
"type": "message",
"replyToken": "16a59224c65b4c5cbecedc4f3504599b",
"source": {
"userId": "U905251b5f5759bbde5e4788681c04170",
“类型”:“用户”
},
“时间戳”:1593146060317,
“模式”:“活动”,
“消息”:{
“类型”:“文本”,
“id”:“12211455206333”,
“文本”:“嗨”
}
}
\],
“目的地”:“U5698920083824716136c04633a9e1710”
}
}
}
“origalDetitIntentRequest”: Power
"payload": Power
"source": "twilio",
"联系人": Power
"cId": "+12262120005",
"contactId": 123456,
"channelId": 7890
},
"attachments": \[
Power
"type": "location",
"payload": Power
"lat": 3. 46642,
"long": 101。 95847
"地址": "吉隆坡城市中心"
}
}
\,
"body": Power
"ToCountry": "CA",
"ToState": "安大略",
"SmsMessageSid": "SM1f1c9a30ff67cf5b1a89d5b1e0735a2b",
"NumMedia": "0",
"ToCity": "",
"FromZip": "",
"SmsSid": "SM1f1c9a30ff67cf5b1a89d5b1e0735a2b",
"来自"安大略省",
"SmsStatus": "收到",
"发源城市": "St Thomas",
"身体": "Hi",
"发源": "CA",
"发给": "+12267022870",
"ToZip": "",
"Segments": "1",
"MessageSid": "SM1f1c9a30ff67cf5b1a89d5b1e0735a2b",
"AccountSid": "AC75bcf6cd15a35c46c6e5fa6dde6028",
"源": "+1226121015",
"AppiVersion": "2010-04-01"
}
}
}
“originalDetectIntentRequest”:{
“payload”:{
“source”:“message\_bird”,
“contact”:{
“cId”:“16364923690”
},
“attachments”:\[
{
“type”:“location”,
“payload”:{
“lat”:3.146642,
“long”:101.695847,
“address”:“吉隆坡市中心”
}
}
\],
"body": {
"body": "嗨",
"createdDatetime": "2020-06-26T07:51:30+00:00",
"date": "1593186690",
"date\_utc": "1593157890",
"id": "6c4c8c58eb204e69ae7d07e309c5a11c",
"invocationId": "477a8bc9-a4ec-45db-98e0-3b982898945a",
“消息”:“嗨”,
“消息 \_id”:“026a4c0e38954e5684757ba1de645130”,
“发起者”:“12267022870”,
“有效负载”:“嗨”,
“接收者”:“12262121015”,
“收件人”:“12262121015”,
“参考”:“88003423322”,
“发送者”:“12267022870”
}
}
}
“originalDetectIntentRequest”:{
“payload”:{
“source”:“nexmo”,
“contact”:{
“cId”:“60133386712”
},
“body”:{
“msisdn”:“12012938397”,
“to”:“12012938397”,
“messageId”:“16000002AB5DBF42”,
“text”:“Hi”,
“type”:“text”,
“keyword”:“HI”,
“api-key”:“2787fb30”,
“消息时间戳”:“2020-04-27 09:00:08”
}
}
}
“origalDetitIntentRequest”: Power
"payload": 许诺
"source": "telegram",
"联系人": Power
"cId": "928825753",
"contactId": 123456,
"channelId": 7890
},
"attachments": \[
Power
"type": "location",
"payload": Power
"lat": 3. 46642,
"long": 101。 95847
"地址": "吉隆坡城市中心"
}
}
\,
"body": Power
"update\_id": 68062810,
"message": Power
"message\_id": 358,
"from": Power
"id": 921815852,
"is\_bot": false,
"first\_name": "Leo",
"language\_code": "en"
},
"聊天":请见
"id":921815852,
"first\_name": "Leo",
"类型": "private"
},
"日期": 1593415824,
"text": "Hi"
}
}
}
}
"originalDetectIntentRequest": {
"payload": {
"source": "twitter",
"contact": {
"cId": "800244779787258095",
"contactId": 123456,
"channelId": 7890
},
"body": {
"for\_user\_id": "800244779786258096",
"direct\_message\_events": \[
{
"type": "message\_create",
"id": "1277881813680091140",
"created\_timestamp": "1593505740934",
"message\_create": {
"target": {
"recipient\_id": "800244779786258096"
},
"sender\_id": "1236829623670812661",
"message\_data": {
"text": "嗨",
"entities": {
"hashtags": \[\],
"symbols": \[\],
"user\_mentions": \[\],
"urls": \[\]
}
}
}
}
\],
"users": {
"1236829623670812661": {
"id": "1236829623670812661",
"created\_timestamp": "1583718145786",
"name": "leoawesome",
"screen\_name": "leoawesome21",
"protected": false,
"verified": false,
"followers\_count": 0,
"friends\_count": 1,
"statuses\_count": 0,
"profile\_image\_url": "http://abs.twimg.com/sticky/default\_profile\_images/default\_profile\_normal.png",
"profile\_image\_url\_https": "https://abs.twimg.com/sticky/default\_profile\_images/default\_profile\_normal.png"
},
"800244779786258096": {
"id": "800244779786258096",
"created\_timestamp": "1479628198125",
"name": "respond.io",
"screen\_name": "respond\_io",
"description": "https://t.co/8AN2CVzhwJ 是一个商业消息平台,可以将来自任何渠道的客户与每个团队连接。",
"url": "https://t.co/vE593YRZwo",
"protected": false,
"verified": false,
"followers\_count": 246,
"friends\_count": 23,
"statuses\_count": 1527,
"profile\_image\_url": "http://pbs.twimg.com/profile\_images/1250330944067653632/3KiCeUhc\_normal.jpg",
"profile\_image\_url\_https": "https://pbs.twimg.com/profile\_images/1250330944067653632/3KiCeUhc\_normal.jpg"
}
}
}
}
}
“origalDetitIntentRequest”: Power
"payload": Power
"source": "viber",
"contact": Power
"cId": "T1yTBK3PQTHAFchDh1skA==",
"contactId": 123456,
"channelId": 7890
},
"attachments": \[
Power
"type": "location",
"payload": Power
"lat": 3. 46642,
"long": 101。 95847
"地址": "吉隆坡城市中心"
}
}
\,
"body": Power
"event": "message",
"时间戳":1593420787910,
"聊天\_hostname": "BN-CHAT-14\_",
"message\_token": 54583120862675500,
"发送者": Power
"id": "T1yTBK3PQFGAGAGdhsDh1skA==",
"name": "Leo",
"头像": "https://media-direct. dn.viber。 om/download\_照片? lid=tHBOJafTJ8WSwooFLCQ0x1lmS8RXeDXXyUVoAoLmmOGPIMprwqNCUO6BH3cG-VoAYd3WetLrBK4nP7C86ZN3MxG5T40A1lduzCharts-Ulz0oO9l7FjW3bAYljiLyTGkYbaCRjcQ&fltp=jpg&imsz=0000”,
"language": "en",
“国家”:“MY”,
"api\_version": 8
},
"message": Power
"text": "Hi"
"类型": "text"
},
"silent": false
}
}
}
"originalDetectIntentRequest": {
"payload": {
"source": "微信",
"contact": {
"cId": "ovYOJv8eZlJ5efKToATGeOk5hBQM",
"contactId": 123456,
"channelId": 7890
},
"attachments": \[
{
"type": "location",
"payload": {
"lat": 3.146642,
"long": 101.695847,
"address": "吉隆坡市中心"
}
}
\],
"body": {
"xml": {
"ToUserName": \[
"gh\_5b17802cd972"
\],
"FromUserName": \[
"ovYOJv8eZlJ5evMToATGePk5hAQM"
\],
"CreateTime": \[
"1593421765"
\],
"MsgType": \[
"文本"
\],
"内容": \[
"嗨"
\],
"MsgId": \[
"22812312807562437"
\]
}
}
}
}
“originalDetectIntentRequest”:{
“payload”:{
“source”:“webchat”,
“contact”:{
“cId”:“e6507476-e507-4503-9652-bcde24e8ea88”,
“contactId”:123456,
“channelId”:7890
},
“body”:{
“sender”:{
“id”:“07f1e397-12a8-485b-a417-14d7e3837608”,
“locale”:“en\_US”
},
“收件人”:{
“id”:“4db00a5db70efbb51a0cd6a6635918390dd1945a89ce77898ab66b82d5c15344”
},
“查询”:\[
{
“类型”:“查询”,
“文本”:“嗨”
}
\]
}
}
}
“originalDetectIntentRequest”:{
“payload”:{
“body”:{
“object”:“whatsapp\_business\_account”,
“entry”:\[
{
“changes”:\[
{
“value”:{
“contacts”:\[
{
“wa\_id”:“60124438291”,
“profile”:{
“name”:“Shahzad”
}
}
\],
"元数据": {
"显示\_电话\_号码": "15550468615",
"电话\_号码\_id": "106875742284151"
},
"消息\_产品": "whatsapp",
"消息": \[
{
"id": "wamid.HBgLNjAxMjQ0MzgyOTEVAgASGBYzRUIwOTA1ODAxRUQ5MDAxOTI1QTcxAA==",
"类型": "文本",
"来自": "60124438291",
"timestamp": "1680061817",
"text": {
"body": "给我讲个笑话"
}
}
\]
},
"field": "消息"
}
\],
"id": "106024152370383"
}
\]
},
“来源”:“whatsapp\_business”,
“联系人”:{
“cId”:“60124438291”,
“contactId”:38,
“channelId”:59
}
}
}
"originalDetectIntentRequest": {
"payload": {
"body": {
"entry": \[
{
"id": "106024152370383",
"changes": \[
{
"field": "messages",
"value": {
"messaging\_product": "whatsapp",
"messages": \[
{
"id": "wamid.HBgLNjAxMjQ0MzgyOTEVAgASGBYzRUIwMjM1OUQ4NkE4MUJDRDY1QkE0AA==",
"timestamp": "1680063507",
"text": {
"body": "给我讲个笑话"
},
"from": "60124438291",
"type": "text"
}
\],
"metadata": {
"display\_phone\_number": "15550468615",
"phone\_number\_id": "106875742284151"
},
"contacts": \[
{
"wa\_id": "60124438291",
"profile": {
"name": "Shahzad"
}
}
\]
}
}
\]
}
\],
"object": "whatsapp\_business\_account"
},
"contact": {
"cId": "60124438291",
"channelId": 45,
"contactId": 43
},
"source": "whatsapp\_cloud"
}
}
"origalDetitIntentRequest": Power
"payload": Power
"source": "twilio\_whatsapp",
"contact": Power
"cId": "whatsapp:+60133385703",
"contactId": 123456,
"channelId": 7890
},
"attachments": \[
Power
"type": "location",
"payload": Power
"lat": 3. 46642,
"long": 101。 95847
"地址": "吉隆坡城市中心"
}
}
\,
"body": Power
"SmsMessageSid": "SMb16231017683857d42ca62aafabcf205",
"NumMedia": "0",
"SmsSid": "SMb16231017683857d42ca62aafcf205",
"SmsStatus": "收到",
"Body": "Hi",
"To": "whatsapp:+141552388866",
"Segments": "1",
"MessageSid": "SMb16231017683857d42ca62aafabcf205",
"AccountSid": "AC75bcf6cd15a35c46c6e5fa6ddde6028",
"From": "whatsapp:+6014446813",
"AppiVersion": "2010-04-01"
}
}
}
"origalDetetIntentRequest": Power
"payload": Power
"source": "message\_bird\_whatsapp",
"联系人": Power
"cId": "60133385712",
"contactId": 123456,
"channelId": 7890
},
"attachments": \[
Power
"type": "location",
"payload": Power
"lat": 3. 46642,
"long": 101。 95847
"地址": "吉隆坡城市中心"
}
}
\,
"body": Power
"contact": Power
"attributes": {},
"创建日期": "2020-05-18T03:02:01Z",
"customDetails": {},
"displayName": "60123376813",
"firstName": "",
"href": "https://contacts. 撒格巴里德。 om/v2/contacts/32845951f19c43d0b4e3371df0da941a”,
"id": "32845951f19c43d0b4e3371df0da941a",
"姓": "",
"msisdn": 60123376813,
"更新日期": "2020-05-18T03:02:01Z"
},
"conferencation": Power
"contactId": "3284595ef19c43d0b4e3371df0da941a",
"创建日期": "2020-05-18T03:02:01Z",
"id": "64d59ed4cb4f419ca39114c292c1a597",
"lastReceivedDatetime": "2020-06-26T08:58:55。 451283Z",
"status": "active",
"updatedDatetime": "2020-06-25T08:59:30。 77791342Z"
},
"message": Power
"channelId": "f4b115e89415407ab2b97fe85ad3d191",
"content": Power
"text": "Hi"
},
"对话Id": "64d59ed4cb4f419ca39114c292c1a597",
"创建日期": "2020-06-26T08:58:55Z",
"方向": "receed",
"来自"+60123376813",
"id": "91c8268b72b412cab3b4080a974c5dc",
"平台": "What sapp",
"status": "receed",
"to": "+6531290788",
"输入": "text",
"updatedDatetime": "2020-06-26T08:58:55。 50324338Z”
},
"类型": "message 已恢复"
}
}
}
"origalDetitIntentRequest": Power
"payload": Power
"source": "nexmo\_whatsapp",
"联系人": Power
"cId": "60133386712",
"contactId": 123456,
"channelId": 7890
},
"attachments": \[
Power
"type": "location",
"payload": Power
"lat": 3. 46642,
"long": 101。 95847
"地址": "吉隆坡城市中心"
}
}
\,
"body": Power
"message\_uuid": "2b53f909-1640-471f-a44d-e4cb9bd00c44",
"to": Power
"type": "whatsapp",
"编号": "12012938397"
},
"from": Power
"type": "what sapp",
"编号": "60133285813"
},
"时间戳": "2020-06-29T04:37:21。 76Z",
"message": Power
"content": Power
"type": "text",
"text": "Hi"
}
},
"direction": "inbound"
}
}
}
"origalDetetIntentRequest": Power
"payload": Power
"source": "message\_pipe\_whatsapp",
"联系人": Power
"cId": "60133386712",
"contactId": 123456,
"channelId": 7890
},
"attachments": \[
Power
"type": "location",
"payload": Power
"lat": 3. 46642,
"long": 101。 95847
"地址": "吉隆坡城市中心"
}
}
\,
"body": Power
"environment": Power
"app\_id": "476"
},
"events": \[
Power
"name": "d360\_whatsapp\_message\_in",
"properties": Power
"stack\_id": "85256128299",
"message\_id": "IY2Cx8lhx0E0M",
"对话\_id": "K7SWYeCmed07C",
"类型": "text",
"content": Power
"body": "Hi"
}
},
"timestamp": "1593502341000",
"id": "7a104e27-d4d2-4e5d-8c8a-c74f3ba8e6c1"
}
\,
"device": Power
"mdn": "60133286713",
"profile\_name": "Leo"
},
"收件人\_id": "64f0699c-e005-409d-b177-6a975c61ba60"
}
}
}
“originalDetectIntentRequest”:{
“有效载荷”:{
“来源”:“360dialog\_whatsapp”,
“联系人”:{
“cId”:“60133386712”,
“contactId”:123456,
“channelId”:7890
},
“附件”:\[
{
“类型”:“位置”,
“有效载荷”:{
“纬度”:3.146642,
“经度”:101.695847,
"address": "吉隆坡市中心"
}
}
\],
"body": {
"contacts": \[
{
"profile": {
"name": "John Don"
},
"wa\_id": "923339883320"
}
\],
"messages": \[
{
"from": “923339885509”,
“id”: “ABEGkjM5iFUJAhDGiqsifkiyZkH6HzvBfO2m”,
“text”: {
“body”: “嗨”
},
“timestamp”: “1595240228”,
“type”: “text”
}
\]
}
}
}
任何不支持的有效载荷,例如谷歌助手卡,将不会出现在平台上,并将被回复 io 忽略。
有效载荷格式是严格的,任何缺失的关键值都会导致不可取的结果,即不会出现在平台上,出现错误等等。
如果您有一个复杂的履行标准,例如,连接到某些在返回响应之前进行查询的第三方服务,那么您必须考虑时间延迟,如下面 Dialogflow 文档中所述。 响应需要在5秒内返回,否则webhook 失败,将不会返回对话流程和应答。