Develop a Botpress Bot
    • Dark
      Light
    • PDF

    Develop a Botpress Bot

    • Dark
      Light
    • PDF

    Article summary

    Botpress is an on-prem, open-source chatbot-building platform for businesses.

    Botpress quick start guide

    Integrate Rocket.Chat with Botpress following this sample

    Botpress workflow

    This example workflow shows how Botpress can be integrated with Rocket.Chat Omnichannel Live Chat widget.

    Rocket.Chat Botpress workflow

    Setup

    Let us see how to set up a Botpress server and integrate it with a Rocket.Chat workspace.

    Prerequisites

    You are required to have a registered workspace and Omnichannel activated.

    Install connector app

    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 example code

    • 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

    Edit the docker-compose.yml file to remove the rocketchat and mongo services if you already have a running instance of Rocket.Chat.

    • 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.

      Click on the bot to open up then click Train chatbot at the bottom right

    Create a bot and agent user

    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 and livechat-manager

      • Create an agent user with these roles user and livechat-agent

    • 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.

    Configure Omnichannel

    • Navigate to Avatar Menu > Omnichannel > Departments

      • Create a GENERAL department and enable it to show on the registration form. Set the bot 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

    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 Two Factor Authentication and copy it. See this guide.

    Configure Botpress settings

    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

    Test the integration

    To test the integration,

    • Visit http://<your Rocket.Chat server>/livechat and start a new Live Chat conversation.

    • Optionally you can integrate the Livechat widget while taking into consideration the X-Frame-Options.

    When successful, you should see something like below

    Live Chat widget new conversation


    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.
    ESC

    Eddy AI, facilitating knowledge discovery through conversational intelligence