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 to send a message to your bot and broadcast it to all your bot subscribers through a simple command.
We'll be looking at how to post a message to the bot using cURL, Wget and PowerShell. The steps are pretty straight forward. You'll need the following:
- Create a bot
- Generate a webhook token
- Form your message as a JSON
- Post your message to the bot's messaging endpoint
- And done
Get started by creating a bot
Get started with creating your bot, if you haven't already! You can refer our
help page on bot creation. Once you've created the bot, take note of the bot's endpoint URL in the bot preview page. You can find the bot preview page by following the below steps:
- Click on Settings and choose Integrations.
- Select Bots in the Integrations page.
- Select which ever bot you would like to send a message to and click on the bot's name. The bot's preview page is displayed.
Webhook tokens
Webhook tokens are unique authentication keys specific to a user. These tokens can be used to connect with third party applications through webhooks, in order to post messages to a channel or chat.
To use the Messaging API you'll need Cliq's webhook tokens.These tokens will provide you with authentication to access the message APIs. Follow the given steps to generate your own webhook:
- In Cliq, click on your profile in the top right corner and choose -> Bots & tools
- Now, in the integrations page click on Webhook tokens at the bottom left
- Click on the button Generate new token to generate your webhook token
To know more about webhooks click on the following link:
Structure your message as a JSON
We have an easy way to build cool message card templates. The message structure shown below is built using our
Message Builder. Here, we're trying to notify all the bot's subscribers. This can be done using the
broadcast parameter. When broadcast is true, message is posted to all subscribers of the bot! More details about this parameter and the other parameters are explained in our
How to post message to a bot section.
And finally, posting the message!
We'll be sending the message through a standard POST request.
Take a look at how to make the request via curl :
Similarly, the same request using Wget :
Finally, PowerShell for all you Windows people out there!
How about trying these right away? All you've to do is replace the webhook token with yours and give your bot's unique name in the script. Get started now and tell the world how easy it indeed is! Comments and suggestions are welcome.
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,