Giter Club home page Giter Club logo

apps.rasa's Introduction

Apps.Rasa

Integration between Rocket.Chat and the RASA Chatbot platform

Some Important Concepts of App.Rasa

This app can operate in 2 modes:

  1. Synchronous mode

    In synchronous mode, the app will make use of Rasa's REST API to exchange message. The app will make use of Rasa's RESTInput channel.

    If you are using this mode, make your you have enabled rest api in credentials.yml in your rasa bot. More info about it here

  2. Asynchronous / Callback Mode

    In asynchronous mode, the app will make use of callbacks to receive messages from Rasa. The app will make use of Rasa's CallbackInput channel.

    Note that if you are using Reminders and External events in your Rasa Chatbot, then you will find this mode useful, as these features are only work in this mode.

    If you are using this mode, you will have to make following configuration to Rasa

    1. You need to supply a credentials.yml with the following content:

      callback:
      url: "http://localhost:3000/api/apps/public/646b8e7d-f1e1-419e-9478-10d0f5bc74d9/callback"
      

      You can find the correct url in the App Details page, under API section.

Installation steps:

Option 1

Download directly from Rocket.Chat marketplace

Option 2 (Manual Install)

  1. Clone this repo and Change Directory:
    git clone https://github.com/RocketChat/Apps.Rasa.git && cd Apps.Rasa/

  2. Install the required packages from package.json:
    npm install

  3. Deploy Rocket.Chat app:
    rc-apps deploy --url http://localhost:3000 --username user_username --password user_password Where:

    • http://localhost:3000 is your local server URL (if you are running in another port, change the 3000 to the appropriate port)
    • user_username is the username of your admin user.
    • user_password is the password of your admin user.

    For more info refer this guide

Rocket.Chat Apps Setup

  1. First go ahead n create a Bot User. Login as administrator, then goto Setting > Users. There create a new Bot User. This new user should have these 2 roles.

    1. bot
    2. livechat-agent
  2. Then configure the app to automatically assign a livechat-visitor to this bot. To do so, goto Setting > Livechat > Routing or Setting > Omnichannel > Routing. There enable Assign new conversations to bot agent Setting.

  3. The app needs some configurations to work, so to setup the app Go to Setting > Apps > Rasa. There, fill all the necessary fields in SETTINGS and click SAVE. Note all fields are required.

    Some of the fields in SETTING include

    1. Bot Username (required)
      • This should contain the same bot username which we created above in Step 1
    2. Rasa Server Url (required)
      • URL for the Rasa Server goes here. Eg:- http://localhost:5005
    3. Service Unavailable Message (optional)
      • The Bot will send this message to Visitor if service is unavailable like suppose if no agents are online.
    4. Close Chat Message (optional)
      • This message will be sent automatically when a chat is closed
    5. Handover Message (optional)
      • The Bot will send this message to Visitor upon handover
    6. Default Handover Department Name (required)
      • Enter the target department name where you want to transfer the visitor upon handover. Note that you can override setting using Handover action.
    7. Enable Callbacks
      • Enabling this setting will allow the app to use only callback messages. This feature is useful when you are using Reminder messages in your RASA bot.
    8. Hide Quick Replies (required)
      • If enabled, then all quick-replies will hide when a visitor clicks on any one of them

Apps.Rasa's API

The app provides API to trigger specific actions. The URL for the API can be found on the Apps Page(Setting > Apps > Rasa). Currently the app provides 2 APIs.

  1. Incoming API/Endpoint

    This endpoint can be used to trigger specific actions. The list of supported actions include

    1. Close Chat
      To close a chat
      • REST API Documentation for this endpoint can be found here
    2. Handover
      To perform a handover
      • REST API Documentation for this endpoint can be found here
  2. Callback API/Endpoint

    This Endpoint is needed when the App runs in Asynchronous / Callback Mode mode. You will have to copy this url to credentials.yml file.

Adding Quick Replies support to your Rasa Bot

  • Rasa App provides out of the box support for quick replies. To add quick-replies, you can follow the structure defined in Rasa here

apps.rasa's People

Contributors

d-gubert avatar murtaza98 avatar renatobecker avatar

Stargazers

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

Watchers

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

apps.rasa's Issues

Settings not working

