Integrating Rasa Core with Django backend and finally using Webchat for chatbot user interface
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
chatsite remove rasa socket from settings Oct 13, 2018
rasachat move the bot file Oct 13, 2018
.gitignore Initial commit Oct 3, 2018 Update Jan 1, 2019 start django project Oct 3, 2018


Replace the rasachat/models folder with your models folder and run django server and file


Integrating Rasa Core with Django backend and finally using Webchat for chatbot user interface

In this project we will be using rasa_core for our chatbot backend django for website backend and rasa-webchat for chatbot User Interface

We have to first create a Rasa SocketIO Channel Layer

Create a separate file for this layer in rasachat folder

from rasa_core.agent import Agent
from rasa_core.channels.socketio import SocketIOInput
from rasa_core.agent import Agent

# load your trained agent
agent = Agent.load('models/dialogue', interpreter='models/current/nlu')

input_channel = SocketIOInput(
	# event name for messages sent from the user
	# event name for messages sent from the bot
	# namespace to use for the messages

# set serve_forever=False if you want to keep the server running
s = agent.handle_channels([input_channel], 5500, serve_forever=True)

Above piece of code comes from Rasa docs

Then in your html template configure rasa-webchat with following code

	<div id="webchat">
		<script src=""></script>
		        selector: "#webchat",
		        initPayload: "/get_started",
		        interval: 1000, // 1000 ms between each message
		        customData: {"sender": "django"}, // arbitrary custom data. Stay minimal as this will be added to the socket
		        socketUrl: "http://localhost:5500/",
		        title: "Connect",
		        subtitle: "The bot which connects people",
		        profileAvatar: "",
		        showCloseButton: true,
		        fullScreenMode: false

The socketUrl is the url endpoint that we configured with rasa socketio layer and the profileAvatar is the image that is displayed in bot message

Now run the django server and the socketio server using

../Django-Rasa-Bot> python runserver
../Django-Rasa-Bot/rasachat> python

Now open the url and open the chat widget and enter hi there and the bot will reply