Deploying My Rasa X assistant to a SharePoint Page

Hello. I am total beginner and a lay person when it comes to Rasa and web-dev. I have a functioning assistant and I am now interested in integrating it with a SharePoint page on my company’s intranet.

After reading the Rasa docs I decided to setup a Websocket Channel.

I added the following to my credentials.yml page:

socketio:

user_message_evt: user_uttered

bot_message_evt: bot_uttered

session_persistence: true/false

I picked up the chatroom component from here to embed onto my SharePoint page:

Following the github instructions I pasted the chatroom.js script into my SharePoint page’s custom script.

However I am lost when it comes to the next set of instructions on the github page:

<< 2. In your Rasa bot setup, make sure to include the Rasa REST channel in your credentials.yml file:

rest:
  # pass

Depending on your setup you might need to start the Rasa CLI / Rasa server with the right CORS headers, e.g. --cors "*" .>>

Could someone kindly breakdown for me what it is I need to do here?..and if there are any additional steps I need to take?

I’ve attached my credentials.yml and sharepoint script here as well. credentials.yml (753 Bytes) webchat.html (707 Bytes)

Looks good to me :+1: If you are accessing the chat from another machine you might indeed need to add the cors settings. So that would mean to do rasa run --cors "*". Are you getting any errors or were you just asking in general?

Thanks for the reply Tobias. Ah I get it now, you run that as a terminal command. I was just asking in general what to do for step number 2 there. Ok I did that and it looks like I’m getting a mixed result.

If I run that script by itself in the browser…it seems to work:

but when I run it on my sharepoint page…Im getting errors…here’s a look from the console:

“OPTIONS http://localhost:5005/webhooks/rest/webhook net::ERR_CONNECTION_REFUSED”

“Chatroom.js:1307 Uncaught (in promise) TypeError: Failed to fetch”

Any clue what is causing this?..this might not even be a Rasa thing…

Talked to a colleague of mine, he thinks this is a CORS (Cross Origin Resource Sharing) issue because my Rasa is running on a VM machine and our SharePoint sites are hosted on a different domain. He is certain this would go away if we ran Rasa on the same domain as our SharePoint sites and I think that is the end-goal for us especially when we are getting ready to take this to production…but for now I need it to work under this setup so I can demo this to our business users. Has anyone encountered something like this before?

@seansta Can you run rasa with --debug (e.g. rasa run --debug) to see if there are any errors / warnings from the REST input channel? And --cors did not work for you?

Hi Tobias, thanks for the reply.

Here is an update on the situation.

I copied my Rasa project to the machine that is hosting our SharePoint quality farm. Ran rasa and fired up the SharePoint page with the chat widget. Everything works when I run “rasa run --cors”.

Now the question is how do I make this accessible for other users in our network? The chat does not work when I try to access the page from any other machine.

The chat does not work when I try to access the page from any other machine.

I guess the client is javascript and you are targeting localhost, aren’t you? The chatbot has to be accessible via a public IP if you want to access it from an other machine. If you just want to test it out quickly, you can use https://ngrok.com/ for that.

Ah got it, makes total sense Tobias. Now the latest roadblock is that I can’t seem to access ngrok, company firewall blocks it. Do you know of any other methods of making my bot running on localhost public?

Do you know of any other methods of making my bot running on localhost public?

Mhm, I guess the firewall will block them all (And a good company firewall should :smiley:) Can you maybe speak to somebody in your company who is responsible for deploying things according to your company policies?

Hi Tobias,

Had a meeting of the minds with our IT middleware team and we tried a few things and we still could not get it to work.

By default Rasa runs on localhost 5005.

How can we switch it to a different server? We were thinking of pointing it to directly to our SharePoint quality server: https://westapps.ev.com, using port 440…which is the port SharePoint uses.

I tried running a terminal command with these arguments, but was getting errors:

rasa run --cors “*” --port https://westapps.ev.com:440

Any clues?

What do you mean by that? You mean the output channel should point to this server, right?

Tobias I mean, Rasa by default runs on localhost 5005…how can I change this to something else? I want to change it to a port on one of our company’s servers.

You can only change the host, if you run it on another host. So in you case you have to run it on a server of your company

Let’s say my company says I can host rasa at this public IP: https://example.com:5003

I cannot somehow configure rasa to run at that IP and port through console commands? If that is the case, do I need to setup this public IP to be a reverse proxy for rasa running in localhost?

Let’s say my company says I can host rasa at this public IP: https://example.com:5003

You don’t have to tell Rasa to run at the IP. Just run it at the server which has this IP.

The Rasa X port is configurable through --rasa-x-port RASA_X_PORT

I think this guide Deploy to a Server might also be interesting for you.

Ah I got what you are saying Tobias. Due to load balancing I think the best option is to use a reverse proxy to expose Rasa. Will try that. Thank you for all of your help!

Update: Our RP works. Thanks again!

Awesome! Great work @seansta :rocket:

1 Like