Button Object for Message Cards
The button object is categorized under the Message Object. There are two different types of buttons
A button added in a message card will be structured with the button object.
The button object can have the following attributes. The mandatory fields are indicated by a *
Attribute | Type | Description |
label* | string | The display name of the button. Maximum number of characters allowed: 20 |
hint | string | A tool tip indicating the button's function while hovering over. Maximum number of characters allowed : 100 |
type* | string | The type + denotes a button with green outline , type - denotes button with red outline. |
key | string | Unique key set for each button. This key can be defined to easily identify and differentiate the buttons clicked and execute the functionality. Maximum number of characters allowed : 100 |
action* | JSON Object | An object containing the type of action the button should perform. |
The action object attributes:
Attribute | Type | Description |
type* | string | The action type for a button. Allowed values: invoke.function | system.api | open.url |
data* | JSON Object | An object with properties for each action type. |
confirm | JSON Object | Properties of the confirmation dialog box before the action is executed. It can be included based on the requirement. |
The data object properties vary depending on the type of action chosen :
Data object when the button action type is invoke.function
Attribute | Type | Description |
name* | string | Name of the function to be invoked. |
owner* | string | The email address of the function creator |
Data object when the button action type is open.url
Attribute | Type | Description |
web | string (URL) | The URL to be opened on clicking the button. Maximum number of characters allowed : 256 |
windows | string (URL) | The URL to be opened on clicking the button. Exclusive for windows mobile. Maximum number of characters allowed : 256 |
iOS | string (URL) | The URL to be opened on clicking the button. Exclusive for iOS mobile. Maximum number of characters allowed : 256 |
android | string (URL) | The URL to be opened on clicking the button. Exclusive for android mobile. Maximum number of characters allowed : 256 |
Data object when the button action type is system.api
Attribute | Type | Description |
api* | string | Allowed Values: audiocall | videocall | startchat | invite | locationpermission Format : system action/{zuid} |
The confirm object attributes:
Attribute | Type | Description |
title* | string | Confirmation dialog box title before the action is executed. Maximum number of characters allowed : 100 |
description | string | Confirmation message displayed before the action is executed. Maximum number of characters allowed : 100 |
input* | string | The input text prompt present in the confirmation dialog box. Maximum number of characters allowed : 300 |
buttontext* | string | Label of the button present in the confirmation box. Maximum number of characters allowed : 100 |
Instant button syntax:
[button label](action type | function name |button reference key)
Note:
The instant button works only with invoke.function and system.api action types.
Sample message card button object:
"buttons": [
{
"label": "Update Campaigns",
"type": "+",
"key" : "approve",
"action": {
"type": "invoke.function",
"data": {
"name": "update_campaigns",
"owner": "li.jung@zylker.com"
}
}
}
]