Telegram Bot Skill

Enable Moltbot to send and receive messages through Telegram.

Telegram Bot

Connect your Moltbot agent to Telegram for conversational AI interactions.

What It Does

  • Receive messages from Telegram users
  • Send text responses
  • Send images and files
  • React to inline commands
  • Handle group conversations

Install / Enable

The Telegram skill is built-in. Enable it by configuring your environment:

# .env
TELEGRAM_BOT_TOKEN=your-bot-token-from-botfather
TELEGRAM_WEBHOOK_URL=https://your-domain.com/api/telegram/webhook

Then restart Moltbot:

docker-compose restart

Permissions Required

PermissionRequiredDescription
Read MessagesYesTo receive user messages
Send MessagesYesTo respond to users
Send MediaOptionalTo send images/files
Group AccessOptionalFor group conversations

Example Commands

User: /start
Agent: Welcome! I'm your AI assistant. How can I help?

User: What's the weather like?
Agent: I'll check that for you... [uses web search skill]

User: /help
Agent: Here are the commands I understand:
       /start - Start conversation
       /help - Show this message
       /reset - Clear conversation history

Configuration

VariableRequiredDescription
TELEGRAM_BOT_TOKENYesBot token from @BotFather
TELEGRAM_WEBHOOK_URLYesYour public HTTPS webhook URL
TELEGRAM_ALLOWED_USERSNoComma-separated user IDs
TELEGRAM_ADMIN_USERSNoUser IDs with admin access

Restricting Access

To limit who can use your bot:

# Only allow specific users
TELEGRAM_ALLOWED_USERS=123456789,987654321

# Grant admin privileges to some users
TELEGRAM_ADMIN_USERS=123456789

Risks

Privacy: Messages are processed by your AI provider. Don't share sensitive information.

Costs: Each message uses AI API credits. Set spending limits on your AI provider account.

Abuse: Public bots can be spammed. Use TELEGRAM_ALLOWED_USERS to restrict access.

Troubleshooting

Bot doesn't respond

  1. Check webhook is set: Telegram Bot No Response
  2. Verify HTTPS certificate is valid
  3. Check Moltbot logs for errors

Messages delayed

  • Check getWebhookInfo for pending update count
  • Your server might be slow to respond
  • AI provider might have high latency

Bot works in DM but not groups

  • Enable group privacy mode in @BotFather
  • Or make the bot an admin in the group

Alternatives