[Webinar] Build, Automate & Level-up with Zoho Cliq Developer Platform - Register now

Skip to main content

Preview handler

The preview handler is used to expand the link to display a richer data format. The preview handler will be triggered either when a user enters the link in the composer or after they send it in the chat. A map with unfurl card details will be returned in the 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

The unfurled card response can have the following attributes

AttributeTypeDescription
title*StringTitle for the unfurled card (max length : 500)
type*StringThe type of unfurl.
Allowed Values: link | photo | video | rich
provider_url*StringResource provider url. (max length: 1000)
descriptionStringDescription for the unfurl card, maximum length 3000
provider_nameStringResource provider name. (max length: 100)
favicon_urlStringResource provider fav icon. (max length: 1000)
thumbnail_urlStringThumbnail url. (max length: 1000). 
Supported for link, richand video type
actionsArrayButons actions in unfurl card. Supported for link and rich type
dynamic_actionsBooleanUsed to add menu icon to the unfurl card.
Allowed values: True | False.
Supported for link and rich type
fieldsJSON ObjectOption to render fields in unfurl card. 

Attributes for actions:

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.

Attributes for fields:

AttributeTypeDescription
data*ArrayFields data. (max 10 fields)
stylesJSON ObjectStyles for fields

Atributes for fields data

AttributeTypeDescription
label*StringField label. (max length : 100)
value*StringField value. (max length: 500)

Attributes for fields styles

AttributeTypeDescription
short*BooleanOption to short the given fields based on key

Types specific additional mandatory keys:

Rich, Video:

AttributeTypeDescription
iframe_url*StringIframe url to play video or render webpage. (max length: 1000)

Photo:

AttributeTypeDescription
url*StringImage url.  (max length: 1000)

Sample code:


return {
   "title": "Graphics Artist | Notion",
   "type": "link",
   "provider_url": "https://www.notion.so/",
   "faviconlink": "https://www.notion.so/front-static/favicon.ico",
   "thumbnail_url": "https://images.unsplash.com/photo-1613909207039-6b173b755cc1?ixlib=rb-4.0.3&q=85&fm=jpg&crop=entropy&cs=srgb",
   "description": "Notion - A new tool that blends your everyday work apps into one. It's the all-in-one workspace for you and your team",
   "fields": {
      "data": [
         {
            "label": "Parent Database",
            "value": "[Vendor Management](https://www.notion.so/demoid1234)"
         },
         {
            "label": "Type",
            "value": "Page"
         },
         {
            "label": "Created By",
            "value": "John Doe (john.doe@zoho.com)"
         }
      ]
   },
   "actions": [
      {
         "hint": "Add a Block of information to the Page.",
         "style": "+",
         "label": "Add Block",
         "type": "button",
         "params": {
            "page_id": "demopageid123"
         }
      },
      {
         "hint": "Add a subpage to the page",
         "label": "Add Subpage",
         "type": "button",
         "params": {
            "page_id": "demopageid124"
         }
      }
   ],
   "dynamic_actions": true
};