View Categories

Dynamic Content

2 min read

Response format

Response format for sending dynamic messages:

{
  "version": "v1",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text"
      },
      {
        ...Another messages
      }
    ],
    "actions": [  //optional
      {
        "action": "add_tag",
        "tag_name": "example tag"
      },
      {
        ...Another actions
      }
    ],
    "quick_replies": [ //optional
      {
        "type": "node",
        "caption": "Quick reply text",
        "target": "My Content"
      },
      {
        ...Another quick replies
      }
    ]
  }
}

Dynamic block API current version v1 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.

Button types

url, call, node

{
  "version": "v1",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
          	"type": "url",
          	"caption": "Show",
          	"url": "https://ihakimi.au"  //valid url
          },
          {
          	"type": "call",
          	"caption": "Show",
          	"phone": "+61412345678"  //phone number E164
          },
          {
        	"type": "node",
        	"caption": "Show",
        	"target": "My Content"  //Node name
          }
        ]
      }
    ]
  }
}

Sending text

Use this response for sending text messages.

The url, flow, and node buttons can be used with text messages.

The "buttons", "actions", and "quick_replies" properties are optional.

{
  "version": "v1",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "url",
            "caption": "External link",
            "url": "https://ihakimi.com.au"
          }
        ]
      }
    ],
    "actions": [],
    "quick_replies": []
  }
}

Sending images

This response is used to send image files. Messenger supports JPG, PNG, and GIF images. You can use url, call, buy, flow and node buttons.

The "buttons", "actions", and "quick_replies" properties are optional.

{
  "version": "v1",
  "content": {
    "messages": [
      {
        "type": "image",
        "url": "https://image.amazonaws.com/ca/xxxxxxzzzzzzzzz.png"
      }
    ],
    "actions": [],
    "quick_replies": []
  }
}

Action add tag

Use this response to add a Tag to a contact. A Tag with the same name must exist in your bot.

{
  "version": "v1",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text"
      }
    ],
    "actions": [
      {
        "action": "add_tag",
        "tag_name": "your tag",
      }
    ],
    "quick_replies": []
  }
}

The Tag name sent using the tag_name parameter should match one of the existing Tags

Action set custom user field value

Use this response to set the bot user custom user field value. A Custom Field with the same name must exist in your bot.

{
  "version": "v1",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text"
      }
    ],
    "actions": [
      {
        "action": "set_field_value",
        "field_name": "your field name",
        "value": "some value"
      }
    ],
    "quick_replies": []
  }
}

The filed name sent using field_name should match the name of one of the Custom Fields existing within the bot. You need to control the data type recorded in Custom Fields, data type should match the type of the Custom Field.

Powered by BetterDocs

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top