Skip to main content

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

1

Open BotFather

  1. Open Telegram and search for @BotFather or click here
  2. Start a conversation by clicking “Start” or sending /start
BotFather is Telegram’s official bot for creating and managing bots.
2

Create New Bot

Send the /newbot command to BotFather.BotFather will ask you two questions:1. Choose a name for your bot:
VIP Subscription Bot
This is the display name users will see.2. Choose a username for your bot:
myvip_subscription_bot
Username requirements:
  • Must end with bot (e.g., my_bot or MyBot)
  • Must be unique across all Telegram
  • Can only contain letters, numbers, and underscores
3

Save Bot Token

BotFather will respond with your bot token:
Done! Congratulations on your new bot. You will find it at t.me/myvip_subscription_bot. 
You can now add a description, about section and profile picture for your bot.

Use this token to access the HTTP API:
123456789:ABCdefGhIJKlmNoPQRstuVWXyz1234567890

Keep your token secure and store it safely, it can be used by anyone to control your bot.
Copy and save this token securely - you’ll need it for your environment variables.
Never share your bot token publicly! Anyone with this token can control your bot.

Configure Bot Commands

Set up bot commands so users can see available commands in the Telegram menu.
1

Open Command Editor

In your conversation with BotFather, send:
/setcommands
BotFather will show a list of your bots. Click on the bot you just created.
2

Set Commands

Copy and paste the following command list:
start - Welcome message and payment instructions
verify_basic - Verify Basic plan payment (7 days)
verify_biweekly - Verify Bi-Weekly plan payment (14 days)
verify_monthly - Verify Monthly plan payment (30 days)
verify_premium - Verify Premium plan payment (14 days + copier)
verify_promo - Verify promo code payment
status - Check your current subscription status
help - Show help and payment instructions
BotFather will confirm:
Success! Command list updated. /help
Users can now see these commands by typing / in the chat with your bot.

Create Private Channel

Your bot will manage access to a private Telegram channel where subscribers receive content.
1

Create Channel

  1. Open Telegram
  2. Click the menu (☰) → “New Channel”
  3. Enter channel name (e.g., “VIP Signals Channel”)
  4. Add a description
  5. Click “Create”
2

Make Channel Private

When asked to choose channel type:
  • Select “Private Channel”
  • Optionally set a custom invite link (not required)
  • Click “Save”
The channel MUST be private! Public channels won’t work with this bot system.
3

Get Channel ID

To get your channel ID, you need to forward a message to a special bot:
  1. Post a message in your private channel (any message works)
  2. Forward that message to @userinfobot
  3. The bot will reply with information including the channel ID
Look for a line like:
Chat: -1001234567890
Or:
"chat": {
  "id": -1001234567890,
  "title": "VIP Signals Channel",
  "type": "channel"
}
Save this channel ID - it will be your TELEGRAM_CHANNEL_ID environment variable.
Channel IDs always start with -100 and are negative numbers.
4

Add Bot as Administrator

Your bot needs admin permissions to manage channel members:
  1. Go to your private channel
  2. Click channel name → “Administrators”
  3. Click “Add Administrator”
  4. Search for your bot by username (e.g., @myvip_subscription_bot)
  5. Select your bot
Required Permissions:
  • Invite users via link - Allows bot to create invite links
  • Restrict members - Allows bot to ban/unban users
  1. Click “Done” to save
Without proper permissions, the bot cannot create invite links or manage expired subscriptions!

Configuration Variables

You now have two critical values for your environment configuration:

TELEGRAM_BOT_TOKEN

The token you received from BotFather:
123456789:ABCdefGhIJKlmNoPQRstuVWXyz1234567890
Add to your .env.local:
TELEGRAM_BOT_TOKEN=123456789:ABCdefGhIJKlmNoPQRstuVWXyz1234567890

TELEGRAM_CHANNEL_ID

The channel ID from @userinfobot:
-1001234567890
Add to your .env.local:
TELEGRAM_CHANNEL_ID=-1001234567890
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.
Once deployed, set your webhook:
curl "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook?url=https://your-app.vercel.app/api/telegram/webhook"
Replace:
  • <YOUR_BOT_TOKEN> with your actual bot token
  • your-app.vercel.app with your Vercel deployment URL
Expected Response:
{
  "ok": true,
  "result": true,
  "description": "Webhook was set"
}

Verify Webhook

Check webhook status:
curl "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getWebhookInfo"
Successful Response:
{
  "ok": true,
  "result": {
    "url": "https://your-app.vercel.app/api/telegram/webhook",
    "has_custom_certificate": false,
    "pending_update_count": 0,
    "max_connections": 40
  }
}
If pending_update_count is 0, your webhook is working correctly!

Test Your Bot

Verify everything is working:
1

Start Conversation

  1. Open Telegram
  2. Search for your bot by username (e.g., @myvip_subscription_bot)
  3. Click “Start” or send /start
2

Verify Response

Your bot should respond with a welcome message showing:
  • Available subscription plans
  • Prices and durations
  • Payment instructions
  • Bank account details
If the bot doesn’t respond:
  • Check webhook is set correctly
  • Verify environment variables in Vercel
  • Check Vercel function logs for errors
3

Test Commands

Try each command:
  • /help - Should show payment instructions
  • /status - Should show “No active subscription”
  • Type / to see all available commands in the menu

Customization Options

Change Bot Profile Picture

  1. Send /setuserpic to BotFather
  2. Select your bot
  3. Upload an image (square images work best)

Set Bot Description

This appears when users first open your bot:
  1. Send /setdescription to BotFather
  2. Select your bot
  3. Enter description:
Welcome to VIP Subscription Manager! 

Get access to premium trading signals with flexible subscription plans. Pay with Paystack and get instant access to our exclusive VIP channel.

Set About Text

This appears in the bot’s profile:
  1. Send /setabouttext to BotFather
  2. Select your bot
  3. Enter about text:
Automated subscription management bot for VIP channel access. Secure payments via Paystack.

Troubleshooting

Possible causes:
  1. Webhook not set:
    curl "https://api.telegram.org/bot<TOKEN>/getWebhookInfo"
    
    If url is empty, set the webhook.
  2. Wrong webhook URL: Verify URL matches your Vercel deployment.
  3. Vercel deployment issues: Check Vercel function logs for errors.
  4. Environment variables missing: Verify TELEGRAM_BOT_TOKEN is set in Vercel.
Verify channel ID format:
  • Must be a negative number
  • Must start with -100
  • Example: -1001234567890
Get channel ID alternative method:
  1. Make your bot an admin first
  2. Send a test message from bot to channel
  3. Check the API response for the chat ID
This happens when trying to remove users who:
  • Have never joined the channel
  • Already left the channel
  • Blocked the bot
Solution: The app handles this gracefully - no action needed. The error is logged but doesn’t affect functionality.

Security Best Practices

Protect Your Bot Token:
  • Never commit .env.local to Git
  • Never share bot token publicly
  • Regenerate token if compromised (use /revoke in BotFather)
Rate Limiting: The bot includes built-in rate limiting (4 failed attempts = 1 hour block) to prevent abuse.

Next Steps

Now that your Telegram bot is configured, proceed with:

Paystack Setup

Configure payment processing

Database Setup

Set up MongoDB and Prisma

Build docs developers (and LLMs) love