Create a Telegram Bot
This guide walks you through creating a Telegram bot using BotFather. Takes about 2 minutes.
Step 1: Open BotFather
- Open Telegram (app or web)
- Search for @BotFather
- Start a chat with BotFather
Important: Make sure you’re chatting with the official @BotFather (verified with a blue checkmark).
Step 2: Create a New Bot
- Send the command
/newbot - BotFather will ask for a name for your bot
- Enter a friendly name like “My Channel Tracker”
Step 3: Choose a Username
- BotFather asks for a username
- Must end in “bot” (e.g.,
mychanneltracker_bot) - Must be unique across Telegram
Tips for usernames:
- Keep it short and memorable
- Use your brand name +
_botsuffix - Examples:
brandname_bot,mychannel_tracker_bot
Step 4: Copy Your Bot Token
After creation, BotFather sends you a message with your bot token. It looks like:
1234567890:ABCdefGHIjklMNOpqrsTUVwxyz123456789Keep this token secret! Anyone with the token can control your bot.
Step 5: Add Token to AdTarget
- Go to your AdTarget dashboard
- Open the site you want to track
- Go to Settings and select the Bots tab
- Click Add bot
- Paste your bot token into the input field
AdTarget will automatically verify the token, connect your bot, and register its webhook. You’ll see a success notification with your bot’s username once it’s connected.
Bot Settings (Optional)
You can customize your bot through BotFather:
Set a Profile Picture
- Send
/setuserpicto BotFather - Select your bot
- Upload an image (ideally your brand logo)
Set a Description
- Send
/setdescriptionto BotFather - Select your bot
- Enter a description users see when they start the bot
A Note on Privacy Mode
You do not need to change the bot’s privacy mode. AdTarget configures the webhook to listen for chat_member and my_chat_member events, which Telegram delivers regardless of the privacy setting. The privacy setting only controls whether a bot receives regular text messages in groups — it has no effect on channel join tracking.
Security Best Practices
Protect your token:
- Never share your bot token publicly
- Don’t commit it to version control
- Rotate the token if compromised
To regenerate a token:
- Send
/revoketo BotFather - Select your bot
- BotFather generates a new token
- Delete the old bot in AdTarget and add the new token via Settings → Bots → Add bot
Deleting a bot in AdTarget permanently deletes all associated data — channels, invite links, conversions, and site-channel assignments. This cannot be undone. Export or back up any data you need before deleting the bot.
Troubleshooting
BotFather not responding?
- Make sure you’re messaging the verified @BotFather
- Try closing and reopening the chat
- Check your internet connection
Username already taken?
- Try a more unique variation
- Add numbers or underscores
- Use your full brand name
Token not working in AdTarget?
- “This bot is already connected to another account” — Bot tokens are exclusive per AdTarget account. If you previously used this token on a different account, remove it there first.
- “Maximum bots reached” — Each AdTarget account can have up to 20 bots. Delete an unused bot before adding a new one.
- No response when pasting the token — Make sure you copied the full token including the numbers before the colon (e.g.,
1234567890:ABC...) with no extra spaces. The auto-validation only triggers when the format matches. - If the token is valid but still fails, try regenerating it with
/revokein BotFather and paste the new one.
Next Steps
Now that your bot is created, connect it to your Telegram channel.