# Buttons

You can use buttons with each types: `call`, `url`, `node`. You can provide custom action to be performed with the button. Actions can only be attached to the `url`, and `node` button types. Actions for buttons must comply with the same format and restrictions as described in the Actions format.

```
{
  "version": "v1",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text",
        "buttons": [
          {
            "type": "url",
            "caption": "External link",
            "url": "https://rapidbott.com",
          },
          {
            ...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 <a href="#call-button" id="call-button"></a>

```
{
  "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 <a href="#url-button" id="url-button"></a>

There are 3 options of `webview_size`:

`full` - (100%),

`medium` - (75%),

`compact` - (50%)

The `webview_size` and `actions` property are optional.

```
{
  "version": "v1",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "url",
            "caption": "External link",
            "url": "https://rapidbott.com",
            "webview_size": "full",
            "actions": [] //optional
          }
        ]
      }
    ],
    "actions": [],
    "quick_replies": []
  }
}


```

### Go to node button <a href="#go-to-node-button" id="go-to-node-button"></a>

The `actions` property is optional.

```
{
  "version": "v1",
  "content": {
    "messages": [
      {
        "type": "text",
        "text": "simple text with button",
        "buttons": [
          {
            "type": "node",
            "caption": "Show",
            "target": "My Content",
            "actions": [] //optional
          }
        ]
      }
    ],
    "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 behavior would not meet expectations. Go to node buttons are not supported in Public API.

### Dynamic block callback button <a href="#dynamic-block-callback-button" id="dynamic-block-callback-button"></a>

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.
