Complete On-Premise and Fully Customisable Chat Bot - Part 3 - Communicating to the Agent that has been built
Welcome back Folks !!
In our part 2 we created the Bot Kit server/ Agent that will respond to the hello message with a fallback.
Here we will be looking on how to communicate to the bot on the port 3000 using the web socket client.
Follow the procedure as follows ,
1. Install the Chrome / Firefox from the below links
2. After installing the chrome or Firefox. Google for "Simple Websocket Client for Chrome / Firefox".
3. Open the first link and click on add to chrome.
4. Once if the extension has been added you can see it on the chrome like below
5. click on the simple web socket icon and the client opens as follows.
6. Now in the URL enter as "ws://localhost:3000" and click on the Open button. On Success the button will turn to close or it will alert the error. Ensure that the bot server that we created in the Part 2 is running.
7. In the request Section. paste the following message format and include your message in that.
{
"type": "message",
"text": "<user message >",
"user": "<User name>",
"channel": "Web",
"timestamp": "<Date time>"
}
Example
{
"type": "message",
"text": "Hello",
"user": "Pranav",
"channel": "Web",
"timestamp": "Thursday, March 8, 2018 8:06:47 AM"
}
Click on send button and you should get the reply from the bot as follows.
Hurrah !!! Our Bot in action. Modify the index.js to hear for more messages and play around with it.
In our part 2 we created the Bot Kit server/ Agent that will respond to the hello message with a fallback.
Here we will be looking on how to communicate to the bot on the port 3000 using the web socket client.
Communcation With Bot On 3000 in Websocket.
To test the communication with the bot, temporarily we will use the web socket client plugin that comes as a extension in the Chrome / Firefox plugin.Follow the procedure as follows ,
1. Install the Chrome / Firefox from the below links
- Chrome - https://www.google.co.in/chrome/
- Firefox - https://www.mozilla.org/en-US/firefox/new/
2. After installing the chrome or Firefox. Google for "Simple Websocket Client for Chrome / Firefox".
3. Open the first link and click on add to chrome.
4. Once if the extension has been added you can see it on the chrome like below
5. click on the simple web socket icon and the client opens as follows.
6. Now in the URL enter as "ws://localhost:3000" and click on the Open button. On Success the button will turn to close or it will alert the error. Ensure that the bot server that we created in the Part 2 is running.
7. In the request Section. paste the following message format and include your message in that.
{
"type": "message",
"text": "<user message >",
"user": "<User name>",
"channel": "Web",
"timestamp": "<Date time>"
}
Example
{
"type": "message",
"text": "Hello",
"user": "Pranav",
"channel": "Web",
"timestamp": "Thursday, March 8, 2018 8:06:47 AM"
}
Click on send button and you should get the reply from the bot as follows.
Hurrah !!! Our Bot in action. Modify the index.js to hear for more messages and play around with it.
In the next tutorial lets use the Natural Language Processing server to handle the message and classify the messages to the intents(Meaning full Category ) and lets create a beautiful conversation between the user and the bot.
Stay Tuned ... !!
nice article. informative
ReplyDeleteThank you !!
DeleteAppreciate your support and efforts.
ReplyDeleteThank you !!
DeleteThank you for the nice article. Can you please provide links to next article to use NLP for message handling ?
ReplyDeleteThank you so much !! Updated the link to the next
Delete