Hi, I have a simple bot working on localhost. When I tried to connect this bot on rocket.chat omnichannel (live agent), it didn't work. I don't understand why.

What did I do:
1 - in omnichannel>routing: checked "assign new conversations to bot agent". BTW, the routing method actually is "Auto selecttion", is that correct?

2 - after installing rasa.apps, I configure it this way:

  • bot username: bot (I created a user with this username and with bot and live-agent roles)
  • rasa server url: a ngrok url to my localhost working bot.
  • Default Handover Department Name: Suporte Técnico (this department is already working with live-agent without bot)
  • check "Enable callbacks"

3 - In credential.yml, I added the lines:
rest:
url: "https://myhiddenapplicaton/api/apps/public/646b8e7d-f1e1-419e-9478-10d0f5bc74d9/incoming"

callback:
url: "https://myhiddenapplication/api/apps/public/646b8e7d-f1e1-419e-9478-10d0f5bc74d9/callback"

4 - after all, in my localhost cmd I run:

  • ngrok http 5005
  • rasa run --cors "*" --debug

But, when I try to talk to this bot, it seems like nothing happening and it works as before all these settings. What am I missing?

@murtaza98

which function calls post method to start a request?

I am looking for why Apps.Rasa lost rich messages fields of rasa response, such as quick reply, blocks,and attachments...

very strange I can't find the code of Apps.Rasa, search whole project by keyword rasa, nothing founded.

I compare the project files between before insalled Apps.Rasa and after , not found new files of Apps.Rasa,

very confused.

and can't find which function call http request through "post" method in "/programs/server/npm/node_modules/@rocket.chat/apps-engine/server/accessors/Http.js"

and can't find which function call "setText" method in "/programs/server/npm/node_modules/@rocket.chat/apps-engine/server/accessors/MessageBuilder.js"

I have not an environment about meteor.

I hope I can debug the code by insert "console.log" to related file and function. I found some code about request and response.

but I didn't find where call the request to start , and where call to handle the response.

please help,thanks!

why rich messages lost after get response from rasa?

on rasa side , there are text field and other filelds in the response .
but both on rocket.chat side and livechat side, only get "msg" field, and all other rich messages dada lost.
what is the correct message format for rasa response?

Bot not showing images

Hi,

I'm experiencing a rather strange situation. All images sent by bot do not open to visitors on mobile devices. But, in most of times it opens normally in computers.

I already set General > Rest API > Allow Getting Everything as true

Visitors and humans attendants can send images normally, but when bot sends, it do not appears and if I send links, it do not open, as you can see in pictures below.

How can I solve this situation?

image
image
image

why define so much message type?

IMessage is already defined by Rocket.chat.
Why not use?
and define two new type IRasaMessage, ILivechatMessage for AppsRasa.

Error while trying to handover

Hi,

I'm trying to implement a handover action. My bot is on "Test Bot" department, I want to handover a chat to other department. I'm getting this error:

Handover Endpoint response b'{"error":"Error occurred while processing handover. Details Error: The selected department and the current room department are the same [error-forwarding-chat-same-department]"}'

I'm using this code:

        headers = CaseInsensitiveDict()
        headers["Content-Type"] = "application/x-www-form-urlencoded"
        headers["Accept"] = "application/json"

        INCOMING_ENDPOINT_URL = "blablabla hiden blablabla"

        payload = {
            "action": "handover",
            "sessionId": tracker.sender_id,
            "actionData": {
              "targetDepartment": "Secretaria"
            }
        }
        
        response = requests.post(INCOMING_ENDPOINT_URL, headers=headers, data=payload)
        print('Handover Endpoint response', response.content)

Anyone can help me?

@murtaza98 maybe you can help again?

Compatibility with Rocket.Chat 3.11.0 is broken

In RC 3.11.0 you guys added a "feature" that the conversation will not be auto-assigned to an offline or unavailable bot agent.
Therefore the Rasa App is currently broken with 3.11.0 because the bot agent user will always be offline.

Please tell me how could I deal with this problem. Thank you very much

how to add initial payload to start a new conversation?

Just wondering anybody can tell me how to add initial payload with new chat ? I want rasa to drive the conversation , in order to do that we need to start with initial payload so conversation can be driven by rasa. Thanks.

how to get the sessionID?

