Popular20 min read

Telegram Bot Integration

Deploy Moltbot as a powerful Telegram bot. Support for rich formatting, group chats, inline queries, file sharing, and AI-powered conversations.

Why Telegram?

Global Reach

800+ million active users worldwide. Popular in Europe, Asia, and Latin America.

Privacy First

End-to-end encryption in secret chats. Users trust Telegram for sensitive conversations.

Rich Bot API

Buttons, inline keyboards, file sharing, payments. Most feature-rich bot platform.

Step-by-Step Setup

1

Create Your Bot with @BotFather

/newbot

# Enter bot name: My AI Assistant

# Enter username: myai_moltbot_bot

# Save this token:

123456789:ABCdefGHIjklMNOpqrsTUVwxyz

2

Configure Moltbot

{
  "channels": {
    "telegram": {
      "enabled": true,
      "botToken": "YOUR_BOT_TOKEN",
      "webhook": {
        "enabled": true,
        "url": "https://your-domain.com/webhook"
      },
      "commands": [
        { "command": "start", "description": "Start the bot" },
        { "command": "help", "description": "Show help" }
      ]
    }
  }
}
3

Handler Code

const { Telegraf } = require('telegraf');

const bot = new Telegraf(process.env.BOT_TOKEN);

// Handle /start
bot.command('start', (ctx) => {
  ctx.reply('Hello! I am your AI assistant.');
});

// Handle messages
bot.on('text', async (ctx) => {
  const response = await moltbot.process(ctx.message.text);
  ctx.reply(response);
});

bot.launch();

Telegram Features

Rich Messages

Markdown, HTML formatting, images, files

Groups

Up to 200,000 members, admin controls

Commands

Slash commands with auto-complete

Inline Mode

Use @botname in any chat

Deploy Your Telegram Bot