Opt-in webhook is fired for several actions and is generally meant for binding a user in your application. This webhook is fired when:
- Send to Messenger is clicked.
- Checkbox Plugin is ticked.
- Phone Number Matching procedure is called.
- m.me Link is clicked
Opt-in for Send to Messenger
When user presses Send to Messenger button, you will receive following webhook.
{
"event": "opt_in",
"timestamp": "2016-10-06T13:42:48Z",
"data": {
"channel": {
"id": "6456078759331238786",
"type": "facebook_messenger"
},
"contact": {
"id": "6456078781510718339"
},
"opt_in": {
"type": "send_to_messenger",
"payload": "{{PASS_THROUGH_PARAM}}"
}
}
}
Parameter | Type | Description |
---|---|---|
opt_in.type | string | Describes what type of opt-in this is. In case of Send to Messenger, this will always be send_to_messenger . |
opt_in.payload | string | Data set in Send to Messenger Button as data-ref attribute. |
Opt-in for Checkbox
When user ticks Checkbox plugin, you will receive following webhook.
{
"event": "opt_in",
"timestamp": "2016-10-06T13:42:48Z",
"data": {
"channel": {
"id": "6456078759331238786",
"type": "facebook_messenger"
},
"contact": {
"id": "6456078781510718339",
"user_ref": "{{YOUR_CUSTOM_USER_REF}}" // set on frontend checkbox plugin
},
"opt_in": {
"type": "checkbox",
"payload": "{{PASS_THROUGH_PARAM}}"
}
}
}
Parameter | Type | Description |
---|---|---|
contact.user_ref | string | Data that has been set in checkbox plugin user_ref attribute. It is should be uniquely generated string ID (unique for each render). |
opt_in.type | string | Describes what type of opt-in this is. In case of Checkbox plugin, this will always be checkbox . |
opt_in.payload | string | Data that has been set in checkbox plugin ref attribute. |
Opt-in for Phone Number Matching
This webhook is sent when a user accepts the message request sent to his phone number using Phone Number Entry Point.
{
"event": "opt_in",
"timestamp": "2016-10-06T13:42:48Z",
"data": {
"channel": {
"id": "6456078759331238786",
"type": "facebook_messenger"
},
"contact": {
"id": "6456078781510718339",
"phone_number": "15558576309"
},
"opt_in": {
"type": "phone_number"
}
}
}
Parameter | Type | Description |
---|---|---|
contact.phone_number | string | Phone number in E.164 format. |
opt_in.type | string | Describes what type of opt-in this is. In case of Phone Number Matching, this will always be phone_number . |