-
-
Notifications
You must be signed in to change notification settings - Fork 198
Buttons node
Guidone edited this page May 9, 2019
·
16 revisions
Available buttons:
- URL: Open a URL inside the client. Button feedbacks are available for Telegram and Messenger extensions in Facebook [Telegram, Facebook, Viber]
- Postback: Allow the user to send a predefined message, the message will no be shown in the chat history. Button feedbacks are available for Telegram and Messenger extensions in Facebook [Telegram, Facebook, Smooch, Viber]
- Phone call: Starts a phone call on mobile. [Facebook]
- Log In: Starts the account linking flow. [Facebook]
- Log Out: Starts the account unlinking flow. [Facebook]
- New row: Telegram supports buttons layout with multiple row, this element just starts a new one. [Telegram, Viber]
Platform exceptions
-
Telegram supports a visual feedback, visible in the client, when a
Postback
orURL
buttons is pressed -
Facebook supports some extra parameters in the
URL
button, like the size of the web view and messenger extensions and a maximum od three buttons.
Buttons can be created programmatically by an upstream Function node
passing array of buttons in the message payload:
msg.payload = [
{
type: 'url',
url: 'http://javascript-jedi.com',
label: 'Javascript Jedi'
},
{
type: 'postback',
value: 'MY_POSTBACK_MESSAGE',
label: 'Click me!'
},
{
type: 'share'
}
];
return msg;
Another way is to specify each config option as keys of an object in the message payload:
msg.payload = {
message: 'This is a message above the buttons',
buttons: [
{
type: 'url',
url: 'http://javascript-jedi.com',
label: 'Javascript Jedi'
},
{
type: 'postback',
value: 'MY_POSTBACK_MESSAGE',
label: 'Click me!'
},
{
type: 'share'
}
]
};
return msg;
Available parameters for the msg.payload
Name | Type | Description |
---|---|---|
message | string | The message text above the buttons |
buttons | array of [button] | The list of inline buttons |
The [button]
object
Name | Type | Description |
---|---|---|
type | string | Type of button: url, postback, quick-reply, location, call, share, login, logout, newline |
label | string | Label of the button |
value | string | Value returned as payload in postback buttons |
url | string | Url to redirect to for url buttons or authentication URL for login buttons |
number | string | Phone number to call for call buttons |
messengerExtensions | boolean | Include Messenger Extensions for url buttons |
answer | string | The feedback shown on Telegram client for url and postback buttons |
alert | boolean | Show the feedback as alert on Telegram client for url and postback buttons |
style | string | Style of buttons in Slack: default, primary, danger |
webViewHeightRatio | string | Aspect ratio of the webview in Facebook Messenger for url buttons . Valid values: tall, compact, full
|