Hi,

I need to get the sessionID to perform a handover, but I don't know how. Can someone help me with this?

Deploying error createRequire is not a function

Trying to deploy the App.Rasa application with the rc-apps and the error I get is:

Starting App Deployment to Server

Getting Server Info... ✓
Packaging the app... ✖
› Error: ⟿ createRequire is not a function

Any idea on why this is happening?

Ability to use Rasa for internal bots and not only livechat

Hello!

I had a need to write a bot for use inside a rocket chat. BUT the usual api does not allow using buttons to implement navigation.

I researched existing solutions, and with integration through the rocket chat application engine - there is only Rasa
However, as I figured out when trying to use, this only works for livechat.

Now I started writing an application that provides an interface for bots and I plan to make an adapter for an engine such as a botkit
However, I would also like to add the ability to work inside the chat for bots on the Rasa engine.

Therefore, I have the following questions:

  • Did I understand correctly that now it only works with livechat?
  • What do you think about if I try to implement support for internal chats and do a PR with this?

【solved】setting everything, but still not work

Does the readme lost some steps?
Does it need to modify some settings or some files on rasa side and livechat side?
Does it need to setup Setting > integration > incoming/outgoing/bot on rocket.chat ?

thanks!

Handoff action.py?

Not an issue, most likely I haven't figured something obvious.

Setup done according to instruction. Everything works, except handoff to human agent.

Do I need to write an custom action for handoff, as I saw in setting has default handoff Department in app setting, I thought it was handled by rasa.app.

Thanks in advance.

Offline form display

Hi folks,

Currently offline form display doesn't work if the bot is opt for "Assign new conversations to bot agent" is true. Without this option been true , bot doesn't answer.

What would be the easy way to show offline display when someone looking for handover to agent outside business hours?

Thanks in advance.

Rasa App not sending images to livechat

Hello ppl, I'm having a problem trying to work with images in livechat through RasaApp.

This appears to be happening only when using a Rasa Bot with RasaApp, since I can send images to the user by myself and the user can reply with another image during a "normal" conversation.

Testing:

  • I have an utter for the images setup like this in my domain.yml:
utter_explica_numprocesso:
  - image: https://s.conjur.com.br/img/b/tabela-numeracao.jpeg
    text: É um número grande, conforme esta imagem.
  - image: https://s.conjur.com.br/img/b/tabela-numeracao.jpeg
    text: É um número grande, conforme essa imagem. Mas ele é fundamental. Vamos lá?
  • Images are working fine if I use the Integration menu (Administration -> Integration), in which I have set up an outgoing webhook for communicating with the Rasa Server. Below a screenshot of a Rasa Bot sending an Image to the user inside RocketChat, via integration webhook:

01_image_rocketchat

  • However the same utter does not work with livechat and RasaApp, as shown in the screenshot below

02_image_livechat

  • The image is not shown as well in the omnichannel chat log:

03_livechat_rocketview

My questions are:

  1. Should RasaApp work with linked images?
  2. If not, how should I send files to the App API POST incoming?

Best regards.

Rasa App executePostMessageSent returning null

Hello ppl, I'm having a problem trying to integrate my Rasa bot with RC. While I already set up the Omnichannel (Department and Routing) and installed RasaApp from the marketplace.

RasaApp logs

Instance: c81df0d9-6852-4430-9513-6eac8eefaf31
debug: 2023-07-12T07:48:59.076Z Caller: anonymous OR constructor
[
  "executePostMessageSent is being called..."
]
debug: 2023-07-12T07:48:59.081Z Caller: anonymous OR constructor
[
  "'executePostMessageSent' was successfully called! The result is:",
  null
]

Rasa Server

Rasa Version      :         3.6.2
Minimum Compatible Version: 3.5.0
Rasa SDK Version  :         3.6.0
Python Version    :         3.8.0

RocketChat

Version:                     6.2.0
Apps Engine Version:         1.39.0
Node Version:                v14.21.3
Database Migration:          294 (July 10, 2023 10:04 AM)
MongoDB:                     5.0.18 / wiredTiger (oplog Enabled)

For Test: Using the outgoing webhook bot is working fine with RC. but getting multiple responses message from Rasa.

PS. The bot is working fine with Slack+RASA, with no any issue or multiple responses

