Webhooks ti consente di ricevere notifiche HTTP in tempo reale relative a modifiche a oggetti specifici nel social graph di Meta. Ad esempio, potremmo inviarti una notifica quando un cliente invia un messaggio al tuo account per professionisti Instagram. Le notifiche webhook ti consentono di monitorare le modifiche alla messaggistica ed evitare i rate limiting che si verificherebbero se eseguissi query sugli endpoint della Piattaforma Messenger per il monitoraggio delle modifiche.
Dovrai implementare i seguenti requisiti per ricevere notifiche Webhooks per i messaggi di Instagram.
instagram_basic
, instagram_manage_messages
e pages_manage_metadata
Nota: dovrai attivare l'iscrizione ai webhook dei messaggi per tutte le app di messaggistica della tua azienda.
Scopri di più sui livelli di accesso , le modalità dell'app e i ruoli nell'app.
Campo del webhook | Descrizione |
---|---|
| Viene inviata una notifica quando un cliente reagisce o annulla l'aggiunta di una reazione a un messaggio L'API Graph v12.0 e versioni successive supporta le reazioni |
| Viene inviata una notifica quando un cliente invia alla tua azienda:
Viene inviata una notifica anche quando la tua azienda invia un messaggio a un cliente. Non viene inviata alcuna notifica quando la tua azienda reagisce o annulla l'aggiunta di una reazione al messaggio di un cliente. Questa callback si verifica in caso di invio di un messaggio dal tuo account Instagram. Il contrassegno |
| Viene inviata una notifica quando un cliente clicca su un'opzione per rompere il ghiaccio o su un pulsante di modello generico Richiede la v8.0 o versioni successive. Richiede la v11.0 o versioni successive per l'inclusione del campo |
| Viene inviata una notifica ogni volta che un messaggio viene letto dal destinatario |
| Viene inviata una notifica ogni volta che un cliente clicca su un link |
| Quando il flusso di messaggi include più app, viene inviata una notifica quando un cliente invia un messaggio alla tua azienda, ma non è l'app a controllare la conversazione al momento dell'invio del messaggio. |
Ecco alcuni esempi dei tipi di notifiche webhook che puoi ricevere.
{ "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" } } ] } ] }