Skip to main content
Page has been viewed 0 times.

Bot Management

Comprehensive guide to managing multiple Telegram bots, monitoring their status, and handling bot operations from a single dashboard.

Intermediate 10 min read Updated: Jan 15, 2024

Bot Management Overview

The Bot Management system allows you to control multiple Telegram bots from a single interface, providing centralized monitoring, control, and analytics for all your subscription bots.

Multiple Bots

Add and manage unlimited Telegram bots with different tokens and configurations.

Centralized Control

Start, stop, and monitor all bots from a single dashboard with real-time status updates.

Shared Database

All bots share the same database, ensuring consistent user data and subscription management.

GramMonetize Bot Management Interface
Bot Management dashboard showing multiple bots and their status

Adding Telegram Bots

Add one or more Telegram bots by simply providing the bot token obtained from @BotFather.

Step-by-Step: Adding a New Bot

1. Get Bot Token from @BotFather

On Telegram, message @BotFather and create a new bot or get token of existing bot:

/newbot
→ Choose bot name (e.g., MySubscriptionBot)
→ Choose username (e.g., MySubscriptionBot)
→ Get token: 1234567890:ABCdefGHIjklMNOpqrsTUVwxyZ
Important: Keep your bot token secret! Never share it publicly.
2. Add Bot to Dashboard

In your GramMonetize dashboard, navigate to Bot Management → Add New Bot:

Required Information:
  • Bot Token: From @BotFather
  • Bot Name: Display name (optional)
  • Bot Username: @username (auto-detected)
Example Token Format:
1234567890:ABCdefGHIjklMNOpqrsTUVwxyZ Format: BotID:BotSecret
3. Configure Webhook (Automatic)

GramMonetize automatically sets up the webhook for your bot. The system will:

  • Verify bot token validity
  • Set webhook to your server URL
  • Configure allowed updates
  • Test connection with Telegram API
Success: Your bot is now connected and ready to use!
Multiple Bot Configuration

You can add multiple bots for different purposes:

🌐 Primary Bot

Main subscription bot for all users

@MainSubscriptionBot
🛠️ Support Bot

Dedicated support and assistance

@SupportHelperBot
📢 Announcement Bot

Broadcasts and announcements

@AnnouncementsBot

Multi-Bot Architecture

GramMonetize supports running multiple bots simultaneously with a shared database architecture.

Shared Database Architecture

Bot 1
Bot 2
Bot 3
Shared Database
Benefits of Shared Database:
  • Unified User Management: Users interact with any bot, data syncs across all
  • Consistent Subscriptions: Subscription status consistent across bots
  • Centralized Analytics: All bot activity in one place
  • Simplified Backups: Single database to backup
  • Load Distribution: Multiple bots handle user load
  • Redundancy: If one bot fails, others continue
  • Specialization: Different bots for different purposes
  • Scalability: Add more bots as user base grows
Configuration Example:
// Multi-bot configuration
$bots = [
    'main_bot' => [
        'token' => '1234567890:ABCdefGHIjklMNOpqrsTUVwxyZ',
        'purpose' => 'Primary subscriptions',
        'webhook_url' => 'https://yourdomain.com/webhook/main',
        'status' => 'running'
    ],
    'support_bot' => [
        'token' => '9876543210:ZYXwvutsrqpoNMLkjihGFEdcba',
        'purpose' => 'Customer support',
        'webhook_url' => 'https://yourdomain.com/webhook/support',
        'status' => 'running'
    ]
];

// All bots connect to same database
$database = 'grammonetize_db';
// Shared user table
$users_table = 'bot_users';
// Shared subscriptions table
$subscriptions_table = 'user_subscriptions';

Status Monitoring

Monitor all your bots' status in real-time with comprehensive metrics and alerts.

Bot Status Dashboard

5
Total Bots
3
Running
1
Stopped
1
Active Bot
Linked on homepage
0
Banned
1,245
Active Subs
Status Indicators:
Status Icon Description Action Required
Running Bot is active and processing messages None
Stopped Bot is manually stopped Start bot to resume
Error Bot has connection issues Check token/webhook
Banned Bot banned by Telegram Replace token immediately
Active Link Bot link shown on homepage Only one bot can be active
Active Bot Link on Homepage

