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 Name | Data Type | Description |
label | string | Define the token generation button's label. Maximum number of characters allowed : 20 |
hint | string | A tool tip indicating the button's function while hovering over. Maximum number of characters allowed : 100 |
type | string | Use this key to define the button theme ( + for positive, - for negative or neutral) |
action | JSON Object | Define 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 Name | Data Type | Description |
type | string | Define the type of action a button should perform. For the token generation button, value for the type key must be invoke.function |
data | JSON Object | Define the parameters to be passed by the button of type, invoke.function |
Data object attributes
Attribute Name | Data Type | Description |
name | string | Name of the function to be invoked. |
Confirm object attributes
Attribute Name | Data Type | Description |
title | string | The title of the token generation prompt. |
description | string | The description of the confirmation prompt |
input | JSON Object | Define the input type of dialog prompt. |
Input object attributes
Attribute Name | Data Type | Description |
type | string | The 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;