Integrate a chatbot in Hubot with a RocketChat to answer clients in livechat/omnichannel. This chatbot will serve to answer customers in omnichannel and transfer them to other departments to be answered by a human
1. Rocketchat Prerequisites
2. Hubot-Rocketchat installation
3. Chatbot creation
- First we must have at least the STARTER version of Rocket.Chat.
- Omnichannel must be enabled \
- Create a User (call it bot or chatbot) without verified, with roles "bot, LiveChat Agent, LiveChat Manager"
- Now you need create a Department (Administration --> Omnichannel --> Department) for entry.
- Now you have to enable the user as an agent, to do this in Administration --> Omnichannel --> Agents --> 'mybot' --> Available
- Add mybot to the Entry Department (The bot only has to be in that department)
I follow this guide
https://github.com/RocketChat/hubot-rocketchat
But here are my steps in case you want to use them.
- Install 'Hubot' on the same machine as RocketChat
git clone https://github.com/RocketChat/hubot-rocketchat.git
cd hubot-rocketchat
docker run -d -e ROCKETCHAT_URL=ipmachine:3000 -e ROCKETCHAT_ROOM='' -e RESPOND_TO_DM=true -e ROCKETCHAT_USER=username_bot -e ROCKETCHAT_PASSWORD=password_bot -e ROCKETCHAT_AUTH=password -e BOT_NAME=name(any) -e LISTEN_ON_ALL_PUBLIC=true -e RESPOND_TO_LIVECHAT=true -e EXTERNAL_SCRIPTS=hubot-pugme,hubot-help -v $PWD/scripts:/home/hubot/scripts rocketchat/hubot-rocketchat
the '-d' is for no debugging and start docker without stopdocker exec -it name_container /bin/bash
In my case I have used a default bot that is installed in 'Hubot' called 'hubot-pugme' and in that I have modified its coffee file with a single script through which the bot works. Also you can create a new chatbot (see official documentation Hubot) this guide is modding Hubot-pugme
nano node_modules/hubot-pugme/src/pugme.coffee
- Follow the file example for the bot (example_chatbot.coffee)
bin/hubot -a rocketchat --name bob > /dev/null 2>&1 &
| This is for exec the bot without debugging and run it on background- Now you can write in LiveChat Widget (in the Entry department) and and the bot will answer