You can set one bot as the "active bot" whose link will be displayed on your dashboard homepage:

Active Bot: @MySubscriptionBot
https://t.me/MySubscriptionBot
Currently Active

Users can click this link to start interacting with your bot directly from your website.

Bot Operations

Control your bots with simple operations from the dashboard interface.

Start and Stop Individual Bot

Starting a Bot:
  1. Navigate to Bot Management page
  2. Find the bot you want to start
  3. Click the button
  4. Confirm the action in the popup
  5. Wait for status to change to "Running"
Starting a bot establishes the webhook connection with Telegram.
Stopping a Bot:
  1. Navigate to Bot Management page
  2. Find the running bot
  3. Click the button
  4. Confirm the action in the popup
  5. Status changes to "Stopped"
Stopping a bot will disconnect it from Telegram. Users cannot interact with it until restarted.

Bulk Operations

Perform actions on multiple bots simultaneously to save time.

Bulk Selection Process:
1. Select Multiple Bots

Use the checkboxes next to each bot in the list:

2. Choose Bulk Action

Select an action from the bulk actions dropdown:

3. Confirm Action

A confirmation dialog shows the affected bots:

Confirm Bulk Action

You are about to start 2 bots:

  • @SupportBot (Currently: Stopped)
  • @AnnounceBot (Currently: Running)
Available Bulk Actions:
Start - Start selected stopped bots
Stop - Stop selected running bots
Delete - Remove bots from system
Export - Export bot configuration

Token Management

Securely manage and replace bot tokens when needed without losing data.

Token Replacement

When to Replace Token
  • Bot banned by Telegram
  • Suspected token compromise
  • Changing bot username
  • Security rotation policy
Step-by-Step Token Replacement:
1. Get New Token from @BotFather

Message @BotFather and use command:

/mybots
→ Select your bot
→ API Token
→ Revoke current token
→ Generate new token
2. Replace Token in Dashboard

In Bot Management, click "Replace Token" for the bot:

Before Replacement:
1234567890:OLD_TOKEN_abc123 Old token (inactive)
After Replacement:
1234567890:NEW_TOKEN_xyz789 New token (active)
3. Data Preservation

All existing data is preserved during token replacement:

  • ✅ User Data: All user records remain
  • ✅ Subscriptions: Active subscriptions continue
  • ✅ Settings: Bot configuration preserved
  • ✅ Analytics: Historical data maintained
  • ✅ Webhook: Automatically reconfigured
Security Best Practices:
Regular Rotation

Rotate tokens every 90 days for security

Access Control

Limit token access to authorized admins only

Audit Logs

Maintain logs of all token changes

Best Practices

Multi-Bot Strategy

  • Primary Bot: Main subscription processing
  • Support Bot: Dedicated to user queries
  • Backup Bot: Ready in case primary fails
  • Testing Bot: For testing new features
  • Regional Bots: For different languages/regions
Tip: Assign different profile pictures to distinguish bots visually.

Common Mistakes

  • Using same token in multiple places
  • Not monitoring bot status regularly
  • Forgetting to set active bot link
  • Not having backup bots ready
  • Ignoring ban warnings from Telegram
  • Exposing tokens in logs or errors
  • Not testing after token replacement

Performance Optimization

📊 Monitoring
  • Check status daily
  • Monitor response times
  • Track error rates
  • Set up alerts for downtime
🛡️ Security
  • Regular token rotation
  • IP whitelisting if possible
  • Monitor unauthorized access
  • Keep logs of all changes
⚡ Scalability
  • Add bots before reaching limits
  • Distribute load across bots
  • Monitor Telegram API limits
  • Plan for growth

Troubleshooting

Common Issues and Solutions

Issue Symptoms Solution
Bot Not Starting Status remains "Stopped"
  1. Check token validity
  2. Verify server connectivity
  3. Check webhook configuration
  4. Review server logs
