Easy Integration of Telegram 2 Rasa Chatbot

0
0

Automation…Automation… Automation… 🤖

Automation has lead to the success now a days. All the businesses that are run online have grab the opportunity to automate it’s service to grab more audience attention.

Also with the automation you are providing the customer a service for 24*7 which is a very good initiative for your businesses to give more and to earn more. To expand your businesses I’m here with this session to make you learn this amazing technology to integrate it into your businesses to earn more revenue.

OVERVIEW

In this session, you will learn how to integrate telegram with Rasa chatbot and to make your bot as a contact in telegram as an assistant to communicate with it. for example to get the solutions to your queries, to book a cab through texting, to enquire the queries related to your business, etc.

Also you will how to share your telegram bot with anyone so that it can be send worldwide for production.

how to integrate telegram with Rasa chatbot

Firstly we will build a basic chatbot that will work in action when we will connect it to the telegram. In my case, I already have a chatbot ready with me and I’ve shared it on my git repository and you can also download the code from there. To get the full code of the working of this chatbot then checks this link:

https://github.com/ashus3868/RasaCustomerService.git

If this is your first blog from me then do check this link as well to learn how to build your own Rasa chatbot the checkout this link :

Now, I assume that you have your working chatbot with you and we can proceed to integrate it to telegram. Firstly,you have you download the basic applicationof telegram from app store as per the smartphone you are using.

After downloading the application on your smartphone signups/login to telegram first. After logging in click on the search icon on the top right corner in your application and search for BotFather and select it.

When you have selected “BotFather” follow the instructions as shown here:

From the video above it will be very clear to you that how to get the credentials from telegram that are required by Rasa chatbot to integrate with telegram. Now you you have the access token and Verify id with you. So you can add then to the credentials file in your Rasa project to integrate then together.

how to integrate telegram with Rasa chatbot

Now, open your Rasa project and go to credentials.yml file and add the following lines to it.

telegram:
  access_token: "490161424:AAGlRxinBRtKGb21_rlOEMtDFZMXBl6EC0o"
  verify: "your_bot"
  webhook_url: "https://your_url.com/webhooks/telegram/webhook"

In the above lines of code access_token and verify, you will get it from telegram BotFather while setting up the bot and in webhook_url you will have to add your domain url. If you don’t have any domain with you then you can use ngrok for now to make your localhost url to set as global url to integrate and communicate with telegram.

Checkout this video to learn how to use ngrok to set the bot to production or lets say globally:

Now when you have your ngrok link with you, replace it in webhook_url to set it for global.

After the setup, go to terminal and activate your Rasa environment where you have all the packages already installed. Run two separate terminal with this environment and parallely type the commands shown here:

rasa run
rasa run actions

When these two commands are running parallelly you can now run open the bot from the link provided by BotFather and start chatting with the bot.

Now your bot will be in action.

To learn and view the complete concept practically you can check this video:

If you are new here and don’t know much about python programming so you can learn python here. To learn python programming check out this link:

Time to wrap up now. Hope you liked our content on How to integrate Rasa chatbot on Telegram. See you in our next blog, thanks for reading our blog and do leave a comment below to help us improve the content to serve you all of our experience with you. Stay tuned with us for more Rasa Chatbot contents.

Also check out our other playlist Rasa Chatbot, Internet of things, Docker, Python Programming, etc.
Become a member of our social family on youtube here.

Till then stay tuned and happy learning 🤗

Ashish Saini
Ashish Saini

I am a software developer for Python/Machine Learning. Also, I’m Rasa Hero at Rasa. Also, I’m a youtuber where I regulary uploads the videos to help this generation learn about the technology just like they are playing games.

One thought on “Easy Integration of Telegram 2 Rasa Chatbot

Leave a Reply