Webhook 事件是 Messenger 平台向您的 Bot 發出通知的方式;當發生各種互動或事件(包括用戶傳送訊息)時,便會發出通知。Webhook 事件會以 POST 要求的形式,由 Messenger 平台傳送至您的 Webhook。
注意:您需要為企業的所有訊息應用程式訂閱訊息 Webhooks。
以下是 Messenger 平台可向您的 Webhook 傳送的事件清單。
注意:建議您使用最新版本的 API 來接收每個 Webhook 的所有資訊。
Messaging Webhooks Field | Description |
---|---|
| A notification is sent when a message that was sent by your business has been delivered to a customer. Only available for Messenger conversations. |
| A notification is sent when your business has sent a message. Only availalbe for Messenger conversations. For Instagram Messaging conversations, the |
| A notification is sent when a customer edits a previously-sent message. Only availalbe for Messenger conversations. |
| A notification is sent when a customer reacts to a message sent by your business. |
| A notification is sent when a customer reads a message sent by your business, for Messenger conversations. See |
| A notification is sent when your business has received a message from a customer from any conversation entry point. For Instagram Messaging, a notification is also sent when your Instagram Professional account has sent a message since |
| A notification is sent when a customer links or unlinks their Messenger account from their account with your business. Only available for Messenger conversations. |
| A notification is sent when a person has submitted feedback for your business. Only available for Messenger conversations. |
| A notification is sent when a person has played a round of an Instant Game. Only available for Messenger conversations. |
| A notification is sent when a change has occurred during the Handover Protocol |
| A notification is sent when a customer has clicked a Messenger plugin, accepted a message request using customer matching, or has opted in to receive messages via the checkbox plugin. Only available for Messenger conversations. |
| A notification is sent when a policy enforcement warning has been sent or a policy enforcement action has been taken on the app associated with the Page. |
| A notification is sent when a customer clicks a postback button, Get Started button, or persistent menu item for Messenger conversations or an Icebreaker option or Generic Template button for Instagram Messaging conversations. |
| A notification is sent when a customer resumes a conversation with the Page by clicking an ig.me or m.me link, an ad or chat plugin. |
| A notification is sent when a customer reads a message sent by your business, for Instagram Messaging conversations. See |
| A notification is sent when your business has received a message from a customer, when the message contains cart/order information. Only available for Messenger conversations. |
| A notification is sent when a conversation is idle for an app during the Handover Protocol |
所有 Messenger 平台的回呼都有一組通用屬性,可提供所需資訊以讓您處理並回覆用戶使用您的 Bot 輸入的內容。除了下列屬性之外,每個事件也包含特定的屬性,用以說明該事件的詳細情況。
{
"object":"page",
"entry":[
{
"id":"<PAGE_ID>",
"time":1458692752478,
"messaging":[
{
"sender":{
"id":"<PSID>"
},
"recipient":{
"id":"<PAGE_ID>"
},
...
}
]
}
]
}
屬性 | 類型 | 說明 |
---|---|---|
| 字串 | 值為 |
|
| 包含事件資料的陣列 |
entry
屬性 | 類型 | 說明 |
---|---|---|
| 字串 | 專頁的專頁編號 |
| 數字 | 更新時間(以毫秒為單位的 Epoch 時間) |
| 陣列< | 包含一個 |
entry.messaging
屬性 | 類型 | 說明 |
---|---|---|
| 字串 | 傳送者用戶編號 |
| 字串 | 傳送對象用戶編號 |