Extension Token (ZAPI Key) 

The extension token, also known as ZAPI Key is an unique authentication key generated for each user who interacts with any component in the extension. This token can be used to connect your extension with a third party application through webhooks, to post messages to a channel or chat. 

As an extension developer, you can allow all users of the organization to create a token, through the token generation dialog prompt. 

Token generation button sample syntax


[
  {
    "label": "",
    "type": "", // + or -
    "action": {
      "type": "invoke.function",
      "data": {
        "name": "",
        "owner": "" //Email ID of the extension developer
      },
      "confirm": {
        "title": "",
        "description": "",
        "input": {
          "type": "user_webhook_token" 
        }
      }
    }
  }
]

Token Generation Button Object Attributes

Attribute NameData TypeDescription
labelstringDefine the token generation button's label. 
Maximum number of characters allowed : 20 
hintstringA tool tip indicating the button's function while hovering over. 
Maximum number of characters allowed : 100
typestringUse this key to define the button theme ( + for positive, - for negative or neutral) 
actionJSON ObjectDefine the type of action a button should perform. For the token generation button, value for the type key must be invoke.function

Action object attributes

Attribute NameData TypeDescription
typestringDefine the type of action a button should perform. For the token generation button, value for the type key must be invoke.function
dataJSON ObjectDefine the parameters to be passed by the button of type, invoke.function

Data object attributes

Attribute NameData TypeDescription
namestringName of the function to be invoked.

Confirm object attributes

Attribute NameData TypeDescription
titlestringThe title of the token generation prompt.
descriptionstringThe description of the confirmation prompt
inputJSON ObjectDefine the input type of dialog prompt.

Input object attributes

Attribute NameData TypeDescription
typestringThe type of input dialog prompt. Value should be:user_webhook_token

Sample code snippet of the token generation dialog


response = {"text":"Click on the token generation button below!","buttons":[
  {
    "label": "Create Webhook",
    "type": "+",
    "action": {
      "type": "invoke.function",
      "data": {
        "name": "authentication"
      },
     "confirm":{
     "title":"Generate Webhooks for a GitLab Project",
      "description":"Connect to GitLab Projects from within Cliq",
       "input" : 
         {"type":"user_webhook_token"
		 }
	 }
    }
  }
  ]};
return response;