Connect rasa to a web site with the recommeded plataform

Here you will be able to find how to customize,

Thank you @rishier827 :blush:

Hi @Juste my bot is in the localhost and i wanted that to be host in a server(into my website) without using rasa x, please let me know

Hey @Naveen733. You can achieve the same thing without using Rasa X too. If you check out the section in the video regarding using socketio channel, the process is almost exactly the same:

  • You start Rasa on a local server (using rasa run)
  • You expose your Rasa assistant to the outside world using ngrok (or you can deploy it on your custom server, then you shouldn’t need ngrok)
  • You update the credentials.yml file with the URL to your server just like shown in the video
  • You add the WebChat Widget to your website, update the URL in the webchat configuration
  • Your assistant should be connected to your custom website
1 Like

How to integrate chatbot to local host website Can you help me

Hi @Juste

If user asks unwanted questions to the bot or the questions which are not listed so how can i handle them or how can predict the question and give them a default answer.

You can use the Fallback actions.

Hello,

I’m trying to plug RASA on my page, but the widget doesn’t appear and the console keeps showing CORS error.

Below I put how I tried to put all to work.

HTML page:

<html>
<body>
	<div id="webchat"></div>
	<script src="https://storage.googleapis.com/mrbot-cdn/webchat-latest.js"></script>
	<script>
		WebChat.default.init({
			selector: "#webchat",
			initPayload: "/get_started",
			customData: { "language": "pt" }, // arbitrary custom data. Stay minimal as this will be added to the socket
			socketUrl: "http://localhost:5005",
			socketPath: "/socket.io/",
			title: "Global Antares",
			subtitle: "Antares",
			connectOn: "open",
			hideWhenNotConnected : "false"
		})
	</script>
</body>
</html>

RASA start command line:

rasa run -m models --enable-api --cors '*' --debug

Every time that widget tries to connect apears:

2020-03-18 11:11:18 DEBUG rasa.core.channels.socketio - User 196e28d40f8f4bf28903b66c7c693420 connected to socketIO endpoint. 2020-03-18 11:11:36 DEBUG rasa.core.channels.socketio - User ab11abcf07364e34866edede15987bed disconnected from socketIO endpoint.

And the console on browser shows:

teste.html:1 Access to XMLHttpRequest at ‘http://localhost:5005/socket.io/?EIO=3&transport=polling&t=N3j-F6b’ from origin ‘null’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Log from RASA initialization:

2020-03-18 09:41:41 DEBUG rasa.core.utils - Available web server routes: /conversations/<conversation_id>/messages POST add_message /conversations/<conversation_id>/tracker/events POST append_events /webhooks/rasa GET custom_webhook_RasaChatInput.health /webhooks/rasa/webhook POST custom_webhook_RasaChatInput.receive /webhooks/rest GET custom_webhook_RestInput.health /webhooks/rest/webhook POST custom_webhook_RestInput.receive /model/test/intents POST evaluate_intents /model/test/stories POST evaluate_stories /conversations/<conversation_id>/execute POST execute_action /domain GET get_domain /socket.io GET handle_request / GET hello /model PUT load_model /model/parse POST parse /conversations/<conversation_id>/predict POST predict /conversations/<conversation_id>/tracker/events PUT replace_events /conversations/<conversation_id>/story GET retrieve_story /conversations/<conversation_id>/tracker GET retrieve_tracker /webhooks/socketio GET socketio_webhook.health /status GET status /model/predict POST tracker_predict /model/train POST train /conversations/<conversation_id>/trigger_intent POST trigger_intent /model DELETE unload_model /version GET version

