Webhooks ช่วยให้คุณได้รับการแจ้งเตือน HTTP แบบเรียลไทม์เกี่ยวกับการเปลี่ยนแปลงอ็อบเจ็กต์บางรายการในกราฟสังคมของ Meta ตัวอย่างเช่น เราสามารถส่งการแจ้งเตือนถึงคุณเมื่อมีลูกค้าส่งข้อความถึงบัญชีมืออาชีพบน Instagram ของคุณได้ ซึ่งการแจ้งเตือน Webhooks ช่วยให้คุณสามารถติดตามการเปลี่ยนแปลงของการส่งข้อความ และหลีกเลี่ยงขีดจำกัดอัตราที่จะเกิดขึ้นหากคุณสืบค้นตำแหน่งข้อมูลของแพลตฟอร์ม Messenger เพื่อติดตามการเปลี่ยนแปลง
คุณจะต้องนำข้อกำหนดดังต่อไปนี้มาปรับใช้ เพื่อรับการแจ้งเตือน Webhooks สำหรับการส่งข้อความบน Instagram
instagram_basic
, instagram_manage_messages
และ pages_manage_metadata
หมายเหตุ: คุณจะต้องให้แอพส่งข้อความทั้งหมดสำหรับธุรกิจของคุณสมัครรับข้อมูล Webhooks การส่งข้อความ
โปรดเรียนรู้เพิ่มเติมเกี่ยวกับระดับสิทธิ์การเข้าถึง โหมดแอพ และบทบาทในแอพ
ช่อง Webhook | คำอธิบาย |
---|---|
| ระบบจะส่งการแจ้งเตือนเมื่อลูกค้าแสดงความรู้สึกหรือยกเลิกการแสดงความรู้สึกต่อข้อความ API กราฟ เวอร์ชั่น 12.0 ขึ้นไปจะรองรับความรู้สึก |
| ระบบจะส่งการแจ้งเตือนเมื่อลูกค้าส่งสิ่งต่อไปนี้ให้กับธุรกิจของคุณ
นอกจากนี้ ระบบยังส่งการแจ้งเตือนเมื่อธุรกิจของคุณส่งข้อความถึงลูกค้าอีกด้วย โดยระบบจะไม่ส่งการแจ้งเตือนเมื่อธุรกิจของคุณแสดงความรู้สึกหรือยกเลิกการแสดงความรู้สึกต่อข้อความของลูกค้า การเรียกกลับนี้จะเกิดขึ้นเมื่อมีการส่งข้อความจากบัญชี Instagram ของคุณ โดยแฟล็ก |
| ระบบจะส่งการแจ้งเตือนเมื่อลูกค้าคลิกที่ตัวเลือกประโยคเริ่มการสนทนาหรือปุ่มเทมเพลตทั่วไป จำเป็นต้องใช้เวอร์ชั่น 8.0 ขึ้นไป จำเป็นต้องใช้เวอร์ชั่น 11.0 ขึ้นไป เพื่อให้มีช่อง |
| ระบบจะส่งการแจ้งเตือนเมื่อผู้รับอ่านข้อความแล้ว |
| ระบบจะส่งการแจ้งเตือนเมื่อลูกค้าในการสนทนาที่มีอยู่ได้คลิกลิงก์ |
| เมื่อขั้นตอนการส่งข้อความมีหลายขั้นตอน ระบบจะส่งการแจ้งเตือนเมื่อลูกค้าส่งข้อความถึงธุรกิจของคุณ แต่แอพไม่ได้ควบคุมการสนทนาในขณะที่มีการส่งข้อความ |
ต่อไปนี้เป็นตัวอย่างสำหรับการแจ้งเตือน Webhooks ประเภทต่างๆ ที่คุณสามารถรับได้
{ "object": "instagram", "entry": [ { "id": "IGID", // ID of your Instagram Professional account "time": 1569262486134, "messaging": [ { "sender": { "id": "IGSID" }, // Instagram-scoped ID for the customer who sent the message "recipient": { "id": "IGID" }, // ID of your Instagram Professional account "timestamp": 1569262485349, "message": { "mid": "MESSAGE-ID", // ID of the message sent to your business "text": "MESSAGE-TEXT" // Included when a customer sends a message containing text "attachments": [ // Included when a customer sends multiple media attachments or a URL for a story mention or share { "type":"image", // Can be audio, file, image (image or sticker), share, story_mention, or video "payload":{ "url":"LINK" } }, { "type":"video", "payload":{ "url":"LINK" } } ] "is_deleted": true // Included when a customer deletes a message "is_echo": true // Included when your business sends a message to the customer "is_unsupported": true, // Included when a customer sends a message with unsupported media "quick_reply": { // Included when a customer clicks a quick reply "payload": "CUSTOMER-RESPONSE-PAYLOAD" // The payload with the option selected by the customer }, "referral": { // Included when a customer clicks an Instagram Shop product "product": { "id": "PRODUCT-ID" } "referral": { // Included when a customer clicks an CTD ad "ref": "REF-DATA-IN-AD-IF-SPECIFIED" "ad_id": AD-ID, "source": "ADS", "type": "OPEN_THREAD", "ads_context_data": { "ad_title": TITLE-FOR-THE-AD, "photo_url": IMAGE-URL-THAT-WAS-CLICKED, "video_url": THUMBNAIL-URL-FOR-THE-AD-VIDEO, } } "reply_to":{ // Included when a customer sends an inline reply "mid":"MESSAGE-ID" } "reply_to": { // Included when a customer replies to a story "story": { "url":"CDN-URL", "id":"STORY-ID" } } } } ] } ] }
{ "object": "instagram", "entry": [ { "id": "IGID", // ID for your Instagram Professional account "time": 1569262486134, "messaging": [ { "sender": { "id": "IGSID" // Instagram-scoped ID for the customer who sent the message }, "recipient": { "id": "IGID" // ID for your Instagram Professional account }, "timestamp": 1569262485349, "reaction" :{ "mid" : "MESSAGE-ID", "action": "react", // or unreact "reaction": "love", // optional, to unreact if there is no reaction field "emoji": "\u{2764}\u{FE0F}" // optional, to unreact if there is no emoji field } } ] } ] }
{ "object": "instagram", "entry": [ { "id": "IGSID", // ID of your Instagram Professional account "time": 1502905976963, "messaging": [ { "sender": { "id": "IGSID" }, // Instagram-scoped ID for the customer who sent the message "recipient": { "id": "IGID" }, // ID of your Instagram Professional account "timestamp": 1502905976377, "postback": { "mid":"MESSAGE-ID", // ID for the message sent to your business "title": "SELECTED-ICEBREAKER-REPLY-OR-CTA-BUTTON", "payload": "CUSTOMER-RESPONSE-PAYLOAD", // The payload with the option selected by the customer } } ] } ] }
{ "object": "instagram", "entry": [ { "id": "IGSID", // ID of your Instagram Professional account "time": 1502905976963, "messaging": [ { "sender": { "id": "IGSID" // Instagram-scoped ID for the customer who sent the message }, "recipient": { "id": "IGID" // ID of your Instagram Professional account }, "timestamp": 1502905976377, "referral": { "ref": "INFORMATION-INCLUDED-IN-REF-PARAMETER-OF-IGME-LINK" "source": "IGME-SOURCE-LINK" "type": "OPEN_THREAD" // Only supported for existing conversations } } ] } ] }
{ "object":"instagram", "entry":[ { "id":"IGID", // ID for your Instagram Professional account "time":1569262486134, "messaging":[ { "sender":{ "id":"IGSID" // Instagram-scoped ID for the customer who sent the message }, "recipient":{ "id":"IGID" // ID for your Instagram Professional account }, "timestamp":1569262485349, "read":{ "mid":"MESSAGE-ID" } } ] } ] }