Facebook Quick Replies

Facebook Quick Replies allows your customers to easily reply your messages using pre-defined responses in form of buttons. Quick reply messages may contain multiple buttons with a title and an optional image, and they can also be used for requesting the recipient's phone number and e-mail address.

Once the quick reply button is clicked, all buttons are dismissed and an inbound message is created according to the recipient's selection.

Text quick reply

In order to send a text quick reply, you can use any of the endpoints for sending messages in Conversations API with the message type facebookQuickReply. The example below illustrates how to send it using the endpoint POST /v1/send.

curl -X "POST" "https://conversations.messagebird.com/v1/send" \
-H 'Authorization: AccessKey {your-access-key}' \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"content": {
"facebookQuickReply": {
"text": "Text quick reply sample.",
"quick_replies": [
{
"title": "Title 1",
"content_type": "text",
"payload": "payload-1"
},
{
"title": "Title 2",
"content_type": "text",
"payload": "payload-2"
}
]
}
},
"to": "4190112347766899",
"type": "facebookQuickReply",
"from": "99dde520cd834661a1771ad08044be8b"
}'
  • The message type must be facebookQuickReply
  • For text quick replies, the field content.facebookQuickReply.text must be set
  • The field content.facebookQuickReply.quick_replies must contain an array of FacebookQuickReply
  • The field content.facebookQuickReply.quick_replies[].title must contain the text to be displayed in the quick reply button
  • For text quick replies, the field content.facebookQuickReply.quick_replies[].content_type must be text
  • The field content.facebookQuickReply.quick_replies[].payload must contain a string that's send through an inbound message

The message sent by the previous code snippet looks like the following.

The message looks like the following in Conversations API.

{
"id": "e700dfde6bd74ff3ad4c95223fd90166",
"conversationId": "6279c2012f7d4df393cfa1f872518518",
"platform": "facebook",
"to": "4190112347766899",
"from": "101397625015964",
"channelId": "99d0e570cd834661a1771ab08044be8b",
"type": "facebookQuickReply",
"content": {
"facebookQuickReply": {
"text": "Text quick reply sample.",
"quick_replies": [
{
"content_type": "text",
"title": "Title 1",
"payload": "payload-1"
},
{
"content_type": "text",
"title": "Title 2",
"payload": "payload-2"
}
]
}
},
"direction": "sent",
"status": "sent",
"createdDatetime": "2022-02-03T16:28:19.187062243Z",
"updatedDatetime": "2022-02-03T16:28:19.214867842Z"
}

When the recipient clicks on a specific quick reply button, all other buttons disappear and the reply is visible in the recipient's Facebook Messenger app like the following.

The recipient's reply message looks like the following in Conversations API.

{
"id": "b7a42fe4d0a64a508225385d25f35f4e",
"conversationId": "6279c2012f7d4df393cfa1f872518518",
"platform": "facebook",
"to": "101397625015964",
"from": "4190117307726093",
"channelId": "99d0e570cd834661a1771ab08044be8b",
"type": "facebookQuickReply",
"content": {
"facebookQuickReply": {
"text": "Title 1",
"quick_replies": [
{
"payload": "payload-1"
}
]
}
},
"direction": "received",
"status": "received",
"createdDatetime": "2022-02-03T16:34:15.239Z",
"updatedDatetime": "2022-02-03T16:34:15.239Z"
}

Phone number quick reply

In order to send a phone number quick reply, you can use any of the endpoints for sending messages in Conversations API with the message type facebookQuickReply. The example below illustrates how to send it using the endpoint POST /v1/send.

curl -X "POST" "https://conversations.messagebird.com/v1/send" \
-H 'Authorization: AccessKey {your-access-key}' \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"content": {
"facebookQuickReply": {
"text": "Can you please share your phone number?",
"quick_replies": [
{
"content_type": "user_phone_number"
}
]
}
},
"to": "3298243536965995",
"type": "facebookQuickReply",
"from": "2cc5f8a4020747be80c6b1f70c9f6eb3"
}'

The message sent in the code snippet above looks like the following in the Facebook Messenger.

