Widget Section Element: Buttons

You can use the button element to add up to 5 buttons in the section. 

Syntax: 


{
type : "buttons",
buttons : {} 
}

 

Attributes: 

 

Attribute NameValueDescription
typebuttonsSpecifies the type of widget element. The value for the type key is 'buttons'. 
buttons

Array list

The maximum number of buttons supported: 5

The array list of buttons to be added to the widget section. To know more about the button element attributes, refer below

Button attributes: 

The button object can have the following attributes. The mandatory fields are indicated by a *

Attribute NameValueDescription
label*stringThe display name of the button. Maximum number of characters allowed: 30
type*stringinvoke.url | preview.url | invoke.function | system.api
(refer button object to know more about type structure)
id*ValueUnique 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 : 500
disabledBooleanUsed to disable the button
emotionstringpositive - outlines the button in green
negative - outlines the button in red
neutral - makes the button outline normal

 

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.
ownerstringThe email address of the function creator

Data object when the button action type is open.url/preview.url

(open.url opens the webpage in a new tab, preview.url while loads the webpage in an iframe)

AttributeTypeDescription
web*string (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}


Example:


elements = list();
elements.add(
    {
        "type":"title",
        "text":"Widget Title"
    }
);
elements.add(
    {
        "type":"text",
        "text":"Here goes the text! Widgets are built as an internal tool similar to commands, bots and message actions. They are listed in the left side bar of Cliq and will be displayed as a full view in Cliq's home screen. Consider widgets as a mini version of any third party integration or a standalone app that works for you, for your team or for the entire organization."
    }
);
elements.add(
    {
        "type":"buttons",
	    "buttons":[
            {
                "label":"Button 1",
                "type":"invoke.function",
                "name":"buttonone",
                "id":"button1"
            },
            {
                "label":"Button 2",
                "type":"open.url",
                "url":"https://www.zoho.com/cliq/"
            },
            {
                "label":"Button 3",
                "type":"system.api",
                "api":"audiocall/1234"
            }
        ]
    }
);
sections = list();
sections.add(
    {
    "id":1,
    "elements":elements
    }
);
return {
    "type":"applet",
    "tabs":[
        {
            "label":"Home",
            "id":"homeTab"
        }
    ],
    "active_tab":"homeTab",
    "sections": sections
};