messaging_referrals Webhook Event ReferenceThis callback will occur when the user already has a thread with the bot and user comes to the thread from:
For tracking referrals in new threads, refer to Postback Event.
To start receiving these events you need to subscribe to messaging_referrals in the webhook settings for your app.
{
"sender": {
"id": "<PSID>"
},
"recipient": {
"id": "<PAGE_ID>"
},
"timestamp": 1458692752478,
"referral": {
"ref": <REF_DATA_PASSED_IN_M.ME_PARAM>,
"source": "SHORTLINK",
"type": "OPEN_THREAD",
}
}{
"sender": {
"id": "<PSID>"
},
"recipient": {
"id": "<PAGE_ID>"
},
"timestamp": 1458692752478,
"referral": {
"ref": <REF_DATA_IF_SPECIFIED_IN_THE_AD>,
"ad_id": <ID_OF_THE_AD>,
"source": "ADS",
"type": "OPEN_THREAD",
"ads_context_data": {
"ad_title": <TITLE_OF_THE_AD>,
"photo_url": <URL_OF_THE_IMAGE_FROM_AD_THE_USER_IS_INTERESTED_IN>,
"video_url": <THUMBNAIL_URL_OF_THE_VIDEO_FROM_THE_AD>,
"post_id": <ID_OF_THE_POST>,
"product_id": <PRODUCT_ID>,
"flow_id": <ID_OF_THE_PARTNER_APP_WELCOME_MESSAGE_FLOW>
}
}
}For more information about the flow ID, please refer to Welcome Message Flows.
sendersender Field | Description |
|---|---|
| The Page-scoped ID for the person who sent a message to your business |
recipientrecipient Field | Description |
|---|---|
| The ID for your Facebook Page |
referral| Property | Type | Description |
|---|---|---|
| String | The source of the referral. Supported values:
|
| String | The referral type. Currently supports |
| String | The optional |
| String | The URI of the site where the message was sent. |
| Object | The data contaning information about the CTM ad, the user initiated the thread from. |
ads_context_data| Property | Type | Description |
|---|---|---|
| String | Title of the Ad. |
| String | [Optional] Url of the image from the Ad the user is interested. |
| String | [Optional] Thumbnail url of the the video from the ad. |
| String | ID of the post. |
| String | [Optional] Product ID from the Ad the user is interested. |