How to Make a Telegram Bot in 10 Minutes?

Have you ever seen Rose on Telegram bands? Or Maria? Have you seen telegram bots that say the weather forecast, turn the text into sound, or the voice into text? What about the translating bots?

This article is prepared for those who see these things and say, “How is this possible?” or those who want to doit”.

What is Telegram Bot?

bot , telegram botu
Telegram bot

The Telegram bot is a tool that sends messages on a specific token and facilitates messaging. For example; this tool is the bot that allows you to receive messages such as “welcome” the moment you join a telegram group. There are many examples, such as a bot that reminds you of pinned messages, responds when you enter a specific word, or keeps a list.

What We Need to Do for Telegram Bot

Making and managing our Telegram bot is very easy for you after reading this article. If we look at it as the main title; In two steps everything will be ready.
The first one will be to create the body of our own bot by using BotFather, which is also a Telegram bot.

BotFather is a telegram bot used to manage telegram bots. In the next stage, there will be a software that communicates with the Telegram API and HTTP (Hyper Text Transfer Protocol). And as with any business, there are even higher apis that make this part even simpler.

In this article, we will use the NodeJS environment. Within NodeJS, there are multiple APIs crafted for this. The api we use is telegram-bot-api. NodeJS is an environment where we can perform server-based JS applications. You can use search engines for more information. Or maybe Teknotower articles may come soon. 😉

Bot Creation Steps

  1. Create bots with BotFather.
  2. To ensure communication with Node.js.

1) Steps to Create a Telegram Bot with BotFather:


  1. In Telegram’s search place, type “BotFather“. Click on the one with the blue check mark on the right side.
  2. Start messaging with “BotFather” with the button at the bottom of the screen.
  3. An explanation message will come up. Click on the “/newbot” text in the incoming message, type “/newbot” or select “/newbot” from the commands that appear by pressing the button with the “/” character to the right of the message writing area.
  4. The incoming message asks what the name of our bot will be. This place doesn’t have to have any unique value. Choose a name and submit.
  5. Now we are asked for “username” information. The point to note is that “username” should end with the letters “bot”. There is a possibility that you will not be able to create a bot on your first try because the “username” for the bot you can think of may have already been taken 🙂
  6. If you have successfully completed step 5, you now have a mindless bot. The token given to you will allow communication with the bot. You can use any language for this. However, in this article, we will use a special api written for node.js and telegram bots.
botfather python-telegram-bot
Step 1 and 2. The first step to creating a Telegram bot is to find BotFather. And texting.
telegram bot
Step 3 A request for the new bot is sent by typing “/newbot”.

After this process, you now have a bot, but it is a bot that does not know what to do. 🙂

telegram bot
In this way we can annotate our bot.
telegram bot
An embedded version of the description.
If They Happen They’ll Be Good

When you started messaging with “BotFather”, there was a long command and explanation message. From there, you can adjust the fields such as the description, about text, profile picture that appear on your bot’s profile. Again, you can delete your bot, name it, add games. For example, in the first message that comes up, under “Edit Bots”, click “/setabouttext”. Then select your bot from the bot selection screen and write and send about it for the bot. That’s 🙂


2) Steps to Communicate Node.js and Telegram Bot:

A 17 MB file for NodeJS is more or less. Perform the installation. You can find it here.

Then from cmd we will perform the following steps:

NOTE: If you type cmd after saying Windows key + r, you will see it.

  1. Create a folder for your Telegram bot. (You can create it by saying ” mkdir klasor_adi “)
  2. Enter the folder you created from the cmd screen. (the cd command will work for you)
  3. Type ” npm init“. When you’re inside the folder. You can skip the questions asked and continue with the default values.
  4. Inside the folder will be “ Package.js “.
  5. Next to that, go to the folder and create an “index.js ” file.
  6. Let’s add our apus to the folder by saying “npm install telegram-bot-api –save” from where we left off on the cmd screen again.
  7. Copy the code we created with the code title index.js into your file.
  8. After copying, copy the token that BotFather gave you for your bot without removing the single quotes in the section that says ” ‘ TOK:EN ‘ “.
telegram bot. cmd commands
Step 1 and 2. The file for the bot was created and entered into it.
npm init. telegram bot.
Step 3. ” npm init ” is written.
how to make a telegram bot in 10 minutes? 1 telegram bot
Step 4 and 5. Files will have been generated.
telegram bot api
Step 6. The bot api is added.
telegram bot api
Step 7 and 8. If you copy the token that botFather gave you on the 7th line, it is over. 🙂

The code you need to add to your index.js file for the Telegram bot. Don’t forget to copy the token given to you… 🙂

	The api is added.
	var telegram = require('telegram-bot-api');	

The necessary JSON is sent to our API.
	var api = new telegram({
		token: 'TOK:EN',
		updates: {
			enabled: true,
			get_interval: 1000

If "Message" comes up, we write the function we want to work.
	api.on('message', function(message) {
		if (message.text != "" && message.text != undefined) {
			var response = "You sent a message with : " + message.text + "!";  The string to which we will send the incoming message.
			We read the incoming chat id and say that the relevant chat id should go. Message read from group A
			We don't want him to go to group B:)
			reply_to_message_id to reply to the reply.
				text: response
				After the message is sent. or receiving information
best telegram bot

We now have a bot that will work like the Rose bot commands, which is a Telegram chat bot. It may not be as functional as the Rose bot commands, but that’s something you have. You can differentiate this bot that we have created.

How do we check that the bot is working?

Your bot, which you will run by saying “node index.js”, has been added to the mind (albeit mindless) 🙂 You can start messaging with your bot on Telegram without closing this cmd page.

how to make a telegram bot in 10 minutes? 2 telegram bot
Your bot’s answers

So what is the Api in question?

API : Application Programing Interface ie UPA : Application Programming Interface

It is the interface whose source code is not open but provides support for use.

The api for the Telegram bot is written for:

Normally, if we want to manage the bot for telegram, we have to work hard by writing pure code with http . However, someone who has combined the continuous settings in many projects with an api can easily manage it through this api. This telegram-bot-api is an api written for nodeJs . And for telegram bots there is only this api. There are a few more apis . 🙂

If we didn’t use them, a lot of work would have been required for basic operations. Everyone would have to write the same code. That’s why the api interface is provided.

In this article, we learned how to make our personal telegram bot with you. I hope it was useful. You can go to Homepage to browse other articles, you can follow our Instagram or Twitter pages…

Stay healthy…

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button