inlineButtons
To display inline buttons in a chat, use the inlineButtons
reply type.
Inline buttons are displayed inside the chat as chatbot responses. Clicking on an inline button will redirect the user to the specified URL.
tip
You can also use the
inlineButtons
DSL tag or the $reactions.inlineButtons
method.
Such buttons have extended functionality:
you can set transitions to other states
and also pass any callback data into it.Properties
The inlineButtons
replies accept a buttons
property, an array of objects that describe the buttons.
Each object contains the following properties:
Property | Type | Required | Description |
---|---|---|---|
text | String | Yes | Button text. |
url | String | No | Target URL where the user will be redirected to when the button is selected. If the property is not specified, then selecting the button will send a message with the button text to the chat. |
Syntax
{
"type": "inlineButtons",
"buttons": [
{
"text": "Button 1",
"url": "https://example.com"
},
{
"text": "Button 2",
"url": "https://example.com/2/"
}
]
}
Channel restrictions
inlineButtons
is only supported in the following channels:
- Chat API
- Chat widget
- Telegram
- Viber
caution
Some channels have their own restrictions on using buttons, such as the maximum number of buttons in one message.
Refer to Channel features and restrictions to find out more.
How to use
state: TrackPackage
a: You can track your package by its tracking number on our website.
script:
$response.replies = $response.replies || [];
$response.replies.push({
"type": "inlineButtons",
"buttons": [{"text": "Track package", "url": "https://example.com/trackPackage"}]
});