Code Monkey home page Code Monkey logo

rasa-agent-bot-demo's Introduction

Archiving the Repo

Moving this to Chatwoot Implementation Samples.


Chatwoot Agent Bot Demo using Rasa

You should be running this demo on a local installation of Chatwoot and a non dockerised setup for the localhost and ports to be accessible for all the services involved. If you are intending to run in a remote server, ensure you change the localhost urls with appropriate IP addresses and make sure the ports should be accessible for all the services involded.

This is a sample implementation of agent bot capabilities in chatwoot using rasa . Rasa Open Source is a machine learning framework to automate text- and voice-based assistants.

You can refer the rasa documentation to get it up and running in your machine.

This implementation isn't a recommended set up for production, but just to illustrate the capabilities of the platform. Please build on top of this ideas discussed to have in running in production.

Follow the given steps to get your agent bot integration up and running.

Refer the Video Walkthrough and blog post

Get a rasa project up and running.

Go to a new directory and create a rasa project. If you have rasa installed in your machine you can get it up and running by follow in commands. Refer docs to get the installation up and running.

mkdir rasa
cd rasa
rasa init --no-prompt

go to credentials.yml file in the directory and ensure the following value is set. This is to ensure we can communicate with rasa through rest api

rest:
  # you don't need to provide anything here - this channel doesn't
  # require any credentials

start the rasa server with following command

 rasa run -m models --enable-api --log-file out.log

Get your chatwoot up and create an agent bot

go to your chatwoot directory and ensure your local server is running. Start a rails console in your directory.

bundle exec rails c

Inside the rails console, type the following commands to create an agent bot and get its access token. Save the retrieved token as you would need it in further step.

bot = AgentBot.create!(name: "Rasa Bot", outgoing_url: "http://localhost:8000")
bot.access_token.token

Connect Agent Bot to your inbox by running the following command

AgentBotInbox.create!(inbox: Inbox.first, agent_bot: bot)

Clone this repo into your machine and run the rasa router script.

clone repo using the following command.

git clone [email protected]:chatwoot/rasa-agent-bot-demo.git

Using Python

open up the python file in your editor and change the follow values with appropriate ones.

rasa_url, chatwoot_url and chatwoot_bot_token.

Then run pip install -r requirements.txt and python3 -m gunicorn --workers=1 test:app -b 0.0.0.0

Using PHP:

open up the rasa-router/index.php file in your editor and change the follow values with appropriate ones.

$rasa_url = 'http://localhost:5005';
$chatwoot_url = 'http://localhost:3000';
$chatwoot_bot_token = '<your agent bot token>';

run the php server in the rasa-router directory

cd rasa-router
php -S localhost:8000

Connect to your chatwoot webwidget and start a conversation.

if you are on your local machine, you can access the widget through the test page

http://localhost:3000/widget_tests

Notes

You can also refer to the RasaHQ / rasa-demo for adding additional capabilities to your bot. If training rasa through scripts isn’t your thing, check the exciting rasa projects which gives a UI to create your rasa stories.

You can build on top of the ideas discussed here to implement your solutions. Refer to the chatwoot api to see the available options in chatwoot for your bots.Pretty excited to see what you guys come up with.

rasa-agent-bot-demo's People

Contributors

smartmanoj avatar sojan-official avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rasa-agent-bot-demo's Issues

SELF-HOSTED service with Facebook messenger

Hello
I'm from Mongolia.
Because of my location its hard to use Cloud services. So i need to create server on my infrastructure.
So your SELF-HOSTED 19USD service can manage my rasa and facebook messenger requests.
I mean for beginning of the conversation rasa will answer Greeting or something then it will automatically send to Chatwoof.
It means my operators (human) can continue handle conversation. So its possible?

if its possible please give me example ?
Please help me i really wanna use rasa, chatwoof and facebook messenger together.

Bot Doesn't respond

Hi guys,

is there any chance you could update your documentation to make the Rasa integration work when on production?

I have tried with and without a docker stack on our production server and the bot just never seems to respond. Rasa
looks to be running fine along with the rasa-router. Its almost like Chatwoot isn't forwarding to the router correctly but i cannot see why, please advise!

Thanks,
Lewis

chatwood_dev database doesn't exist

After following the linux VM installation of chatwoot and running
bot = AgentBot.create!(name: "Rasa Bot", outgoing_url: "http://localhost:8000")
in the rails console I'm getting an error message from postgres that the chatwoot_dev database doesn't exist. Any help to resolve this issue would be appreciated.

Validation failed: Inbox can't be blank, Inbox must exist, Account must exist

Should this command be typed that way? The same is producing this error below, I tried to put the name of my inbox and the id, but it didn't work.

AgentBotInbox.create!(inbox: Inbox.first, agent_bot: bot)

Error:

ActiveRecord::RecordInvalid: Validation failed: Inbox can't be blank, Inbox must exist, Account must exist

Thanks

Undefined indexes on rasa-router

Hello

I have followed your guide and when I sent message from web widget to chatwoot, the bot wasn't working properly.
My whole error log of running rasa (rasa-router/index.php) like below:

[Mon Aug 31 16:59:41 2020] PHP Notice:  Undefined index: message_type in /home/chatwoot/chatwoot/rasa-router/index.php on line 10
[Mon Aug 31 16:59:41 2020] PHP Notice:  Undefined index: content in /home/chatwoot/chatwoot/rasa-router/index.php on line 11
[Mon Aug 31 16:59:41 2020] PHP Notice:  Undefined index: conversation in /home/chatwoot/chatwoot/rasa-router/index.php on line 12
[Mon Aug 31 16:59:41 2020] PHP Notice:  Undefined index: contact in /home/chatwoot/chatwoot/rasa-router/index.php on line 13
[Mon Aug 31 16:59:41 2020] PHP Notice:  Undefined index: account in /home/chatwoot/chatwoot/rasa-router/index.php on line 14
[Mon Aug 31 16:59:41 2020] message_type: 
[Mon Aug 31 16:59:41 2020] 127.0.0.1:48416 [200]: /

I think the params posted from widget were not correct.
Could you check and help me please?

Thanks so much.

Create the bot agent

Do I necessarily need to create the bot agent from the command line? If creating the agent on the panel, shouldn't obtaining the key work? I installed in Heroku and I am not able to create the agent

Thanks

No route matches [GET] "/widget_tests"

When I try to access the http://localhost:3000/widget_tests , I will get The page you were looking for doesn't exist.
log:

[2021-06-29T05:53:00.809604 #1] INFO -- : [fe6e6a2f-22a1-45d4-9c2d-28716c6a952f] Started GET "/widget_tests" for 172.28.0.1 at 2021-06-29 05:53:00 +0000
F, [2021-06-29T05:53:00.811262 #1] FATAL -- : [fe6e6a2f-22a1-45d4-9c2d-28716c6a952f]
[fe6e6a2f-22a1-45d4-9c2d-28716c6a952f] ActionController::RoutingError (No route matches [GET] "/widget_tests"):

What changes would be necessary in a production environment

Hello, I'm planning to run this code in a production environment. Some of the changes I made were

  • I change the conversation status to 'Open' when the user wants to talk to a human
  • I check the status of the conversation and only forward to RASA when the status is 'Pending'.

Are there any other changes that would be good to have in a production environment?
Is there any performance upgrade I should consider making?

Thanks in advance,
Matias.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.