2020-03-18 09:41:41 INFO root - Starting Rasa server on http://localhost:5005 2020-03-18 09:41:41 DEBUG rasa.core.utils - Using the default number of Sanic workers (1). 2020-03-18 09:41:41 INFO root - Enabling coroutine debugging. Loop id 1621305365384. 2020-03-18 09:41:41 DEBUG rasa.model - Extracted model to ‘C:\Users\lluchini\AppData\Local\Temp\tmpar5dl75o’. 2020-03-18 09:41:42 INFO rasa.nlu.components - Added ‘SpacyNLP’ to component cache. Key ‘SpacyNLP-pt’. 2020-03-18 09:41:42 DEBUG rasa.utils.tensorflow.models - Loading the model … 2020-03-18 09:41:42.770020: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library ‘nvcuda.dll’; dlerror: nvcuda.dll not found 2020-03-18 09:41:42.775639: E tensorflow/stream_executor/cuda/cuda_driver.cc:351] failed call to cuInit: UNKNOWN ERROR (303) 2020-03-18 09:41:42.781225: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: apdata676 2020-03-18 09:41:42.787204: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: apdata676 2020-03-18 09:41:42.790519: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 2020-03-18 09:41:43 DEBUG rasa.utils.tensorflow.models - Finished loading the model. 2020-03-18 09:41:43 DEBUG rasa.utils.tensorflow.models - Building tensorflow prediction graph… 2020-03-18 09:41:43.669010: W tensorflow/core/kernels/data/generator_dataset_op.cc:103] Error occurred when finalizing GeneratorDataset iterator: Cancelled: Operation was cancelled 2020-03-18 09:41:47 DEBUG rasa.utils.tensorflow.models - Finished building tensorflow prediction graph. 2020-03-18 09:41:47 DEBUG rasa.nlu.classifiers.diet_classifier - Failed to load model. Maybe the path ‘C:\Users\lluchini\AppData\Local\Temp\tmpar5dl75o\nlu’ doesn’t exist? 2020-03-18 09:41:47 DEBUG rasa.core.tracker_store - Connected to InMemoryTrackerStore. 2020-03-18 09:41:47 DEBUG rasa.core.lock_store - Connected to lock store ‘InMemoryLockStore’. 2020-03-18 09:41:47 DEBUG rasa.model - Extracted model to ‘C:\Users\lluchini\AppData\Local\Temp\tmp0up4ifrc’. 2020-03-18 09:41:47 DEBUG pykwalify.compat - Using yaml library: c:\venv\lib\site-packages\ruamel\yaml_init_.py 2020-03-18 09:41:47 DEBUG rasa.utils.tensorflow.models - Loading the model … 2020-03-18 09:41:48 DEBUG rasa.utils.tensorflow.models - Finished loading the model. 2020-03-18 09:41:48 DEBUG rasa.utils.tensorflow.models - Building tensorflow prediction graph… 2020-03-18 09:41:48.085525: W tensorflow/core/kernels/data/generator_dataset_op.cc:103] Error occurred when finalizing GeneratorDataset iterator: Cancelled: Operation was cancelled 2020-03-18 09:41:48 DEBUG rasa.utils.tensorflow.models - Finished building tensorflow prediction graph. 2020-03-18 09:41:48 DEBUG rasa.core.nlg.generator - Instantiated NLG to ‘TemplatedNaturalLanguageGenerator’.

Hi @Juste, I have uploaded the chatbot into my website(its on server) but its throwing below error

please help me on this

If I’m not mistaken, the problem is that you website is usign HTTPS and the api is using HTTP the browsers don’t like mixed contents, try using you site as HTTP only or starting the rasa with HTTPS using a certificate.

Hey @lluchini. I got the exact same issue with CORS and my widget was not displaying in my website. Have you found out a solution? By the way im using my rasa server on a remote server.

Hi @shanrock,

my solution was to swap the single quote from the command line to double-quotes. ( from '*' to "*").

1 Like

You the best. It worked.

1 Like

@lluchini. It worked one time. and when i restarted my system it stopped working? What are the steps to be followed? For ease : I’m running my rasa run actions in a remote server along with rasa server. I’m facing the same issue as yours but your solution yesterday worked but now its not working. What am i doing wrong???

An update. If im removing the debug its showing. I wanna know how to properly run it.

@shanrock,

I don’t want to sound a jerk, please don’t get me wrong, but triple check your command line…

This week I sent a command to a co-worker, and as he ctrl+c from Teams to his terminal, it swaped the double quotes for something different…

Let me know if works, if you want, try to reach me on LinkedIn, I’m at GMT -3…

Hello I have a question regarding the url if it is not a local host? If you have a server running Rasa and it needs to have a password to access that server would the widget be able to input that password?

Send me your LinkedIN profile lets connect.

hey I read the article, it is giving me 404 error even after following it step by step, could you please help?

i have also same issue plz help