Overview
Setting up your Telegram bot is the first step in deploying the Subscription Manager. This guide covers creating your bot, configuring commands, setting up your private channel, and getting the necessary credentials.Prerequisites
- A Telegram account
- Telegram app (mobile or desktop)
- A private Telegram channel (or create one during setup)
Create Your Bot
Open BotFather
- Open Telegram and search for @BotFather or click here
- Start a conversation by clicking “Start” or sending
/start
BotFather is Telegram’s official bot for creating and managing bots.
Create New Bot
Send the This is the display name users will see.2. Choose a username for your bot:
/newbot command to BotFather.BotFather will ask you two questions:1. Choose a name for your bot:Configure Bot Commands
Set up bot commands so users can see available commands in the Telegram menu.Open Command Editor
In your conversation with BotFather, send:BotFather will show a list of your bots. Click on the bot you just created.
Create Private Channel
Your bot will manage access to a private Telegram channel where subscribers receive content.Create Channel
- Open Telegram
- Click the menu (☰) → “New Channel”
- Enter channel name (e.g., “VIP Signals Channel”)
- Add a description
- Click “Create”
Make Channel Private
When asked to choose channel type:
- Select “Private Channel”
- Optionally set a custom invite link (not required)
- Click “Save”
Get Channel ID
To get your channel ID, you need to forward a message to a special bot:Or:Save this channel ID - it will be your
- Post a message in your private channel (any message works)
- Forward that message to @userinfobot
- The bot will reply with information including the channel ID
TELEGRAM_CHANNEL_ID environment variable.Channel IDs always start with
-100 and are negative numbers.Add Bot as Administrator
Your bot needs admin permissions to manage channel members:
- Go to your private channel
- Click channel name → “Administrators”
- Click “Add Administrator”
- Search for your bot by username (e.g.,
@myvip_subscription_bot) - Select your bot
Essential Permissions (Required)
Essential Permissions (Required)
- ✅ Invite users via link - Allows bot to create invite links
- ✅ Restrict members - Allows bot to ban/unban users
Optional Permissions (Recommended to Disable)
Optional Permissions (Recommended to Disable)
- ❌ Change channel info
- ❌ Post messages
- ❌ Edit messages
- ❌ Delete messages
- ❌ Add new administrators
- Click “Done” to save
Configuration Variables
You now have two critical values for your environment configuration:TELEGRAM_BOT_TOKEN
The token you received from BotFather:.env.local:
TELEGRAM_CHANNEL_ID
The channel ID from @userinfobot:.env.local:
These variables will also be added to your Vercel deployment settings.
Set Webhook (After Deployment)
The webhook connects Telegram to your deployed application. You’ll set this up after deploying to Vercel.Skip this section for now and return after completing the Vercel deployment.
<YOUR_BOT_TOKEN>with your actual bot tokenyour-app.vercel.appwith your Vercel deployment URL
Verify Webhook
Check webhook status:If
pending_update_count is 0, your webhook is working correctly!Test Your Bot
Verify everything is working:Start Conversation
- Open Telegram
- Search for your bot by username (e.g.,
@myvip_subscription_bot) - Click “Start” or send
/start
Verify Response
Your bot should respond with a welcome message showing:
- Available subscription plans
- Prices and durations
- Payment instructions
- Bank account details
Customization Options
Change Bot Profile Picture
- Send
/setuserpicto BotFather - Select your bot
- Upload an image (square images work best)
Set Bot Description
This appears when users first open your bot:- Send
/setdescriptionto BotFather - Select your bot
- Enter description:
Set About Text
This appears in the bot’s profile:- Send
/setabouttextto BotFather - Select your bot
- Enter about text:
Troubleshooting
Bot Not Responding to Commands
Bot Not Responding to Commands
Possible causes:
-
Webhook not set:
If
urlis empty, set the webhook. - Wrong webhook URL: Verify URL matches your Vercel deployment.
- Vercel deployment issues: Check Vercel function logs for errors.
-
Environment variables missing:
Verify
TELEGRAM_BOT_TOKENis set in Vercel.
Cannot Create Invite Links
Cannot Create Invite Links
Solution: Check bot permissions in channel:
- Go to channel → Administrators
- Click on your bot
- Ensure “Invite users via link” is enabled
- Ensure “Restrict members” is enabled
- If it works, permissions are correct
- If it fails with “not enough rights”, add the permissions
Channel ID Not Working
Channel ID Not Working
Verify channel ID format:
- Must be a negative number
- Must start with
-100 - Example:
-1001234567890
- Make your bot an admin first
- Send a test message from bot to channel
- Check the API response for the chat ID
Users Getting 'User Not Found' Errors
Users Getting 'User Not Found' Errors
This happens when trying to remove users who:
- Have never joined the channel
- Already left the channel
- Blocked the bot
Security Best Practices
Next Steps
Now that your Telegram bot is configured, proceed with:Paystack Setup
Configure payment processing
Database Setup
Set up MongoDB and Prisma