To create a new bot on Telegram, you'll need to use BotFather, Telegram's official bot for creating and managing bots.
-
Start a Chat with BotFather:
- Open Telegram and search for @BotFather.
- Start a chat with BotFather by clicking on the "Start" button.
-
Create a New Bot:
- Send the /newbot command to BotFather.
- BotFather will ask you to provide a name for your bot. Choose a name (e.g., MyAwesomeBot).
- Next, BotFather will ask you to choose a username for your bot. This username must end in bot (e.g., MyAwesomeBot_bot).
-
Get Your Bot Token:
- After successfully creating the bot, BotFather will provide you with an authentication token.
- This token is essential for authenticating your bot when making API requests to Telegram's Bot API.
-
Keep Your Token Secure:
- Store your bot token securely. Do not share it with anyone else, as it provides complete access to your bot.
-
Using the Bot Token:
- Replace <YOUR_BOT_TOKEN> in API requests with the token provided by BotFather.
-
Further Configuration:
- Optionally, you can configure additional settings for your bot using BotFather, such as adding a description, profile picture, or enabling inline mode.
-
BotFather Commands:
- BotFather offers additional commands to manage your bot. You can explore these commands by typing /help in the BotFather chat.
Here's an example of how to use cURL to retrieve basic information about your bot:
curl https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getMe