Run multiple bots with a single rasa core server instance


I have built a chatbot using rasa stack, but I am not able to run multiple bot occurrence in a single rasa core instance as the bot gets confused and sends a wrong response to the users (sends User A’s response to User B and vice versa). I’ve read multiple blogs where using uuid was suggested as a solution to this problem but there was no clear explanation. Could you please let me know how to solve this problem. A code example would be much appreciated.

Hi @SudheshSolomon, thanks for posting your question. It depends on which input channels you’re using, defined in your credentials.yml file. For example, if your file contains the following:

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

Then each user would need to send a HTTP POST request to /base/webooks/rest/webhook with the following JSON contents:

    "message": "Hello",
    "sender": "abcd1234"

Where the sender needs to be unique per user. How you generate the sender value for each user is up to you, but it needs to be sent in each request sent to the Rasa instance. Using UUIDs is a valid option.

@fede. Thank you very much. This solution has given me an insight on how to proceed further :slight_smile:

1 Like

Hi @fede ,

Greetings. I tried the approach you suggested in creating the credentials file and parsing the chats as post request. However, I am stuck in the latter part. I am using flask to render HTML, but I am stuck at the point where I need to add an id to the user so that concurrent chats can happen simultaneously. Any help on how to proceed further is highly appreciated. NOTE: I am not able to parse my chat as GET/POST request. Kindly help me on this problem. My bot works perfectly fine if it is used only on one system. Also, I am not using slack, but I am using Flask and rendering the HTML.

When you render your HTML page with Flask, you could try including a unique ID somewhere in the page, so that each user that visits your site gets a unique ID assigned (you can also use Cookies for this). Would that help you?

Hi @fede,

Thanks for your reply. I am able to find that an uuid gets appended to the messages. :slight_smile:

I am now able to run my bot in two systems but I get response from the server system and not from the client.

I have changed the ip address of rasa core to the ip of my server system and my core runs on the ip of my server as well. How do I get a response from both the systems.

NOTE: The issue of rendering flask in multiple system is fixed but now I am facing the issue where I get the response only from the server and not from the client machines.

Kindly help me in this.

Hi @fede,

I have fixed this issue as well and found out what needs to be changed but this has led to a new issue. The file generates new uuid for message.senderId for every message which is sent. How to keep the same sender id until the session is closed?