Other Channels
Last updated
Last updated
You may deploy your bot to other custom channels like
Mobile App
Raspberry Pi / Arduino
Smart Speaker
In order to connect to them, you will need to set up
The Website Chat Integration
After you have created a Website Chat Integration, you must add a unique custom domain for each channel. Unlike domains you would use for the website chat widget, a custom domain
Does not need to be a working URL
Is like a password
Must not be easily guessable
Examples of good custom domains are
https://a9sn38h.app.link ✅
https://03jd874he983h.mywebsite.com ✅
Examples of bad custom domains are
https://app.mywebsite.com ❌
https://www.google.com ❌
After setting up your Website Chat Integration with custom domains, you must
Register your Users
Use the Send Message API to send messages as a user
You must register a new user for every person who can message your bot. You will then use the user's webchat_id
to send messages as the user.
You will be using 2 models of the BotDistrikt API:
POST
https://flow.botdistrikt.com/api/webchat_apps/:webchat_app_id/user
Registers a new user from your other channel. Returns the bot_user object to be used for sending messages as this user. You
webchat_app_id
number
Webchat App ID from the Website Integration page
domain
string
The external domain for this External Frontend
webchat_id
string
If you have your own user IDs, you can populate them here for each user. If left blank, the platform will generate one for you. For stronger security, make your user ID unguessable.
user
object
A bot_user object. You may use this to pre-populate some fields for each user.
POST
https://flow.botdistrikt.com/api/webchat_apps/:webchat_app_id/message
Sends a message as a user with a valid webchat_id
generated for a bot_user object. On success, the bot's responses are returned, which you can use to display in your other channel
webchat_app_id
number
Webchat App ID from the Website Integration page
Authorization
string
The webchat_id of the bot_user sending the message
domain
string
The external domain for this External Frontend
user
object
The bot_user object
message
object
The bot_user_message object
The Event Webhook is a webhook URL that can be configured on the Website Chat integration page. This event webhook allows you to add your own custom webhook to receives events of messages that were sent from the bot to the user.
This is particularly useful if you would like to publish one-way bot-to-user messaging, as opposed to two-way interactions. Some examples of where this can be used
Live Chat Messaging
Broadcasts
Replying with Stories
The headers of the request from an event webhook are as follows:
If X-BotDistrikt-Source is human
, this means a team member (live agent) sent a reply in place of the bot, and the ID of the team member (live agent) is denoted in the value of X-BotDistrikt-Source-Id
If X-BotDistrikt-Source is broadcast
, this means a broadcast was published to this user from the bot, and the ID of the broadcast is denoted in the value of X-BotDistrikt-Source-Id
If X-BotDistrikt-Source is bot
, this means this was just a normal synchronous bot message. This can be ignored if the Send Message response output will be used in the custom channel.