# Buttons

You can use buttons with each types: call, url, node.

{
  "version": "v1",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text",
        "buttons": [
          {
            "type": "url",
            "caption": "External link",
            "url": "https://uchat.com.au",
          },
          {
            ...Another buttons
          }
        ]
      },
      {
        ...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
      }
    ]
  }
}

# Call button

{
  "version": "v1",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "call",
            "caption": "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": "v1",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "url",
            "caption": "External link",
            "url": "https://uchat.com.au",
            "webview_size": "full"
          }
        ]
      }
    ],
    "actions": [],
    "quick_replies": []
  }
}

# Go to node button

{
  "version": "v1",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "node",
            "caption": "Show",
            "target": "My Content"
          }
        ]
      }
    ],
    "actions": [],
    "quick_replies": []
  }
}

target key should be linked to a node existing within executed flow. Node name can be found in its header, you need to use unique name for node connected with link. If there are multiple nodes with similar names inside of the same flow, transition behaviour would not meet expectations. Go to node buttons are not supported in Public API.

# Dynamic block callback button

The "headers", "payload" properties are optional.

{
  "version": "v1",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "dynamic_block_callback",
            "caption": "Dynamic content",
            "url": "https://your-service.com/dynamic",
            "method": "post",
            "headers": {
              "x-header": "value"
            },
            "payload": {
              "key": "value"
            }
          }
        ]
      }
    ],
    "actions": [],
    "quick_replies": []
  }
}

dynamic_block_callback works the same way as dynamic block in a content node, it will send a request to the server upon click, server reply will be sent to user. External server URL must be mentioned with HTTPS protocol.

Last Updated: 12/9/2020, 4:56:07 AM