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 *

AttributeTypeDescription
label*stringThe display name of the button. Maximum number of characters allowed: 20 
hintstringA tool tip indicating the button's function while hovering over. Maximum number of characters allowed : 100
type*stringThe type + denotes a button with green outline , type - denotes button with red outline.
keystringUnique 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 ObjectAn object containing the type of action the button should perform.

The action object attributes: 

AttributeTypeDescription
type*stringThe action type for a button. 
Allowed values: invoke.function | system.api | open.url
data*JSON ObjectAn object with properties for each action type. 
confirmJSON ObjectProperties 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

AttributeTypeDescription
name*stringName of the function to be invoked.
owner*stringThe email address of the function creator

Data object when the button action type is open.url

AttributeTypeDescription
webstring (URL)The URL to be opened on clicking the button. 
Maximum number of characters allowed : 256
windowsstring (URL)The URL to be opened on clicking the button. Exclusive for windows mobile. 
Maximum number of characters allowed : 256
iOSstring (URL)The URL to be opened on clicking the button. Exclusive for iOS mobile. 
Maximum number of characters allowed : 256
androidstring (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

AttributeTypeDescription
api*stringAllowed Values: audiocall | videocall | startchat | invite | locationpermission
Format : system action/{zuid}

The confirm object attributes: 

AttributeTypeDescription
title*stringConfirmation dialog box title before the action is executed. 
Maximum number of characters allowed : 100
descriptionstringConfirmation message displayed before the action is executed. 
Maximum number of characters allowed : 100
input*stringThe input text prompt present in the confirmation dialog box. 
Maximum number of characters allowed : 300
button_text*stringLabel 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"
        }
      }
    }
  ]