Botpress is an on-prem, open-source chatbot-building platform for businesses.
Integrate Rocket.Chat with Botpress following this sample
{% embed url="https://github.com/RocketChat/rocketchat-botpress-lab-bot/" %}
This example workflow shows how Botpress can be integrated with Rocket.Chat Omnichannel Live Chat widget.
Rocket.Chat Botpress workflow
Let us see how to set up a Botpress server and integrate it with a Rocket.Chat workspace.
{% hint style="info" %} You are required to have a registered workspace and Omnichannel activated. {% endhint %}
To be able to interact with the bot, you need a connector. Follow these steps to get it installed on your Rocket.Chat workspace.
- Navigate to Administration > Workspace > Apps
- Search and install the Botpress Connector app by Luis Hlatki
- Clone the starter code and enter the directory by running
git clone https://github.com/RocketChat/rocketchat-botpress-lab-bot.git botpress-lab-bot
cd botpress-lab-bot
{% hint style="info" %}
Edit the docker-compose.yml
file to remove the rocketchat
and mongo
services if you already have a running instance of Rocket.Chat.
{% endhint %}
- Spin up the container with
docker compose up -d
- The botpress dashboard is made available at on port
3001
visit it and configure the admin user - Import the bot_lab.tgz found in the directory cloned above
- Set the bot id as lab and Import bot
import botpress bot
- Click on the bot to open up then click Train chatbot at the bottom right
Create the following Rocket.Chat users to be used for the integration
- Navigate to Administration > Workspace > Users
- Create a bot user for the bot with these roles:
bot
,user
,livechat-agent
andlivechat-manager
- Create an agent user with these roles
user
andlivechat-agent
- Create a bot user for the bot with these roles:
- Configure the Botpress Connector installed earlier in Administration > Apps > Installed > Botpress Connector > Settings with the following details:
- Rocket.Chat bot username:
bot
- Botpress bot id:
lab
- Botpress server URL:
<http://your-botpress-server-url>
- Default handover department:
GENERAL
- Then Save changes
- Rocket.Chat bot username:
- Navigate to Avatar Menu > Omnichannel > Departments
- Create a
GENERAL
department and enable it to show on the registration form. Set thebot
user as an agent - Create an
OTHER
omnichannel department, don't enable show on the registration form and set the user agent as an agent
- Create a
You should have something like below
Omnichannel channel created
- Edit the user agent user status to available
- Log in as the bot user and create a PAT (Personal Access Token) without 2 Factor Authentication and copy it. see this guide
Back on your botpress server dashboard, do these settings to complete. This involves setting up details about your Rocket.Chat server.
- Fill in the Rocket.Chat server URL and PATH gotten from above in the
bot.config.json
file at Dashboard > Code Editor > Configurations > Current Bot > bot.config.json then Save
Botpress config file edit
- Update the transfer room ID with that of the desired department ID in Dashboard > Flows > Main Flow > transfer-room node
Edit botpress transfer room
To test the integration,
- Visit
http://<your Rocket.Chat server>/livechat
and start a new Live Chat conversation. - Optionally you can integrate the Live Chat widget while taking into consideration the X-Frame-Options
When successful, you should see something like below
Live Chat widget new conversation
Botpress and Rocket.Chat Live Chat