Action handler

The action handler is used to execute actions on the buttons in the unfurled card. It will be triggered when the button is clicked. Cliq response such as message, form, banner can be returned as a response. You will get the following attributes when the preview handler is executed.

AttributeDescription
domainDomain which matches the one handled by the extension
urlLink sent by the user
chatDetails of the chat where the link was entered or sent
userDetails of the user who entered or sent the link
targetButton object details such as button name, hint and key

Sample object for target key


{
   "input": "Confirmation dialog response",
   "hint": "Share this document to the members of this Chat",
   "label": "Share",
   "params": {
      "key": "value"
   }
}

Sample code


return {
   "type": "form",
   "title": "Add Block",
   "name": "addblock",
   "hint": "Add a new block to the page",
   "button_label": "Add",
   "inputs": [
      {
         "name": "title",
         "label": "Block title",
         "placeholder": "Sample block",
         "min_length": "0",
         "max_length": "100",
         "mandatory": true,
         "type": "text"
      },
      {
         "name": "type",
         "label": "Block type",
         "placeholder": "Choose from the list of block types",
         "multiple": false,
         "mandatory": true,
         "type": "select",
         "options": [
            {
               "value": "title",
               "label": "Title"
            },
            {
               "value": "page",
               "label": "Page"
            },
            {
               "value": "todolist",
               "label": "To-do List"
            }
         ]
      }
   ],
   "action": {
      "type": "invoke.function",
      "name": "addblock"
   }
};