Build Telegram_Bot Using Node Js

Srimathi Jagadeesan
hackgenius
Published in
3 min readJul 24, 2022

Have you at any point wondered whether you can make your own Telegram bot?!

And yes, it’s time to make one:)

Hello, World! I am back with another blog on developing a Telegram bot using Node Js.

Telegram

I have already mentioned in my previous article that Chatbot is a software application that uses NLP to communicate with users. We can integrate chatbots into various social media platforms. Along the way, I’ve integrated the bot on the telegram!

Okay, Let’s dive into the content!

How to create a telegram bot with Node Js?

Firstly, you’ve to install Vs Code for implementing Node Js backend.

Click this link to download Vs Code in your system. If you are done with installation. Then you should check with the node version.

Then, Install Node Js. Tap the link to download the Node Js.

Open your cmd prompt and type node — version to check the node version.

If you’re done with this, then install packages. Open your visual studio code, click terminal, and select the new terminal where you’ve to type npm init.

Create a js file (app. js-Sample) and start to write your code.

Enter the code in your editor.

Now, let’s create Telegram API KEY,

Open your telegram application and search for Bot Father.

BotFather
New_bot

Head over to Bot father and click on create a bot and provide a unique name for your bot and get Your API Key.

Copy the key and paste it on Vs code. And yes, Let me add the code to my GitHub, you can get the full code there:)

Make sure that to run your node js code, just type node app.js in the terminal and go to the telegram bot you created and say Hello or Hi, we’ll get a reply from the bot!!

Let me embed the result that I got,

MyBot_Name
Output
Code

At long last, we received a specific message from the bot. Since I’ve embedded the picture interface, we got the picture from the bot.

Here is my Github profile link. Get the code here!

I’ll be posting the News_telegram _bot Use case in the next article:)

Stay Tuned:)

THANK YOU!

HAPPY AUTOMATION

--

--

Srimathi Jagadeesan
hackgenius

Conversational AI || Mentored 500+ Students || Bot Builder|| Tech blogger|| Technical Trainer || Self learner.