@murtaza98 maybe you can help again?

Rasa app PostMessageSentHandle

"{"stack":"TypeError: Cannot read property 'getLogger' of undefined\n at Object.exports.createMessage (evalmachine.:39:18)\n at runMicrotasks ()\n at processTicksAndRejections (internal/process/task_queues.js:97:5)\n at PostMessageSentHandler.run (evalmachine.:45:13)\n at RasaApp.executePostMessageSent (evalmachine.:20:9)","message":"Cannot read property 'getLogger' of undefined"}"

RASA dialog breaking after only a few responses

Hello,

Thank you for this great library

I have integrated RASA as an app with one bot (bot1) serving as a live agent. Now, when I send a trigger (e.g. Hello) through an external service (i.e SMS) the RASA bot or live agent is able to respond once but the ensuing responses break (i.e. not submitted to twilio for sms delivery). Through an omnichannel manager account, I can see that the bot is responding correctly but for some reason the last response is not sent out to twilio for sms delivery. I have cross checked whether the bot is responding properly via a shell and everything seems to be okay from the RASA side. My observation is that if the last response is not sent out to twilio then rocketchat eventually crashes (Please see below).

I am particularly curios on this message printed below "The selected department and the current room department are the same [error-forwarding-chat-same-department] " and I was wondering whether this information might be useful. FYI - I have also tried this bot with a department where it's the only live agent to make sure this is issue is not occurring due to a routing error.

Any insights on this would be much appreciated. Thank you!

I20201231-03:15:31.613(-5)? The App 646b8e7d-f1e1-419e-9478-10d0f5bc74d9 is requesting from the outter webs: {
I20201231-03:15:31.613(-5)? appId: '646b8e7d-f1e1-419e-9478-10d0f5bc74d9',
I20201231-03:15:31.614(-5)? method: 'post',
I20201231-03:15:31.614(-5)? url: 'http://localhost:5001/webhooks/rest/webhook',
I20201231-03:15:31.614(-5)? request: {
I20201231-03:15:31.614(-5)? headers: { 'Content-Type': 'application/json' },
I20201231-03:15:31.614(-5)? data: { sender: 'aAyCH2kSKuiiuk7ky', message: 'hello' },
I20201231-03:15:31.614(-5)? params: {},
I20201231-03:15:31.614(-5)? content: '{"sender":"aAyCH2kSKuiiuk7ky","message":"hello"}',
I20201231-03:15:31.614(-5)? npmRequestOptions: {}
I20201231-03:15:31.614(-5)? }
I20201231-03:15:31.614(-5)? }
I20201231-03:15:31.976(-5)? The App 646b8e7d-f1e1-419e-9478-10d0f5bc74d9 is getting the username: "bot1"
I20201231-03:15:31.978(-5)? The App 646b8e7d-f1e1-419e-9478-10d0f5bc74d9 is getting the roomById: "aAyCH2kSKuiiuk7ky"
I20201231-03:15:31.983(-5)? The App 646b8e7d-f1e1-419e-9478-10d0f5bc74d9 is creating a new message.
I20201231-03:15:45.668(-5)? The App 646b8e7d-f1e1-419e-9478-10d0f5bc74d9 is requesting from the outter webs: {
I20201231-03:15:45.669(-5)? appId: '646b8e7d-f1e1-419e-9478-10d0f5bc74d9',
I20201231-03:15:45.669(-5)? method: 'post',
I20201231-03:15:45.669(-5)? url: 'http://localhost:5001/webhooks/rest/webhook',
I20201231-03:15:45.669(-5)? request: {
I20201231-03:15:45.669(-5)? headers: { 'Content-Type': 'application/json' },
I20201231-03:15:45.669(-5)? data: { sender: 'aAyCH2kSKuiiuk7ky', message: 'i am not well' },
I20201231-03:15:45.669(-5)? params: {},
I20201231-03:15:45.670(-5)? content: '{"sender":"aAyCH2kSKuiiuk7ky","message":"i am not well"}',
I20201231-03:15:45.670(-5)? npmRequestOptions: {}
I20201231-03:15:45.670(-5)? }
I20201231-03:15:45.670(-5)? }
I20201231-03:15:46.701(-5)? The App 646b8e7d-f1e1-419e-9478-10d0f5bc74d9 is getting the username: "bot1"
I20201231-03:15:46.704(-5)? The App 646b8e7d-f1e1-419e-9478-10d0f5bc74d9 is getting the roomById: "aAyCH2kSKuiiuk7ky"
I20201231-03:15:46.714(-5)? The App 646b8e7d-f1e1-419e-9478-10d0f5bc74d9 is creating a new message.
W20201231-03:25:52.063(-5)? (STDERR) === UnHandledPromiseRejection ===
W20201231-03:25:52.064(-5)? (STDERR) errorClass [Error]: The selected department and the current room department are the same [error-forwarding-chat-same-department]
W20201231-03:25:52.064(-5)? (STDERR) at app/livechat/server/lib/Helper.js:287:9
W20201231-03:25:52.064(-5)? (STDERR) at /home/Benson/.meteor/packages/promise/.0.11.2.1b943fq.17dl++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/meteor-promise/fiber_pool.js:43:40 {
W20201231-03:25:52.064(-5)? (STDERR) isClientSafe: true,
W20201231-03:25:52.064(-5)? (STDERR) error: 'error-forwarding-chat-same-department',
W20201231-03:25:52.064(-5)? (STDERR) reason: 'The selected department and the current room department are the same',
W20201231-03:25:52.065(-5)? (STDERR) details: { function: 'forwardRoomToDepartment' },
W20201231-03:25:52.065(-5)? (STDERR) errorType: 'Meteor.Error'
W20201231-03:25:52.065(-5)? (STDERR) }
W20201231-03:25:52.065(-5)? (STDERR) ---------------------------------
W20201231-03:25:52.065(-5)? (STDERR) Errors like this can cause oplog processing errors.
W20201231-03:25:52.066(-5)? (STDERR) Setting EXIT_UNHANDLEDPROMISEREJECTION will cause the process to exit allowing your service to automatically restart the process
W20201231-03:25:52.066(-5)? (STDERR) Future node.js versions will automatically exit the process
W20201231-03:25:52.066(-5)? (STDERR) =================================
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.

