Webhooks can be used to get notified about events happening in other applications inside Cliq. All bots in Cliq have their own incoming webhook endpoint. This makes it simple to post messages to the bot from external applications. Unlike the
send message (/message) REST API, here any data can be posted to the endpoint which is further processed in the incoming handler before notifying in Cliq.
The incoming webhook allows third-party applications to send notifications/alerts using the incoming webhook URL. These responses mostly received as a JSON can be then customized using Cliq's message card templates. The incoming webhook URL of the bot should be configured with the application's outgoing webhook.
Incoming webhook handler workflow
The bot's incoming webhook URL will receive the request response from the third party application's URL. The response of the request will be obtained in the body attribute. Take a look at all the attributes passed when a bot's incoming webhook handler is executed in our
help page .
A pictorial comparison between how Rest APIs and incoming webhooks work is shown below!
Now that we've got the concept of webhooks cleared, let's start off by creating a simple bot's webhook handler. Take a look at the sample scenario given below.
Sample Scenario
Your support team uses Zendesk to take care of customer queries and keep track of tickets. The team also uses Cliq for internal team communication. So how can you make sure all support reps are notified in Cliq when a new ticket with a high priority has been created? Here's what you can do - create a Support Bot!
Before we start, this is an integration by parts. Which means that you have to configure the webhook in Zendesk and format your response in Cliq.
Cliq's part in the integration:
Creating a bot in Cliq is just a three-step process. All you've to do is,
- Click ' Settings ' in Cliq's top nav bar.
- Select ' Integrations '.
- Once you're on the Integrations page, click ' Create Bot ' and give your bot a name, description, status, access level and image!
Now, to set up the incoming webhook handler of your bot :
- Saving the bot will take you to the ' Edit Handlers ' page. Or you can navigate to the edit handlers page from the bot's preview.
- Click ' Edit Code ' under the bot incoming webhook handler.
- Write your code in the deluge editor (once you set up the JSON body in Zendesk), click save and done! Take a look at the sample code snippet given below:
- // Incoming Webhook Handler Code Snippet
- response = Map();
- title = body.get("title");
- priority = body.get("priority");
- description = body.get("description");
- url = body.get("url");
- id = body.get("id");
- status = body.get("status");
- assignee = body.get("assigned_to");
- response = {"text": "A new ticket has been created. The ticket details are given below: \n Ticket Name: " + title + " \n Description:" +description+ "\n Priority: `" + priority+ "` \n Ticket ID:" +id+ "\n [Ticket URL](https://" +url+ ") \n Status: " +status+ " \n Assigned To: " +assignee };
- return response;
To be done in Zendesk
Create a Target:
- Create an extension. To do so, click 'Extensions' under 'Settings'
- Click 'Add Target' under the targets tab.
- Click 'HTTP target' and give a name, URL, method.
- Give your bot's incoming webhook URL along with the zapikey parameter. Take a look at how to create a zapikey here .
-
Set your HTTP method as POST.
-
Select 'Create Target' and click Submit.
Sample Bot Incoming Webhook URL:
That's it! Your extension has been created.
Create a Trigger:
The next action is to create a trigger. Triggers are automated rules that work based on predefined conditions.
- Navigate to the Triggers tab and click ' Add Trigger '
- Give the trigger a name, description and set a condition. Take a look at the sample condition used for the example shown below.
- Under Actions, select ' Notify Target ' and select your target name.
- The JSON body will contain the ticket details. Modify this to suit your team's requirements. Here's a sample code snippet for the JSON body.
- Click Save!
Sample Trigger Code Snippet:
- {"title":"{{ticket.title}}",
- "description" : "{{ticket.description}}",
- "priority":"{{ticket.priority}}",
- "url": "{{ticket.url}}",
- "id":"{{ticket.id}}",
- "status":"{{ticket.status}}",
- "assigned_to":"{{ticket.assignee.name}}"
- }
Now creating a ticket with a priority set as
Urgent will notify all the support reps in Cliq via the Support Bot!
Take a look at how the Zendesk Ticket will be notified in Cliq via the Support Bot :
Ticket in Zendesk
Support Bot notifying in Cliq
And that's how easy it is to configure a bot's incoming webhook handler. Comments and suggestions are welcome.
Few useful links:
Best,
Manasa
Cliq
Sticky Posts
Convert a message on Cliq into a task on Zoho Connect
Message actions in Cliq are a great way to transform messages in a conversation into actionable work items. In this post, we'll see how to build a custom message action that'll let you add a message as a task to board on Zoho Connect. If you haven't created
Cliq Bots - Post message to a bot using the command line!
If you had read our post on how to post a message to a channel in a simple one-line command, then this sure is a piece of cake for you guys! For those of you, who are reading this for the first time, don't worry! Just read on. This post is all about how
Cliq Bots - How to make a bot respond to your messages?
Bots are just like your buddies with whom you can interact. They carry out your tasks, keep you notified about your to-dos and come in handy when you need constant updates from a third party application. So, how can you make your bot respond to a message? The bot message handler is a piece of code triggered when a message is sent to the bot. Message handlers help you customise your bot responses to make it look conversational. The message input from the user can be either a string or an option selected
Cliq Bots - Get notifications about any action on an application with the incoming webhook handler!
Webhooks can be used to get notified about events happening in other applications inside Cliq. All bots in Cliq have their own incoming webhook endpoint. This makes it simple to post messages to the bot from external applications. Unlike the send message
The Slash Command Series - Types of Command Suggestions
Hi Everybody! I hope you guys tried the /zdocs command and now have an idea of how command suggestions with click to execute work. If you have no clue of what command suggestion is, I recommend you to take a look at all the Slash Command Series posts, especially the one on Command Suggestions ! This post is all about the different types of command suggestions. Customise your command suggestions Did you know you could customise your command suggestion list with a title, description, image? Well,