Bot Banned Status shows "Banned"
  1. Get new token from @BotFather
  2. Replace token immediately
  3. Review Telegram ToS compliance
  4. Contact Telegram support if needed
Slow Response High response times
  1. Check server resources
  2. Monitor API rate limits
  3. Consider adding more bots
  4. Optimize database queries
Webhook Errors Intermittent connectivity
  1. Verify SSL certificate
  2. Check firewall settings
  3. Test webhook manually
  4. Contact hosting provider
Quick Diagnostic Commands:
// Check bot info via Telegram API
https://api.telegram.org/bot<YOUR_TOKEN>/getMe

// Check webhook status
https://api.telegram.org/bot<YOUR_TOKEN>/getWebhookInfo

// Set webhook manually
https://api.telegram.org/bot<YOUR_TOKEN>/setWebhook?url=<YOUR_WEBHOOK_URL>
Need More Help?

Check our general troubleshooting guide or contact support with your bot token (first 10 characters only) and error screenshots.

Frequently Asked Questions

There's no hard limit on the number of bots you can add to GramMonetize. However, practical considerations include:
  • Server Resources: Each bot consumes server resources
  • Management Overhead: More bots require more management
  • Telegram Limits: Each bot has its own API rate limits
  • Database Performance: Shared database must handle all bot activity

Recommended: Start with 1-3 bots and add more as needed based on user load and business requirements.

Yes, each bot can have different configurations:
  • Different Messages: Welcome, disclaimer, support messages
  • Different Payment Methods: Some bots can accept different payment options
  • Different Channels: Bots can manage different Telegram channels
  • Different Languages: Bots can be configured for different languages

However, all bots share the same core settings like currency, database connection, and user management system. You can create specialized bots for different purposes while maintaining a unified backend.

If your bot gets banned by Telegram:
  1. Immediate Detection: GramMonetize detects the ban status automatically
  2. Status Update: Bot status changes to "Banned" in dashboard
  3. Notifications: You receive email/Telegram notifications
  4. Data Preservation: All user data and subscriptions remain intact
  5. Quick Recovery: Replace token to restore functionality
Important: To prevent bans, ensure your bot complies with Telegram Bot Terms of Service. Common ban reasons include spam, violating privacy, or malicious behavior.

The active bot link feature allows you to showcase one bot on your dashboard homepage:
  • Single Active Bot: Only one bot can be set as "active" at a time
  • Homepage Display: Active bot's link appears on your dashboard homepage
  • Quick Access: Users can click to start conversation with the bot
  • Easy Switching: Change active bot anytime without affecting data

Use Case: Useful when you have multiple bots but want to direct users to your primary subscription bot. The link format is: https://t.me/YourBotUsername

Yes, you can export bot configuration in multiple formats:
  • JSON Export: Complete bot configuration including token (encrypted)
  • CSV Report: Bot statistics and performance metrics
  • Backup File: Full backup for disaster recovery
  • Migration Package: For moving to another GramMonetize instance
Export Options:
Single Bot Multiple Bots All Bots

Security Note: Exported files containing tokens are encrypted and should be stored securely.

Yes, GramMonetize provides a comprehensive API for bot management:
Endpoint Method Purpose
/api/v1/bots GET List all bots
/api/v1/bots POST Add new bot
/api/v1/bots/{id}/start POST Start specific bot
/api/v1/bots/{id}/stop POST Stop specific bot
/api/v1/bots/bulk POST Bulk operations

For complete API documentation, visit our Core API documentation.

Bot performance metrics are calculated based on:
  • Uptime: Percentage of time bot is running vs stopped
  • Response Time: Average time to process user messages
  • Error Rate: Percentage of failed requests
  • User Engagement: Active users per bot
  • Subscription Rate: Conversion rate to paid subscriptions
Monitoring Frequency:
  • Real-time: Status and basic metrics
  • Hourly: Performance averages
  • Daily: Engagement and conversion rates
  • Monthly: Long-term trends and patterns
Still Have Questions?

Check our general FAQ section or contact our support team. Include your bot username(s) for faster assistance.