In this post, we will create the simplest Node.js bot using Microsoft Bot Framework and connect it to Telegram. All actions we will do on the Azure platform without any code and installations. This tutorial will be easy to follow.
Go to Azure Portal under your subscription. Press “All Services” and search by “bot” keyword:
Select “Web App Bot”:
In default Bot Services directory press on “Create bot service” button:
We created a bot service and then we need to create web app bot.
Press “Create”:
Fill in the appropriate fields and choose “Bot template”:
Choose “Node.Js” and “Echo Bot” template. Then press “OK”. It will be a good start point:
You will be returned to the previous form. The last step will be choosing a service plan. Select the closest location to you and press “OK”:
Check all fields again and if you like it press “Create”:
The deployment process starts:
When the deployment process is over you will see a notification:
Sometimes you can don’t see this notification. In this case, just go to resource and periodically refresh the page.
Congratulations! You created your first bot. You can open it in your resource folder:
To test our bot we need to press “Test in Web Chat” under “Bot management” section:
Send any text message and the bot will send you a copy. To restart bot just press “Start over”.
The process of connection is very primitive. Open “Channels” under “Bot management” section and click on Telegram icon:
You will be redirected to the page where you need to enter Telegram Bot Token:
You can find this token BotFather Bot.
Enter token and press “Save”:
After successful saving you can see the newly created channel in the list:
Now you can open your Telegram Bot and send any text message:
Why I’m saying “text message”? Because the default Echo Bot supports only text messages from the box.
You can make sure that our bot handles all message and open an Analytics:
If you want to make quick changes in the bot you can use “App Service” Editor”.
You will be redirected to the Online Editor where you can change the logic in bot.js
file:
Open “Build” under “Bot management” and press “Open online code editor”:
In this tutorial, we’ve created a chatbot using the default Microsoft’s Bot Framework template; we connected it to Telegram and learned how to edit code online.
P.s. Don’t forget to delete all resources, if don’t need them.
comments powered by Disqus