BotCake
Search…
Dynamic Block Docs
Response Reference Docs

Response format

Response format for sending dynamic messages:
{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "simple text"
},
{
...Another messages
}
],
"actions": [ //optional
{
"action": "add_tag",
"tag_id": 12345
},
{
...Another actions
}
],
"quick_replies": [ //optional
{
"type": "flow",
"caption": "Go",
"flow_id": 12345
},
{
...Another quick replies
}
]
}
}
Dynamic block API current version v2 Dynamic block has a limit to have not more than 10 messages in messages block, 11 quick replies and 5 actions. The "buttons", "actions", "quick_replies" properties are optional.

Messages format

Sending text

Use this response for sending text messages. url, flow and call buttons can be used with text message. The "buttons", "actions", "quick_replies" properties are optional.
{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "simple text with button",
"buttons": [
{
"type": "url",
"title": "External link",
"url": "https://botcake.io"
}
]
}
],
"actions": [],
"quick_replies": []
}
}

Sending image

This response is used to send image files. Messenger supports JPG, PNG and GIF images. You can use url, call, flow buttons. The "buttons", "actions", "quick_replies" properties are optional.
{
"version": "v2",
"content": {
"messages": [
{
"type": "image",
"url": "https://statics.pancake.vn/user-content.pancake.vn/photo/xyz.png",
"buttons": []
}
],
"actions": [],
"quick_replies": []
}
}

Sending video file

This response is used to send video files. Messenger supports videos, which are up to 25MB in size. You can use url, call, flow buttons. The "buttons", "actions", "quick_replies" properties are optional.
{
"version": "v2",
"content": {
"messages": [
{
"type": "video",
"url": "https://statics.pancake.vn/user-content.pancake.vn/video/xyz.mpg",
"buttons": []
}
],
"actions": [],
"quick_replies": []
}
}

Sending audio file

This response is used to send audio files. Messenger supports audio, which are up to 25MB in size. You can use url, call, flow buttons. The "buttons", "actions", "quick_replies" properties are optional.
{
"version": "v2",
"content": {
"messages": [
{
"type": "audio",
"url": "https://statics.pancake.vn/user-content.pancake.vn/audio/xyz.mp3",
"buttons": []
}
],
"actions": [],
"quick_replies": []
}
}

Sending files

This response is used to send any other files, which are no larger than 25 MB. The "actions", "quick_replies" properties are optional.
{
"version": "v2",
"content": {
"messages": [
{
"type": "file",
"url": "https://statics.pancake.vn/user-content.pancake.vn/file/xyz.pdf"
}
],
"actions": [],
"quick_replies": []
}
}
This response is used to send a horizontal scrollable gallery. You can use url, call, flow buttons. The "buttons", "actions", "quick_replies" properties are optional.
{
"version": "v2",
"content": {
"messages": [
{
"type": "cards",
"elements": [
{
"title": "Card title",
"subtitle": "card text",
"image_url": "https://statics.pancake.vn/user-content.pancake.vn/photo/xyz.png",
"buttons": []
}
],
"image_aspect_ratio": "horizontal"
}
],
"actions": [],
"quick_replies": []
}
}
We strongly suggest to use HTTPS protocol for your URLs. image_aspect_ratio - The aspect ratio used to render cards. You can use horizontal or square (default horizontal).

Buttons

You can use buttons with each types: call, url, flow. You can provide custom action to be performed with the button. Actions can only be attached to url, flow button types. Actions for buttons must comply with same format and restrictions as described in Actions format bellow. The "actions" property is optional.
{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "simple text",
"buttons": [
{
"type": "url",
"title": "External link",
"url": "https://botcake.io"
},
{
...Another buttons
}
]
},
{
...Another messages
}
],
"actions": [ //optional
{
"action": "add_tag",
"tag_id": 12345
},
{
...Another actions
}
],
"quick_replies": [ //optional
{
"type": "flow",
"caption": "Go",
"flow_id": 12345
},
{
...Another quick replies
}
]
}
}

Call button

{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "simple text with button",
"buttons": [
{
"type": "call",
"title": "Call me",
"phone": "+1 (555) 555-55-55"
}
]
}
],
"actions": [],
"quick_replies": []
}
}

Url button

There are 3 options of webview_size:
full - (100%),
medium - (75%),
compact - (50%)
The "webview_size" property is optional.
{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "simple text with button",
"buttons": [
{
"type": "url",
"title": "External link",
"url": "https://botcake.io",
"webview_size": "full"
}
]
}
],
"actions": [],
"quick_replies": []
}
}

Go to flow button

{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "simple text with button",
"buttons": [
{
"type": "flow",
"title": "Go",
"flow_id": 12345
}
]
}
],
"actions": [],
"quick_replies": []
}
}
flow_id needs flow ID (it can be found in URL when flow is opened)

Actions format

actions property of server response is optional.

Action add tag

Use this response to add a tag to a subscriber. Tag with the same name must exist in your bot:
{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "simple text with button",
"buttons": [
{
"type": "url",
"title": "External link",
"url": "https://botcake.io"
}
]
}
],
"actions": [
{
"action": "add_tag",
"tag_id": 12345
}
],
"quick_replies": []
}
}
Tag ID sent using tag_id parameter should match one of existing tags within Botcake bot

Action remove tag

Use this response to remove a tag from a subscriber. Tag with the same name must exist in your bot:
{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "simple text with button",
"buttons": [
{
"type": "url",
"title": "External link",
"url": "https://botcake.io"
}
]
}
],
"actions": [
{
"action": "remove_tag",
"tag_id": 12345
}
],
"quick_replies": []
}
}

Quick replies

Go to flow quick reply

{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "simple text with button",
"buttons": [
{
"type": "url",
"title": "External link",
"url": "https://botcake.io"
}
]
}
],
"actions": [],
"quick_replies": [
{
"type": "flow",
"caption": "Go",
"flow_id": 12345
}
]
}
}
flow_id needs flow ID (it can be found in URL when flow is opened)

Go to phone number quick reply

{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "simple text with button",
"buttons": [
{
"type": "url",
"title": "External link",
"url": "https://botcake.io"
}
]
}
],
"actions": [],
"quick_replies": [
{
"type": "user_phone_number"
}
]
}
}

Go to email quick reply

{
"version": "v2",
"content": {
"messages": [
{
"type": "text",
"text": "simple text with button",
"buttons": [
{
"type": "url",
"title": "External link",
"url": "https://botcake.io"
}
]
}
],
"actions": [],
"quick_replies": [
{
"type": "user_email"
}
]
}
}

Variables

In dynamic block request body, you can use Full Subscriber Data variable, that contains all subscriber’s information:
{
"user_first_name": "Firstname",
"user_last_name": "Lastname",
"user_full_name": "Subscriber",
"#GENDER{{MALE|FEMALE|UNKNOWN}}": "MALE",
"psid": "123456xxxxxx",
"ad_id": "123456xxxxx",
"page_name": "Botcake",
"{{SPIN_1|SPIN_2}}": "SPIN_1",
"email": "[email protected]",
"phone": "+8438409xxxx",
"address": "Ha Noi",
"current_date": "2018-07-02T00:00:00+00:00",
"CONVERSATION_LINK": "https://pages.fm/323087334762615?c_id=323087334762615_xxxxxxxxxx",
}
Copy link
On this page
Response format
Messages format
Sending text
Sending image
Sending video file
Sending audio file
Sending files
Sending gallery cards
Buttons
Call button
Url button
Go to flow button
Actions format
Action add tag
Action remove tag
Quick replies
Go to flow quick reply
Go to phone number quick reply
Go to email quick reply
Variables