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 | preview.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. 
Supported Protocols: http | https | tel | sms | sip
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 preview.url

The preview_url response type allows users to view a URL's content directly within the chat interface, such as playing a video or rendering a webpage.This rich response type can be used for the following scenarios:

  • Display a video player for Video link previews.

  • Embed a rich preview with a clickable image and text for web links.

  • Show basic file details and provide an option to download or view the document.

AttributeTypeDescription
url*stringIframe url to play video or render webpage. 
Maximum length : 500

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*string

The input text prompt present in the confirmation dialog box. 
Maximum number of characters allowed : 300

This input field is used to collect user input ( For example : authentication key or feedback ) during confirmation or cancellation action.

emotionstring
(Optional)
To set the visual style of the confirmation dialog box.
Allowed Values : positive | neutral | negative
If key is not provided, the theme of the dialog box will be set as positive by default.
button_label*stringLabel of the button present in the confirmation box.
Maximum number of characters allowed : 100
cancel_button_labelstringLabel of the cancel button present in the confirmation box.
Maximum number of characters allowed : 100
mandatorystring
(Optional )
To specify whether the input field is required or not.
Allowed Values : true | false
When set to true, an error must be thrown if the user does not provide any input.
buttontext*

Deprecated
stringLabel of the button present in the confirmation box.
Maximum number of characters allowed : 100

Confirmation Popup with Zoho Cliq buttons

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"
        }
      }
    }
  ]