A Chat Bot is a type of Custom Integration that Workplace users in your company can interact with via Workchat. It allows to automate certain actions and speed up some processes. The possibilities are infinite but the most popular use cases are covered in this document.
Here we will learn how to create your own bot in two steps: Configuring a bot on Workplace and Deploying it in your server(s).
To have more details about integrations and configurations in general, you can refer to this documentation.Configuring a bot
Configuring a chat bot on Workplace
The first step to create a chat bot is configuring it on Workplace. To do so, you need to log in on Workplace as an Administrator who has the permission to change company settings and configure integrations. Once you're logged in you can complete the following steps:
Once you have created the bot, you can proceed to configure the rest of it.
In the Integrations section of the Admin Panel, click the name of the bot to be configured. The basic details you need to pay attention to are these:
This token will be sent in the API requests that your bot will generate so Workplace can verify that they come from your bot.
If the bot is not discoverable, users won't be able to interact with it. You may want to enable it later in the process once the rest is configured, but don't forget to do it before launching it.
In the configuration screen of the integration, there is a section called Pemissions where you can choose the permissions that your bot will need access to.
Additionally, you may want to tick other permissions you may need for your bot to work, i.e. if your bot needs to retrieve the profile of users from Workplace, you will need to tick the "Read work profile" permission.
Another section you will need to configure for a chat bot is Webhooks. Webhooks allow you to subscribe to specific events and receive updates in real time. When a change/event occurs in Workplace (i.e. a user messages your bot), an HTTPS POST request is sent to a callback URL for each custom integration app that's subscribed to the relevant webhook topic.
Before continuing with this configuration, make sure that you deploy the code of the bot in your web server. More info here.
These events will allow us to know when a user sends a message to our bot and when the user interacts with one of the buttons that our bot may have.
The last section of the configuration of the bot is Security. Although this configuration is not strictly necessary for your bot to work, we highly recommend that you configure it before launching the bot to production.
This will require the app secret proof and the app secret time when your server sends the API requests to Workplace.
Deploying a chat bot in your server
The second step to create a chat bot is deploying the code of the bot in your server. To do so, you need to deploy some code in a web server of your own.
We have created some bot samples that can be copied as they are, just replacing your tokens in the code. You can find them in the following links:
- Helpdesk Bot: Bot to automate Helpdesk requests for IT from users.
- Recognition Bot: Bot to automate recognition among users.
- HR FAQ Bot: Bot to provide easy access to HR FAQs to your users.