หากคุณกำลังสร้าง Dialogflow Agent ที่ใช้ Dialogflow Fulfillment อย่างกว้างขวาง คุณจะพบว่าข้อมูลที่ส่งผ่านโดยผู้ให้บริการช่องทางนั้นมีประโยชน์สำหรับแอปพลิเคชันของคุณ ข้อมูลนี้ถูกส่งจากแพลตฟอร์ม respond.io ไปยัง Dialogflow โดยใช้ฟิลด์ originalDetectIntentRequest
เพื่อให้สามารถใช้ API ได้อย่างขั้นสูงมากขึ้น วัตถุการติดต่อจะถูกผนวกเข้ากับคำขอโดยแพลตฟอร์ม รายการ cId ในวัตถุ Contact สะท้อนถึงค่าเดียวกับที่ใช้ใน Contacts API
"ติดต่อ": {
"cId": "60133386712",
"contactId": 123456,
"channelId": 7890
}
"originalDetectIntentRequest": {
"ข้อมูล": {
"แหล่งที่มา": "facebook"
"ข้อมูลติดต่อ": {
"cId": "3854977680200098"
"ข้อมูลติดต่อ": "123456"
"channelId": "7890"
},
"ข้อมูลแนบ": \[
{
"ประเภท": "ตำแหน่ง"
"ข้อมูล": {
"ละติจูด": 3.146642,
"ยาว": 101.695847,
"ที่อยู่": "ศูนย์กลางเมืองกัวลาลัมเปอร์"
}
}
\],
"เนื้อหา": {
"รายการ": \[
{
"การส่งข้อความ": \[
{
"ผู้รับ": {
"รหัส": "177689475607202"
},
"ข้อความ": {
"ข้อความ": "สวัสดี"
"กลาง": "D3DJuA0YlOgDgOybFG1M2ZHoJg9hq9IAjMQE2ps6RIN4QJ25rNPMi"
},
"ไทม์สแตมป์": 1564743055901,
"ผู้ส่ง": {
"id": "2254108171328398"
}
}
\],
"id": "177689475607202",
"เวลา": 1564743056313
}
\],
"วัตถุ": "หน้า"
}
}
}
"originalDetectIntentRequest": {
"payload": {
"source": "line",
"contact": {
"cId": "U905251b5f5759acde5e4788681c04269",
"contactId": 123456,
"channelId": 7890
},
"attachments": \[
{
"type": "location",
"payload": {
"lat": 3.146642,
"long": 101.695847,
"address": "Kuala Lumpur City Center"
}
}
\],
"body": {
"events": \[
{
"type": "message",
"replyToken": "16a59224c65b4c5cbecedc4f3504599b",
"source": {
"userId": "U905251b5f5759bbde5e4788681c04170"
"ประเภท": "ผู้ใช้"
}
"ไทม์สแตมป์": 1593146060317
"โหมด": "ใช้งานอยู่"
"ข้อความ": {
"ประเภท": "ข้อความ"
"id": "12211455206333"
"ข้อความ": "สวัสดี"
}
}
\],
"จุดหมายปลายทาง": "U5698920083824716136c04633a9e1710"
}
}
}
"originalDetectIntentRequest": {
"ข้อมูล": {
"แหล่งที่มา": "twilio",
"ข้อมูลติดต่อ": {
"cId": "+12262120005",
"ข้อมูลติดต่อ": 123456,
"channelId": 7890
},
"ข้อมูลแนบ": \[
{
"ประเภท": "ตำแหน่ง",
"ข้อมูล": {
"ละติจูด": 3.146642,
"long": 101.695847,
"address": "Kuala Lumpur City Center"
}
}
\],
"body": {
"ToCountry": "CA",
"ToState": "Ontario",
"SmsMessageSid": "SM1f1c9a30ff67cf5b1a89d5b1e0735a2b",
"NumMedia": "0",
"ToCity": "",
"FromZip": "",
"SmsSid": "SM1f1c9a30ff67cf5b1a89d5b1e0735a2b"
"FromState": "Ontario"
"SmsStatus": "ได้รับแล้ว"
"FromCity": "St Thomas"
"Body": "สวัสดี"
"FromCountry": "CA"
"ถึง": "+12267022870"
"ToZip": ""
"NumSegments": "1"
"MessageSid": "SM1f1c9a30ff67cf5b1a89d5b1e0735a2b"
"รหัสบัญชี": "AC75bcf6cd15a35c46c6e5fa6d6dde6028"
"จาก": "+12262121015"
"เวอร์ชัน Api": "1 เมษายน 2553"
}
}
}
"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",
"message": "สวัสดี",
"message\_id": "026a4c0e38954e5684757ba1de645130",
"ผู้ริเริ่ม": "12267022870",
"เพย์โหลด": "สวัสดี",
"ผู้รับ": "12262121015",
"ผู้รับ": "12262121015",
"ข้อมูลอ้างอิง": "88003423322",
"ผู้ส่ง": "12267022870"
}
}
}
"originalDetectIntentRequest": {
"payload": {
"source": "nexmo",
"contact": {
"cId": "60133386712"
},
"body": {
"msisdn": "12012938397",
"to": "12012938397",
"messageId": "16000002AB5DBF42",
"text": "สวัสดี",
"type": "text",
"คีย์เวิร์ด": "สวัสดี"
"api-key": "2787fb30"
"message-timestamp": "2020-04-27 09:00:08"
}
}
}
"originalDetectIntentRequest": {
"payload": {
"source": "telegram",
"contact": {
"cId": "928825753",
"contactId": 123456,
"channelId": 7890
},
"attachments": \[
{
"type": "location",
"payload": {
"lat": 3.146642,
"long": 101.695847,
"ที่อยู่": "ศูนย์กลางเมืองกัวลาลัมเปอร์"
}
}
\],
"เนื้อหา": {
"update\_id": 68062810,
"ข้อความ": {
"ข้อความ\_id": 358,
"จาก": {
"id": 921815852,
"is\_bot": false,
"ชื่อ\_ชื่อ": "ลีโอ",
"language\_code": "en"
},
"chat": {
"id": 921815852,
"first\_name": "Leo",
"type": "private"
},
"date": 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"
}
}
}
}
}
"originalDetectIntentRequest": {
"payload": {
"source": "viber",
"contact": {
"cId": "T1yTBK3PQTHAFchsDh1skA==",
"contactId": 123456,
"channelId": 7890
},
"attachments": \[
{
"type": "location",
"payload": {
"lat": 3.146642,
"ยาว": 101.695847,
"ที่อยู่": "ศูนย์กลางเมืองกัวลาลัมเปอร์"
}
}
\],
"ร่างกาย": {
"เหตุการณ์": "ข้อความ",
"ประทับเวลา": 1593420787910,
"แชท\_โฮสต์เนม": "BN-CHAT-14\_",
"ข้อความ\_โทเค็น": 5458312086267550000,
"ผู้ส่ง": {
"id": "T1yTBK3PQFGAGdhsDh1skA==",
"ชื่อ": "ลีโอ",
"อวตาร": "https://media-direct.cdn.viber.com/download\_photo?dlid=tHBOJafTJ8WSwoFLCQ0x1lmS8RXeDXXyUVoAoLmmOGPIPRwq NCUO6BH3cG-VoAYd3WetLrBK4nP7C86ZN3MxG5T40A1lduzChAts-ULz0oO9l7FjW3bAYljiLyTGkYbaCRjcQ&fltp=jpg&imsz=0000",
"ภาษา": "en",
"ประเทศ": "MY"
"api\_version": 8
},
"ข้อความ": {
"ข้อความ": "สวัสดี"
"ประเภท": "ข้อความ"
},
"เงียบ": เท็จ
}
}
}
"originalDetectIntentRequest": {
"ข้อมูล": {
"แหล่งที่มา": "wechat"
"ข้อมูลติดต่อ": {
"cId": "ovYOJv8eZlJ5efKToATGeOk5hBQM"
"ข้อมูลติดต่อ": 123456
"channelId": 7890
},
"ข้อมูลแนบ": \[
{
"ประเภท": "ตำแหน่ง"
"ข้อมูล": {
"ละติจูด": 3.146642,
"long": 101.695847,
"address": "Kuala Lumpur City Center"
}
}
\],
"body": {
"xml": {
"ToUserName": \[
"gh\_5b17802cd972"
\],
"FromUserName": \[
"ovYOJv8eZlJ5evMToATGePk5hAQM"
\],
"CreateTime": \[
"1593421765"
\],
"MsgType": \[
"text"
\],
"Content": \[
"Hi"
\],
"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"
"ตำแหน่ง": "en\_US"
}
"ผู้รับ": {
"รหัส": "4db00a5db70efbb51a0cd6a6635918390dd1945a89ce77898ab66b82d5c15344"
}
"แบบสอบถาม": \[
{
"ประเภท": "แบบสอบถาม"
"ข้อความ": "สวัสดี"
}
\]
}
}
}
"originalDetectIntentRequest": {
"payload": {
"body": {
"object": "whatsapp\_business\_account",
"entry": \[
{
"changes": \[
{
"value": {
"contacts": \[
{
"wa\_id": "60124438291",
"profile": {
"name": "Shahzad"
}
}
\],
"ข้อมูลเมตา": {
"แสดง\_หมายเลขโทรศัพท์\_หมายเลข": "15550468615",
"หมายเลขโทรศัพท์\_รหัสประจำตัว": "106875742284151"
},
"การส่งข้อความ\_ผลิตภัณฑ์": "WhatsApp",
"ข้อความ": \[
{
"รหัสประจำตัว": "wamid.HBgLNjAxMjQ0MzgyOTEVAgASGBYzRUIwOTA1ODAxRUQ5MDAxOTI1QTcxAA==",
"type": "text",
"from": "60124438291",
"timestamp": "1680061817",
"text": {
"body": "เล่าเรื่องตลกให้ฉันฟังหน่อย"
}
}
\]
},
"field": "messages"
}
\],
"id": "106024152370383"
}
\]
},
"source": "whatsapp\_business",
"contact": {
"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"
}
}
"originalDetectIntentRequest": {
"ข้อมูล": {
"แหล่งที่มา": "twilio\_whatsapp"
"ข้อมูลติดต่อ": {
"cId": "whatsapp:+60133385703"
"ข้อมูลติดต่อ": 123456
"channelId": 7890
}
"ข้อมูลแนบ": \[
{
"ประเภท": "ตำแหน่ง"
"ข้อมูล": {
"ละติจูด": 3.146642,
"long": 101.695847,
"address": "Kuala Lumpur City Center"
}
}
\],
"body": {
"SmsMessageSid": "SMb16231017683857d42ca62aafabcf205",
"NumMedia": "0",
"SmsSid": "SMb16231017683857d42ca62aafabcf205",
"SmsStatus": "ได้รับ",
"เนื้อหา": "สวัสดี"
"ถึง": "whatsapp:+14155238886"
"NumSegments": "1"
"MessageSid": "SMb16231017683857d42ca62aafabcf205"
"AccountSid": "AC75bcf6cd15a35c46c6e5fa6d6dde6028"
"จาก": "whatsapp:+60144486813"
"ApiVersion": "2010-04-01"
}
}
}
"originalDetectIntentRequest": {
"payload": {
"source": "message\_bird\_whatsapp",
"contact": {
"cId": "60133385712",
"contactId": 123456,
"channelId": 7890
},
"attachments": \[
{
"type": "location",
"payload": {
"lat": 3.146642,
"long": 101.695847,
"address": "Kuala Lumpur City Center"
}
}
\],
"body": {
"contact": {
"attributes": {},
"createdDatetime": "2020-05-18T03:02:01Z",
"customDetails": {},
"displayName": "60123376813",
"firstName": "",
"href": "https://contacts.messagebird.com/v2/contacts/32845951f19c43d0b4e3371df0da941a",
"id": "32845951f19c43d0b4e3371df0da941a",
"lastName": "",
"msisdn": 60123376813,
"updatedDatetime": "2020-05-18T03:02:01Z"
},
"การสนทนา": {
"contactId": "32845951f19c43d0b4e3371df0da941a",
"createdDatetime": "2020-05-18T03:02:01Z",
"id": "64d59ed4cb4f419ca39114c292c1a597",
"lastReceivedDatetime": "2020-06-26T08:58:55.7451283Z",
"status": "active",
"updatedDatetime": "2020-06-25T08:59:30.877791342Z"
},
"ข้อความ": {
"channelId": "f4b115e89415407ab2b97fe85ad3d191",
"เนื้อหา": {
"ข้อความ": "สวัสดี"
},
"conversationId": "64d59ed4cb4f419ca39114c292c1a597",
"createdDatetime": "2020-06-26T08:58:55Z",
"ทิศทาง": "ได้รับแล้ว"
"จาก": "+60123376813"
"รหัส": "91c8268bb72b412cab3b4080a974c5dc"
"แพลตฟอร์ม": "whatsapp"
"สถานะ": "ได้รับแล้ว"
"ถึง": "+6531290788"
"ประเภท": "ข้อความ"
"อัปเดตวันที่และเวลา": "2020-06-26T08:58:55.750324338Z"
},
"ประเภท": "ข้อความ.สร้าง"
}
}
}
"originalDetectIntentRequest": {
"payload": {
"source": "nexmo\_whatsapp",
"contact": {
"cId": "60133386712",
"contactId": 123456,
"channelId": 7890
},
"attachments": \[
{
"type": "location",
"payload": {
"lat": 3.146642,
"ยาว": 101.695847,
"ที่อยู่": "ศูนย์กลางเมืองกัวลาลัมเปอร์"
}
}
\],
"เนื้อหา": {
"ข้อความ\_uuid": "2b53f909-1640-471f-a44d-e4cb9bd00c44",
"ถึง": {
"ประเภท": "whatsapp",
"หมายเลข": "12012938397"
},
"จาก": {
"ประเภท": "whatsapp"
"หมายเลข": "60133285813"
},
"ประทับเวลา": "2020-06-29T04:37:21.876Z"
"ข้อความ": {
"เนื้อหา": {
"ประเภท": "ข้อความ"
"ข้อความ": "สวัสดี"
}
},
"ทิศทาง": "ขาเข้า"
}
}
}
"originalDetectIntentRequest": {
"payload": {
"source": "message\_pipe\_whatsapp",
"contact": {
"cId": "60133386712",
"contactId": 123456,
"channelId": 7890
},
"attachments": \[
{
"type": "location",
"payload": {
"lat": 3.146642,
"long": 101.695847,
"address": "Kuala Lumpur City Center"
}
}
\],
"body": {
"environment": {
"app\_id": "476"
},
"events": \[
{
"name": "d360\_whatsapp\_message\_in",
"properties": {
"stack\_id": "85256128299",
"message\_id": "IY2Cx8lhx0E0M",
"conversation\_id": "K7SWYeCmed07C",
"type": "text",
"content": {
"body": "สวัสดี"
}
},
"timestamp": "1593502341000",
"id": "7a104e27-d4d2-4e5d-8c8a-c74f3ba8e6c1"
}
\],
"อุปกรณ์": {
"mdn": "60133286713",
"profile\_name": "Leo"
},
"recipient\_id": "64f0699c-e005-409d-b177-6a975c61ba60"
}
}
}
"originalDetectIntentRequest": {
"ข้อมูล": {
"แหล่งที่มา": "360dialog\_whatsapp"
"ข้อมูลติดต่อ": {
"cId": "60133386712"
"ข้อมูลติดต่อ": 123456
"channelId": 7890
}
"ข้อมูลแนบ": \[
{
"ประเภท": "ตำแหน่ง"
"ข้อมูล": {
"ละติจูด": 3.146642,
"ยาว": 101.695847,
"ที่อยู่": "ศูนย์กลางเมืองกัวลาลัมเปอร์"
}
}
\],
"ร่างกาย": {
"ผู้ติดต่อ": \[
{
"โปรไฟล์": {
"ชื่อ": "จอห์น ดอน"
},
"wa\_id": "923339883320"
}
\],
"ข้อความ": \[
{
"จาก": "923339885509",
"id": "ABEGkjM5iFUJAhDGiqsifkiyZkH6HzvBfO2m",
"ข้อความ": {
"เนื้อหา": "สวัสดี"
},
"ไทม์สแตมป์": "1595240228",
"ประเภท": "ข้อความ"
}
\]
}
}
}
เพย์โหลดที่ไม่ได้รับการสนับสนุนใดๆ เช่น การ์ด Google Assistant จะไม่ปรากฏบนแพลตฟอร์ม และจะถูกละเว้นโดย respond.io
รูปแบบของเพย์โหลดมีความเข้มงวด และค่าคีย์ที่หายไปใดๆ จะทำให้เกิดผลลัพธ์ที่ไม่พึงประสงค์ เช่น ไม่ปรากฏบนแพลตฟอร์ม ปรากฏไม่ถูกต้อง เป็นต้น
หากคุณมีเกณฑ์การปฏิบัติตามที่ซับซ้อน เช่น การเชื่อมต่อกับบริการของบริษัทภายนอกที่ทำการสอบถามก่อนที่จะส่งการตอบกลับ คุณจะต้องพิจารณาความล่าช้าของเวลาตามที่อธิบายไว้ในเอกสาร ของ Dialogflow ที่นี่ ต้องตอบกลับภายใน 5 วินาที มิฉะนั้น เว็บฮุกจะล้มเหลว และจะไม่มีการตอบกลับไปยัง DialogFlow และ respond.io
บทความที่เกี่ยวข้อง 👩💻