LogoLogo
Vietnamese
Vietnamese
  • Giới thiệu
  • Giải thích thuật ngữ
  • Kết nối Botcake lần đầu sử dụng
  • Tích hợp Zalo OA
  • Tích hợp Instagram
  • Google Site Search
  • Tích hợp Google API
  • Tích hợp WhatsApp
  • Các chức năng chính
    • Ecommerce
    • Cấu hình chung
    • Bảng điều khiển
    • Khách hàng
    • Livechat
    • Công cụ Bình luận
    • Gửi tin nhắn
    • Luồng tin nhắn
    • Công cụ
      • QR Code
      • Customer Chat
      • Messenger Ref URL
      • Facebook Ads JSON
  • Automation
    • Câu hỏi thường gặp
    • Menu chính
    • Tin nhắn mở đầu
    • Tin nhắn mặc định
    • Từ khoá
    • Kịch bản chăm sóc
    • Quy luật
  • Thiết lập tin nhắn
    • Các thành phần trong trang thiết lập tin nhắn
    • Hướng dẫn lấy URL Facebook
    • Hướng dẫn import và phát Coupon code
  • Cấu hình
    • Dynamic Block Docs
    • Thẻ khách hàng
    • Danh mục sản phẩm
    • Custom Field
    • Chủ đề OTN
    • Marketing Messages(MM) - Tin nhắn Marketing
    • Vòng quay may mắn
    • Tích hợp ChatGPT
    • Quản trị viên và lịch sử lỗi
  • Nâng cao
    • Hướng dẫn thiết lập luồng tự động lên đơn tại POS với Botcake
    • Các mã lỗi thường gặp khi sử dụng Chatbot
    • Upsell không vi phạm chính sách của Facebook
    • Usecase chăm sóc lại khách hàng cũ miễn phí
    • Changelog
      • Giao thức chuyển giao
  • API Reference
Powered by GitBook
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 add custom field
  • Action remove tag
  • Quick replies
  • Go to flow quick reply
  • Go to phone number quick reply
  • Go to email quick reply
  • Variables

Was this helpful?

  1. Cấu hình

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
      },
      {
        "action": "set_custom_field",
        "action_id": 17,
        "action_value": "abcd"
      },
      {
        ...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": []
  }
}

Sending gallery cards

On WhatsApp, it requires at least 1 button in gallery

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

Not available on WhatsApp

{
  "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

Not available on WhatsApp

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 add custom field

Use this response to add a custom field to a subscriber.

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

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

Only available on Messenger or Instagram

{
  "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

Only available on Messenger

{
  "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

Only available on Messenger

{
  "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": "abc@gmail.com",
    "phone": "+8438409xxxx",
    "address": "Ha Noi",
    "current_date": "2018-07-02T00:00:00+00:00",
    "CONVERSATION_LINK": "https://pages.fm/323087334762615?c_id=323087334762615_xxxxxxxxxx",
}
PreviousHướng dẫn import và phát Coupon codeNextThẻ khách hàng

Last updated 1 year ago

Was this helpful?