# How to create a Telegram bot

This guide will walk you through the process of creating a Telegram bot and obtaining your bot token. No coding experience required!

### Prerequisites

* A Telegram account
* A smartphone or computer with Telegram installed

### Step 1: Start a Chat with BotFather

<figure><img src="/files/gUVxZpZJjXmyyXASsDtG" alt=""><figcaption></figcaption></figure>

1. Open Telegram
2. In the search bar at the top, type: `@BotFather`
3. Click on the verified BotFather account (it has a blue checkmark)
4. Click the "Start" button or send `/start`

### Step 2: Create a New Bot

<figure><img src="/files/w9nrI4YUgRrpycIlhiUl" alt=""><figcaption></figcaption></figure>

1. Send the command `/newbot` to BotFather
2. BotFather will ask you to choose a name for your bot
   * This is the display name that appears in conversations
   * Example: "My Awesome Bot"
3. After setting the name, BotFather will ask for a username for your bot
   * Must end in 'bot' (e.g., `my_awesome_bot` or `MyAwesomeBot`)
   * Must be unique across all of Telegram
   * Can only contain letters, numbers, and underscores

### Step 3: Get Your Bot Token

<figure><img src="/files/4EDAVLvPASdwL2pX9CQt" alt=""><figcaption></figcaption></figure>

1. If everything is successful, BotFather will respond with a message containing:
   * A congratulations message
   * Your bot's link (t.me/YourBotsUsername)
   * Your bot token (Looks like: `123456789:ABCdefGHIjklmNOPQrstUVwxyz`)
2. **Important**: Keep your token secret! It's like a password for your bot
   * Never share it publicly
   * Store it somewhere safe
   * If compromised, you can get a new one using `/token` command

### Step 4: Basic Bot Management Commands

You can use these commands with BotFather to manage your bot:

* `/mybots` - Lists all your bots and provides management options
* `/setname` - Change your bot's name
* `/setdescription` - Change your bot's description
* `/setabouttext` - Change the bot's about info
* `/setuserpic` - Change your bot's profile picture
* `/setcommands` - Set up command suggestions for your bot

### What's Next?

* Your bot is now created and ready to be programmed
* The bot token you received will be used in your bot's code to authenticate with Telegram's API
* Keep your bot token secure - you'll need it for development

### Troubleshooting Tips

1. If the username is taken, try another one
2. If you lost your token, use `/token` command with BotFather to get it
3. If your bot is compromised, use `/revoke` to revoke the old token and get a new one

### Safety Notes

* Never share your bot token publicly
* Don't commit your token to public repositories
* If you accidentally expose your token, revoke it immediately using BotFather


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.chain.fm/docs/how-to-create-a-telegram-bot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
