DEV Community

Cover image for Added a Chat-bot to Chrome Extension;
Areeb ur Rub
Areeb ur Rub

Posted on

Added a Chat-bot to Chrome Extension;

If you follow me then you might know I created one chrome extension which allows people to chat if they are using same website.

Know More:

Why a chatbot to extension

After Publishing my extension V1 I asked some of the users for review, and the said that they tried to use it on some websites but didn't got anyone to talk.

This is happening because of not having a huge number of users currently.

So to entertain my users I added a chatbot which can talk to them if no one is there.

How I did it.

I used Dialogflow as a chat bot provider as it's natural speaking is amazing.

If you don't know about Dialogflow it is a Cloud Service Provided by Google, let you create chat bots and train them as you want them to talk

How it works in Chrome Extension,

Chrome extension don't work on frameworks like NodeJS or Flask so it was difficult to add Dialogflow library to it directly.

So what I did is, created a new flask(python) API as it's very simple to use Dialogflow's Python SDK and then hosted it on Heroku and used Dialogflow in my chrome extension via API calls.

I am not going in much details right now, if you want to know how I used Dialogflow in python and what codes I wrote then ask me in the comments.

To use API I used simple fetch() method and used the chat bot in an extension.

I tried so much to find a single way to do it without making my own API but I found no way to do it without a framework. I used Python as it fell easier to me but you can use any other framework (Ruby, PHP, NodeJS, etc...).

Try talking to the Bot:

Have a look to my Chrome Extension Click Here

Top comments (0)