Telegram Setup

How To Create Telegram Bot

To create a Telegram bot and get its API token, follow these steps:

  1. Start a Chat with BotFather

    • Open the Telegram app on your phone or computer.

    • In the search bar, type "BotFather" to find the bot that Telegram has created to assist you in creating your own bot.

    • Select "BotFather" from the search results.

  2. Create a New Bot

    • Once you have opened a chat with BotFather, click or tap on the "Start" button.

    • Now, you can create a new bot by sending the command "/newbot".

    • BotFather will then ask you for a name for your bot. This can be any name you choose.

    • After that, you'll be asked for a username. This must be unique and end with "bot" (like tetris_bot or tetrisbot).

  3. Get the API Token

    • Once you've successfully created your bot, BotFather will provide you with a token. This token will look somewhat like this: 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11

    • You will use this token to access the Telegram API, so keep it safe.

How To get Telegram Chat Id

A chat ID in Telegram is a unique identifier for a chat, whether it's a user-to-user chat or a group chat. You can get the chat ID by sending a message from your new bot to the desired chat and then using the Telegram API to retrieve that message. The ID of the chat will be included in the data about the message.

However, one easy method to obtain chat ID is:

  1. Add the bot to the group. Go to the group info and press "Add Member". Start typing your bot's name and select it from the dropdown.

  2. Get the list of updates for your bot from Telegram. Open your web browser and navigate to https://api.telegram.org/bot<YourBOTToken>/getUpdates. Replace <YourBOTToken> with the token you got from BotFather.

  3. Look for “chat”:{“id”:-XXXXXXXXX,…..}, where -XXXXXXXXX is your chat id (group id).

Please remember to handle your tokens with care. They are equivalent to a password and can be used maliciously if they fall into the wrong hands.

Set Token & Chat Id in backend

Last updated