Menu Handler

The menu handler is used to display dynamic buttons in the unfurled card. This handler will be triggered when the menu option is clicked. With this handler, you can construct and return dynamic buttons for the unfurl card.

You will get the following attributes when the menu 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 where the link was entered or sent
userDetals of the user who entered or sent the link

Note: You can return a maximum of 5 buttons as an array for the response.

Attributes for each buttons

AttributeTypeDescription
type*StringThe type of action.
Allowed value: button
label*StringButton label. (max length: 100)
hintStringButton hint. (max length: 250)
styleStringTo denote the style(positive/negative) of the button.
Allowed values:  + | - 
confirmJSON ObjectProperties of the confirmation dialog box before the action is executed. It can be included based on the requirement.
paramsJSON ObjectDynamic key value pair for reference. A maximum of 10 keys with 100 character value can be passed.

Sample code


return [
   {
      "type": "button",
      "label": "Share",
      "hint": "Share page to chat participants",
      "params": {
         "page_id": "demopageid123"
      }
   }
];