And the message looks like the following in Conversations API.

{
"id": "382303c0f10c454d8b7f7e17da222b0e",
"conversationId": "fc1589ad98c34841a2aa40b5d79c431b",
"platform": "facebook",
"to": "3298243536965995",
"from": "103955145046384",
"channelId": "2cc5f8a4020747be80c6b1f70c9f6eb3",
"type": "facebookQuickReply",
"content": {
"facebookQuickReply": {
"text": "Can you please share your phone number?",
"quick_replies": [
{
"content_type": "user_phone_number"
}
]
}
},
"direction": "sent",
"status": "sent",
"createdDatetime": "2022-02-10T10:08:52.494355828Z",
"updatedDatetime": "2022-02-10T10:08:52.530605461Z"
}

Once the recipient clicks on their phone number, the reply looks like the following in Facebook Messenger.

And the inbound message looks like the following in Conversations API.

{
"id": "88b88a40e3134fb093786f6fa5932c96",
"conversationId": "fc1589ad98c34841a2aa40b5d79c431b",
"platform": "facebook",
"to": "103955145046384",
"from": "3298243536965995",
"channelId": "2cc5f8a4020747be80c6b1f70c9f6eb3",
"type": "facebookQuickReply",
"content": {
"facebookQuickReply": {
"text": "+0000000000000",
"quick_replies": [
{
"payload": "+0000000000000"
}
]
}
},
"direction": "received",
"status": "received",
"createdDatetime": "2022-02-10T10:12:57.437Z",
"updatedDatetime": "2022-02-10T10:12:57.437Z"
}

Email quick reply

In order to send a email quick reply, you can use any of the endpoints for sending messages in Conversations API with the message type facebookQuickReply. The example below illustrates how to send it using the endpoint POST /v1/send.

curl -X "POST" "https://conversations.messagebird.com/v1/send" \
-H 'Authorization: AccessKey {your-access-key}' \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"content": {
"facebookQuickReply": {
"text": "Can you please share your email?",
"quick_replies": [
{
"content_type": "user_email"
}
]
}
},
"to": "3298243536965995",
"type": "facebookQuickReply",
"from": "2cc5f8a4020747be80c6b1f70c9f6eb3"
}'

The message sent in the code snippet above looks like the following in the Facebook Messenger.

And the message looks like the following in Conversations API.

{
"id": "1e3cd5913ba043af87cac009d8efe7fb",
"conversationId": "fc1589ad98c34841a2aa40b5d79c431b",
"platform": "facebook",
"to": "3298243536965995",
"from": "103955145046384",
"channelId": "2cc5f8a4020747be80c6b1f70c9f6eb3",
"type": "facebookQuickReply",
"content": {
"facebookQuickReply": {
"text": "Can you please share your email?",
"quick_replies": [
{
"content_type": "user_email"
}
]
}
},
"direction": "sent",
"status": "sent",
"createdDatetime": "2022-02-10T12:27:13.431851501Z",
"updatedDatetime": "2022-02-10T12:27:13.499705107Z"
}

Once the recipient clicks on their phone number, the reply looks like the following in Facebook Messenger.

And the inbound message looks like the following in Conversations API.

{
"id": "017c958f39324621ba916946837c7d98",
"conversationId": "fc1589ad98c34841a2aa40b5d79c431b",
"platform": "facebook",
"to": "103955145046384",
"from": "3298243536965995",
"channelId": "2cc5f8a4020747be80c6b1f70c9f6eb3",
"type": "facebookQuickReply",
"content": {
"facebookQuickReply": {
"text": "support@messagebird.com",
"quick_replies": [
{
"payload": "support@messagebird.com"
}
]
}
},
"direction": "received",
"status": "received",
"createdDatetime": "2022-02-10T12:28:48.508Z",
"updatedDatetime": "2022-02-10T12:28:48.508Z"
}

Questions?

We’re always happy to help with code or other doubts you might have! Check out our Quickstarts, API Reference, Tutorials, SDKs, or contact our Support team.

Cookie Settings