The bot in Channelize.io is a type of user that will be able to send and receive all the messages in the conversation in which bot exists. The Channelize.io has provided a dashboard interface as well as REST API to integrate bot.
You can achieve multiple use-cases using bots. Here are a few examples:
- Human-like highly intelligent helper bots that interact with end-users, ask questions & revert back to their queries.
- User onboarding bots that help onboard new customers with helpful guides and links.
- Assistant bots that will suggest users with the best products, discounted deals and exciting offers for e-commerce businesses.
NOTE: Currently Channelize.io is not providing any AI(artificially intelligent) based bot. You can run your own AI for AI-based bot or write a rule-based function for the rule-based bot. The AI-based bot is much smarter than rule-based bot as AI-based bot can understand the intent and context of the user.
There are below ways to integrate bot in Channelize.io:
- Build a bot using Webhooks
- Build a bot using External bot
Build a bot using Webhooks
You can perform many bot tasks using webhooks feature (webhooks doc). Upon configuring webhooks from dashboard, your webhook endpoint starts receiving every message from Channelize.io server. You can respond to every message from the webhook endpoint by using the send message API call. You have to run AI at the webhook point which will process user’s questions and send responses accordingly.
For example, an AI configured at the webhook endpoint of a Bank website will revert with account balance upon asking a question “What is my account balance?”.
Build a bot using External bot
The external bot is another and suggested way to integrate bot in Channelize.io. The external bot is a kind of user that will be able to send and receive all the messages from bot callback URL in the conversation.
The bot can monitor all the events from users by joining the conversation, send message and leave the conversation anytime. The group admin will not be able to remove bot from conversation, the bot will leave the conversation when it want.
There are below steps to integrate the external bot in Channelize.io:
- Create the bot from Channelize.io dashboard interface from Bot Integration. Example: You can create the “Channelize Dummy Bot” with callback URL https://dummybot.com
- Add the bot in an existing conversation or create a new conversation with the bot by passing BOT ID as a member in the Create Conversation API call. You will find BOT ID in Bot Integration once you create the bot.
- Once you add a bot in any conversation, the callback URL will start receiving all messages occurring inside the conversation.
- You can run AI at callback URL to process the received messages and send a response message via Send Messages API call.
Bot security is much similar to webhook security. Channelize.io provides you an option to validate the bot requests if the requests are originated from Channelize.io server or some other source. For this, Channelize.io sends a hash signature in request header X-Channelize-Signature. Channelize.io uses your private key and bot payload to create this signature.
X-Channelize-Signature is calculated using HMAC with SHA256 algorithm with your private key as the key, and the bot request payload as the message.
To validate the bot request at your end, you need to convert the entire request body in JSON encoded string and create an HMAC SHA256 Signature using the private key. The signature should be compared with request header X-Channelize-Signature value. If these are equal, then the request is a valid request from Channelize.io.
A few code snippets to create signatures in PHP language is mentioned below.
$body = json_encode($_POST); $privateKey = 'YOUR_PRIVATE_KEY' $signature = hash_hmac('sha256', $body, PRIVATE_KEY);