Skip to main content
Telegram is one of the easiest channels to set up with OpenClaw. You create a bot via @BotFather, get a token, and configure OpenClaw to use it. Telegram supports DMs, groups, channels, threads, commands, inline buttons, and rich media.

Quick Start

The fastest way to set up Telegram is with the interactive onboarding:
Select Telegram and follow the prompts to enter your bot token.

Creating a Telegram Bot

1

Chat with @BotFather

Open Telegram and search for @BotFather. This is Telegram’s official bot for creating and managing bots.
2

Create a new bot

Send /newbot to @BotFather and follow the prompts:
  • Choose a display name (e.g., “OpenClaw Bot”)
  • Choose a username (must end in bot, e.g., openclawbot or my_openclaw_bot)
3

Copy your bot token

@BotFather will give you a token that looks like:
Save this token securely. You’ll need it for configuration.
4

Configure bot settings (optional)

You can customize your bot with @BotFather:
  • /setdescription - Set bot description
  • /setabouttext - Set “About” text
  • /setuserpic - Upload a profile picture
  • /setcommands - Set bot commands menu

Configuration

Using Environment Variables

The simplest way to configure Telegram:
Then enable in config:

Using Config File

Alternatively, store the token directly in openclaw.config.json:

DM Policies

  • pairing (recommended): Unknown users get a pairing code; approve with openclaw pairing approve telegram <userId>
  • allowlist: Only user IDs in allowFrom can DM the bot
  • open: Anyone can DM the bot (set allowFrom: ["*"])
  • disabled: Ignore all Telegram DMs

Getting Your Telegram User ID

To allowlist yourself, you need your Telegram user ID (a numeric ID, not your username). Method 1: Check logs (safest)
  1. DM your bot on Telegram
  2. Run openclaw logs --follow
  3. Look for a line like:
Method 2: Use @userinfobot Forward any message to @userinfobot and it will reply with your user ID. Method 3: Use Telegram API directly
Look for "from":{"id":123456789} in the JSON response.

Resolving Usernames to IDs

OpenClaw can resolve @username to a user ID automatically:
This will output the numeric user ID you can add to allowFrom.

Group Configuration

To use your bot in Telegram groups:
1

Add bot to group

  1. Open the group in Telegram
  2. Tap the group name → “Add Members”
  3. Search for your bot’s username and add it
2

Give bot permissions (optional)

Make your bot an admin if you want it to:
  • Pin/unpin messages
  • Delete messages
  • Read all messages (even without @mentions)
3

Configure group policy

Set group policy to allowlist and specify allowed groups:
Get the group ID with:

Group Options

Commands Support

Telegram supports native bot commands. Set up commands with @BotFather:
OpenClaw will automatically handle these commands if you configure them in your agent.

Threads Support

Telegram supergroups support topics (threads). OpenClaw automatically detects and maintains thread context:

Inline Buttons

Telegram supports interactive inline buttons. OpenClaw can render buttons in responses:
Buttons are rendered when your agent includes action items in responses.

Media Handling

Telegram supports:
  • Photos (up to 10MB)
  • Videos (up to 50MB)
  • Audio files
  • Voice messages
  • Documents (up to 50MB)
  • Stickers
  • GIFs
OpenClaw automatically processes media attachments.

Multi-Account Support

You can run multiple Telegram bots:
Verify both are running:

Troubleshooting

Check that:
  • Bot token is correct
  • Your user ID is in allowFrom (or dmPolicy is pairing or open)
  • Channel is enabled and gateway is running
Verify:
Telegram bots have privacy mode enabled by default, which means they only see:
  • Messages that @mention the bot
  • Messages that are replies to the bot
  • Commands (messages starting with /)
To disable privacy mode:
  1. Chat with @BotFather
  2. Send /setprivacy
  3. Select your bot
  4. Choose “Disable”
Alternatively, make your bot a group admin.
Double-check your bot token. It should look like:
Test it manually:
If this returns an error, the token is invalid. Get a new token from @BotFather with /token.
Ensure dmPolicy is set to "pairing":
Approve users with:
Username resolution requires a valid bot token. Ensure:
  • Token is configured correctly
  • Bot has been started at least once
  • Username is spelled correctly (including @)
Fallback to numeric user ID if resolution fails.

Security Considerations

  • Keep your bot token secret - it gives full access to your bot
  • Use environment variables instead of committing tokens to version control
  • Use allowlist mode for production bots with known users
  • Disable inline buttons if you don’t need them to reduce attack surface
  • Rate limit is handled by Telegram (30 messages/second to different chats)

Next Steps

Pairing Guide

Learn about pairing codes and approvals

Discord Setup

Set up Discord as another channel

Configuration Reference

Full configuration options

Commands

Manage channels with the CLI