WhatsApp Business API 用戶端會傳送通知,讓您知道您與用戶之間的訊息 status
。這些通知透過 statuses
物件傳送。
您會就自己商家傳送的每一則訊息,收到有關這些訊息狀態的通知。在下方表格點擊左欄中的箭咀,即可了解每種狀態在 WhatsApp 應用程式中對應的呈現方式(如有)。
名稱 | 說明 |
---|---|
| 用戶已刪除自己傳送的訊息。收到此通知時,如果您已從伺服器下載此訊息,您應確保將其從您的系統中刪除。 |
| 您商家傳送的訊息已送達用戶裝置。 |
| 您商家傳送的訊息無法傳送出去。回呼中將包含失敗原因。請查閱錯誤訊息文件以助除錯: |
| 用戶已讀取您商家傳送的訊息。 |
| 您商家傳送的訊息正在我們不同的系統之間傳輸。 企業內部 API 用戶:如要接收 |
| 在您商家傳送的訊息中,某個項目所在的目錄已無法使用或不存在。 |
這些通知在您應用程式所顯示的順序,未必可反映出訊息狀態實際在什麼時候出現。若有需要,請查看時戳以確認時間。
如果訊息狀態為 read
,則此訊息必定已 delivered
。在某些情況下(例如當用戶開啟了對話畫面並在此時收到訊息),則此訊息幾乎會同時變為 delivered
和 read
。在這種情況或其他類似情況下,系統不會傳回 delivered
通知,因為如果訊息為已讀,則一定亦已送達。此行為旨於執行內部優化。
自 2022 年 2 月 1 日起,已發出通知中的 statuses
物件會包含兩個新的巢狀物件:conversation
和 pricing
。視乎對話開始的位置而定,對話和定價物件元件也有不同。對話可由用戶或商家開始,也可以由免費進入點發起。詳情請見下文:
在以下範例中,recipient_id
可以由 group_id
欄位取代,這取決於訊息是傳送至個別用戶還是群組。
當商家將訊息作為用戶主動開啟對話(該對話並非源自於免費進入點)的一部分傳送時,便會收到以下 Webhook:
{ "statuses": [{ "id": "ID", "recipient_id": "WHATSAPP_ID", "status": "sent", "timestamp": "TIMESTAMP", "type": "message", "message": { "recipient_id":"WHATSAPP_ID" }, "conversation": { "id": "CONVERSATION_ID", "expiration_timestamp": TIMESTAMP, "origin": { "type": "user_initiated" } }, "pricing": { "pricing_model": "CBP", "billable": true, "category": "user_initiated" } }] }
針對媒體訊息,當商家將訊息作為用戶主動開啟對話(該對話並非源自於免費進入點)的一部分傳送時,便會收到以下 Webhook:
{ "statuses": [{ "id": "ID", "recipient_id": "WHATSAPP_ID", "status": "sent", "timestamp": "TIMESTAMP", "type": "message", "message": { "media_id": "98d14c8e-0310-4061-8f99-2d148274c286", "recipient_id":"WHATSAPP_ID" }, "conversation": { "id": "CONVERSATION_ID", "expiration_timestamp": TIMESTAMP, "origin": { "type": "user_initiated" } }, "pricing": { "pricing_model": "CBP", "billable": true, "category": "user_initiated" } }] }
當商家將訊息作為商家主動開啟對話的一部分傳送時,便會收到以下 Webhook:
{ "statuses": [{ "id": "ID", "recipient_id": "WHATSAPP_ID", "status": "sent", "timestamp": "TIMESTAMP", "type": "message", "message": { "recipient_id":"WHATSAPP_ID" }, "conversation": { "id": "CONVERSATION_ID", "expiration_timestamp": TIMESTAMP, "origin": { "type": "business_initiated" } }, "pricing": { "pricing_model": "CBP", "billable": true, "category": "business_initiated" } }] }
當商家傳送訊息以回覆源自於免費進入點的用戶開始的對話時,便會收到以下 Webhook:
{ "statuses": [{ "id": "ID", "recipient_id": "WHATSAPP_ID", "status": "sent", "timestamp": "TIMESTAMP", "type": "message", "message": { "recipient_id":"WHATSAPP_ID" }, "conversation": { "id": "CONVERSATION_ID", "expiration_timestamp": TIMESTAMP, "origin": { "type": "referral_conversion", } }, "pricing": { "pricing_model": "CBP", "billable": false, "category": "referral_conversion" } }] }
當商家訊息已送達,且該訊息為用戶開始的對話(該對話並非源自於免費進入點)的一部分時,便會收到以下 Webhook:
{ "statuses": [{ "id": "ID", "recipient_id": "WHATSAPP_ID", "status": "delivered", "timestamp": "TIMESTAMP", "type": "message", "message": { "recipient_id":"WHATSAPP_ID" }, "conversation": { "id": "CONVERSATION_ID", "origin": { "type": "user_initiated" } }, "pricing": { "pricing_model": "CBP", "billable": true, "category": "user_initiated" } }] }
當商家訊息已送達,且該訊息為商家開始的對話的一部分時,便會收到以下 Webhook:
{ "statuses": [{ "id": "ID", "recipient_id": "WHATSAPP_ID", "status": "delivered", "timestamp": "TIMESTAMP", "type": "message", "message": { "recipient_id": "WHATSAPP_ID" }, "conversation": { "id": "CONVERSATION_ID", "origin": { "type": "business_initiated" } }, "pricing": { "pricing_model": "CBP", "billable": true, "category": "business_initiated" } }] }
當商家訊息已送達,且該訊息為用戶開啟的對話(該對話源自於免費進入點)的一部分時,便會收到以下 Webhook:
{ "statuses": [{ "id": "ID", "recipient_id": "WHATSAPP_ID", "status": "delivered", "timestamp": "TIMESTAMP", "type": "message", "message": { "recipient_id": "WHATSAPP_ID" }, "conversation": { "id": "CONVERSATION_ID", "origin": { "type": "referral_conversion", } }, "pricing": { "pricing_model": "CBP", "billable": false, "category": "referral_conversion" } }] }
已讀訊息的標準回呼:
{ "statuses":[{ "id": "ID", "recipient_id": "WHATSAPP_ID", "status": "read", "timestamp": "TIMESTAMP", "type": "message", "message": { "recipient_id": "WHATSAPP_ID" } }] }
{ "statuses": [{ "errors": [{ "code": 470, "title": "Failed to send message because you are outside the support window for freeform messages to this user. Please use a valid HSM notification or reconsider." }], "id": "ID", "recipient_id": "WHATSAPP_ID", "status": "failed", "timestamp": "TIMESTAMP" }] }
{ "statuses": [{ "errors": [{ "code": 480, "title": "Failed to send message since we detect an identity change of the contact" }], "id": "ID", "recipient_id": "WHATSAPP_ID", "status": "failed", "timestamp": "TIMESTAMP" }] }
如果訊息無法傳送,則回呼中不包含對話子部分。這種情況下並不涉及任何收費或對話啟動。
已刪除訊息的標準回呼:
{ "statuses": [{ "id": "ID", "recipient_id": "WHATSAPP_ID", "status": "deleted", "timestamp": "TIMESTAMP", "type": "message", "message": { "recipient_id": "WHATSAPP_ID" } }] }
如果訊息已刪除,則回呼中不包含對話子部分。這種情況下並不涉及任何收費或對話啟動。
請參閱概覽,訊息以獲取相關資訊。
Yes, there is a specific scenario where you can get pricing information on your webhook alert for read messages. For each sent message, there can be 3 scenarios:
Scenario | When it Happens |
---|---|
You get a webhook alert when the message is delivered (including pricing information) and another webhook alert when the message is read (not including pricing information). | This is the most common scenario. |
You get a webhook alert when the message is delivered (including pricing information). You do not get a webhook alert that the message has been read. | Common when a customer has turned off the feature that lets people know they have read a message. |
You get a webhook alert when the message is read (including pricing information). You do not get a webhook alert that the message has been delivered. | Only triggered when the user is already reading the thread with the business when the message comes in. |