Customer handover happens only once

Hello,

I'm experiencing a rather confusing behavior with the bot-human agent handover process. If the customer is new - let's say customer 1, the bot is able to perform a successful handover to a department and everything works fine. However, let's assume the first chat from customer 1 is closed and even deleted from rocketchat but the same customer initiates another chat from either same browser or same phone number (assuming it's sms), the bot-human agent handover fails with an error (see below). However, let's assume customer 2 who has never made contact tries to ask for a human ...this action is successful - which indicates that it fails once the customer's information is added onto the contact list. Any suggestions what might be going wrong here? I would like to have customers get multiple bot-human agent handover regardless of whether they are registered in the contact list or not.

Thanks you!

morethanonce

[
"Error occurred while processing the request. Details:- Error: Error! Invalid request. User is already present in the specified department"
]

I have attached a screenshot from the APP logs

How to send language information

The need is th have RocketChat able to serve different languages so having different bot for each language.
Is it possible to add to the request to rasa a lang parameter?
Also this lang can be collected from RocketChat? Is there a place in RocketChat where we can configure the livewidget lang?
Thanks

[New Feature] Add Asynchronous handover support

Async handover support means - When a visitor asks the bot that they want to speak with an online agent, then RASA will detect this intent and trigger a Webhook event. The apps responsibility will be to catch this event and transfer the control from Bot to an online agent

Different Status Code when handover fails

HI! Thanks for this awesome Apps. It works really well.

I noticed that successfully handing over the room to another department or not, the status code is always the same.

I would like to know if the transfer was sucessfull, meaning it was handed over to another online agent.

Similarly, when I can the API livechat/room.transfer, it will result in {'success': False} if there is no online users. This will allow the rasa action to activate some form loop, for example, get more informations, and at least store those informations at a channel, for example. I tried cloning this repo to develop it my self and send a PR, but could not deploy the app to rocketchat.

transfer to department not working as intended

Hi Folks,

One department setup for only rasa bot. 2 department setup with live agent(Status and Complains). In Admin>Apps>Rasa we use Complains as default channel.

image

But Transferring to department to "Status" going in default department complains.

image

Am i missing something?
Thanks in advance.

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.