Create Telegram Bot
Step-by-step guide to creating a bot with BotFather
Create Telegram Bot
Learn how to create a new Telegram bot using BotFather, Telegram's official bot creation tool.
What is BotFather?
BotFather is Telegram's official bot for creating and managing other bots. It provides a conversational interface for all bot administration tasks.
Open BotFather
- Open Telegram app (mobile or desktop)
- Search for
@BotFatheror visit t.me/botfather - Start a chat by clicking "Start" or sending
/start
Create New Bot
Send the /newbot command to BotFather.
BotFather will guide you through two steps:
Choose Bot Name
- This is the display name users see
- Can contain spaces and special characters
- Example: "My Awesome Assistant"
Choose Username
- Must end in
bot(e.g.,awesome_assistant_bot) - Must be unique across all Telegram bots
- Only letters, numbers, and underscores allowed
- Cannot contain spaces
If your desired username is taken, try adding numbers or descriptive terms.
Save Bot Token
BotFather will provide your bot token. It looks like:
123456789:ABCdefGHIjklMNOpqrsTUVwxyz123456789Keep this token secret! Anyone with this token has full control over your bot.
Store the token securely:
- Use password manager or secrets vault
- Never commit to version control
- Don't share in public forums or screenshots
Configure Bot Settings (Optional)
BotFather offers additional commands for customization:
/setdescription- Set bot description shown in chat/setabouttext- Set text shown in bot profile/setuserpic- Upload bot profile picture/setcommands- Define command list with descriptions/setprivacy- Control group message access
Example command setup:
start - Initialize bot and show welcome message
help - Display available commands and features
settings - Configure bot preferences
status - Check bot status and usageBot Token Security
Do's
- Store tokens in environment variables
- Use secrets management services (AWS Secrets Manager, HashiCorp Vault)
- Rotate tokens periodically
- Limit token access to necessary services only
Don'ts
- Never hardcode tokens in source code
- Don't share tokens via email or chat
- Avoid storing in plain text files
- Don't expose in client-side code
Regenerating Token
If your token is compromised:
- Message BotFather with
/token - Select your bot from the list
- Choose "Revoke current token"
- BotFather provides new token
- Update token in OpenClaw Portal immediately
Old token stops working immediately. Update all integrations before revoking.
Bot Username Best Practices
- Descriptive - Username should hint at bot purpose
- Memorable - Easy to type and share
- Brand Aligned - Match your organization or product name
- Future-Proof - Consider long-term branding
Good examples:
@customer_support_bot@acme_assistant_bot@newsletter_delivery_bot
Avoid:
@bot123456- Not descriptive@thisisareallylongbotusernamethatshardtoremember_bot- Too long@temp_bot- Not professional
Next Steps
Now that you have your bot token: