How to create a Telegram bot, get the API key and chat ID

This guide will show you how to create a new Telegram bot, get the API and chat ID to be used to send chat messages through programming software.

Create a new Telegram bot and get the HTTP API key

1. Download and install “Telegram” app in your smartphone and register a new account in Telegram (new user).

2. Once logged on to your Telegram account, search for “BotFather” and select it. Make sure it’s the one labelled as ‘bot’.

3. Type “/start” and type “/newbot” to create a new Telegram bot.

4. Type the name of your new bot (for example “Msg”).

5. Type the username for your new bot which must be ended with “bot” and you cannot choose a username already taken by others (for example “MsgAidBot”)

6. After successfully created a new bot, BotFather will send you a message containing the HTTP API key.

Get the chat ID:

1. In your telegram, create a new chat group and add the bot that you have created into the chat group.

2. To get the chat ID of the group chat, use your internet browser and search for “Telegram Web”. Login to your account on Telegram Web by scanning the QR code.

3. Select the group chat that you have added your Telegram bot into, you will find the chat ID of the group chat shown in the URL within the address bar.

Tips: If you want to send messages to a private chat, the user (the one who receives bot message) must first send a message to the Telegram bot to start up the bot. The “-” sign is not needed for the chat ID of a private chat.

Related topics

 

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

DIY Digital Alarm Clock Using REKA:BIT With Micro:bit
Display Internet Time (NTP) on micro:bit
DIY Interactive Robot Using REKA:BIT With Micro:bit
BLTouch Installation for Ender 3 with 32-bit V4.2.2 Board
Pick and Send Random Meal’s Option and Locations through Telegram Bot Using Grove WiFi 8266 on micro:bit
Tutorials of Cytron Technologies Scroll to Top