diff --git a/_data/projects.yml b/_data/projects.yml index 1b144c76f5..578322f590 100644 --- a/_data/projects.yml +++ b/_data/projects.yml @@ -59,7 +59,7 @@ Bots FAQ: bots-faq/ Configuring Bots: configure-bot-environment/ Creating Bots Users: creating-bot-users/ - + Using Bots for Livechat: using-bots-for-livechat/ - name: Contributing icon: github diff --git a/_data/toc.yml b/_data/toc.yml index 3182daf289..0f724b92a5 100644 --- a/_data/toc.yml +++ b/_data/toc.yml @@ -407,6 +407,7 @@ - Bots Architecture - Creating Bot Users - Configure Bot Environment + - Using Bots for Livechat - Running a Hubot Bot - Running a Botkit Bot - Running a Rasa Bot diff --git a/bots/README.md b/bots/README.md index 55d8e5d660..f63b2e345a 100644 --- a/bots/README.md +++ b/bots/README.md @@ -37,6 +37,7 @@ These are the basic steps for using bots with Rocket.Chat. - [Bots Architecture](bots-architecture/) - [Creating Bot Users](creating-bot-users/) - [Configuring the Bot Environment](configure-bot-environment/) +- [Using Bots for Livechat](using-bots-for-livechat/) - [Running a Hubot Bot](running-a-hubot-bot/) - [Running a Botkit Bot](running-a-botkit-bot/) - [Running a Rasa Bot](running-a-rasa-bot/) diff --git a/bots/running-a-botpress-bot/README.md b/bots/running-a-botpress-bot/README.md index e6ef4cb262..77823242c8 100644 --- a/bots/running-a-botpress-bot/README.md +++ b/bots/running-a-botpress-bot/README.md @@ -2,4 +2,128 @@ Our work on supporting Botpress is in active development. +## How to setup Rocket.Chat livechat + botpress + +The following instructions are to have rocket.chat livechat work with 2 botpress bots in a live-agent role. There is some good work done on [botpress-channel-rocketchat](https://github.com/RocketChat/botpress-channel-rocketchat). This setup includes setting up Rocket.Chat livechat and botpress with botpress-channel-rocketchat. + +*Required components - rocket.chat 0.69, botpress 10.35, botpress-channel-rocketchat 0.11 + +---- +## Setup Rocket.Chat + +### Add Bot users +On the rocket.chat server, add a bot user +Administration-> Users -> + +``` + name: bot one + username: bot1 <> + password: bot1 <> + +``` +Turn on *Verified* +Turn off *Require password change* +Add roles: *live-agent, bot* +*Save* + +Repeat above for bot2 with username: bot2, password: bot2 + +### Enable livechat +#### Administration->Livechat-> Livechat enabled = True; Save changes +#### Livechat->User Management + +add livechat agents by "search by username" and add bot1 and bot2 +#### Livechat->Departments +Add New Department +``` + Name: support, Enabled: Yes, Available agents:bot1, bot2 and save +```` + +On the rocket.chat home page, enable **livechat** + +---- +## Install Botpress + +Install botpress +`npm install -g botpress` +`botpress --version` +10.35.0 + +---- + +## Setup Bots + +Setup a directory for bot + +``` + mkdir bot1 + cd bot1 +``` + +Generate a new bot + +`botpress init` + + +Install botpress-channel-rocketchat + +`npm install botpress-channel-rocketchat --save` + +Install bot dependencies by running npm install ... + +`npm install` + +Update botfile port to 3001 ( or a port that is available) +edit botfile.js and change port from 3000 to 3001 ++const port = process.env.BOTPRESS_PORT || process.env.PORT || **3001** + +`botpress start` + +(bot may start with errors. Kill the bot and follow the below instructions) + +`cd config` + check if `channel-rocketchat.json` exists. If not make a file or update the file with below entries +``` +{ + "ROCKETCHAT_USER": "bot1" //"<>", + "ROCKETCHAT_PASSWORD":"bot2" // "<>", + "ROCKETCHAT_URL": "<>", + "ROCKETCHAT_USE_SSL": "false", + "ROCKETCHAT_ROOM": "GENERAL", + "scope": "" +} +``` + +Start the bot again + +`botpress start` + +### Setting up bot2 +``` + e.g + /bot1 + /bot2 + +mkdir bot2 +cd bot2 +``` +Repeat the bot setup steps for bot2, with the below changes + +change botfile.js port to **3002** +change `config/channel-rocketchat.json` +``` + ROCKETCHAT_USER = "bot2" + ROCKETCHAT_PASSWORD = "bot2" + +``` +## Test livechat +yourserver:port/livechat + +---- +## Troubleshooting + +If there is an error in starting the bot, such as port address in use, remove the `.data` folder in the bot directory + `rm -rf .data` (from the bot folder) + + For updates on progress or to make a contribution, please see [issue #5772](https://github.com/RocketChat/Rocket.Chat/issues/5772) + diff --git a/bots/using-bots-for-livechat/README.md b/bots/using-bots-for-livechat/README.md new file mode 100644 index 0000000000..965f0fa458 --- /dev/null +++ b/bots/using-bots-for-livechat/README.md @@ -0,0 +1,22 @@ +# Using Bots for Livechat + +Bot users can serve as livechat agents in a Rocket.Chat instance, allowing you +to respond quickly to basic enquiries and perform handover to a human agent +when they're required and available. + +Before continuing, you should read [Creating Bot Users](../creating-bot-users) +and [Configure Bot Environment](../configure-bot-environment), because you'll +need to do both to prepare the account and bot configuration to be used for +livechat. + +Also ensure livechat is enabled, following the instructions in the +[Administrator guide to Livechat](../../administrator-guides/livechat/) to +enable Livechat, create a department and assign your bot account/s as agents. + +The only additional setup required is that the bot is given the additional role +of `livechat-agent` and the environment variable `RESPOND_TO_LIVECHAT=true`. + +## Contribute to the Docs + +If you've developed bot solutions for livechat support and have more details to +add, please submit a PR with the instructions using the link below.