OpenClaw LogoOpenClaw with ArmorIQ
Configuration

Telegram Setup

Configure Telegram bot for OpenClaw

Telegram Bot Setup

Set up a Telegram bot to interact with OpenClaw via Telegram.

Create Telegram Bot

  1. Open Telegram and message @BotFather
  2. Send /newbot
  3. Set bot name (e.g., "My OpenClaw Bot")
  4. Set username (e.g., "my_openclaw_bot")
  5. Copy the bot token: 1234567890:ABCdef...

Add Token to Configuration

Option 1: Store in credentials file (Recommended)

mkdir -p ~/.openclaw/credentials
echo "YOUR_BOT_TOKEN" > ~/.openclaw/credentials/telegram-token.txt

Option 2: Add to config file

Update ~/.openclaw/openclaw.json:

{
  "channels": {
    "telegram": {
      "enabled": true,
      "dmPolicy": "allowlist",
      "botToken": "1234567890:ABCdef...",
      "allowFrom": ["YOUR_USER_ID"]
    }
  },
  "plugins": {
    "entries": {
      "telegram": {
        "enabled": true
      }
    }
  }
}

Use "allowlist" policy in production. Never use "open" with ["*"] - this allows anyone to control your agent!

Get Your Telegram User ID

  1. Message @userinfobot
  2. Send /start
  3. Bot replies with your user ID (e.g., 6193457473)
  1. Start gateway: cd ~/openclaw-armoriq && pnpm dev gateway
  2. Send any message to your bot
  3. Check logs:
    grep senderId /tmp/openclaw/openclaw-*.log
    # Look for: senderId=6193457473

Add your user ID to the config:

{
  "channels": {
    "telegram": {
      "allowFrom": ["6193457473"]
    }
  },
  "plugins": {
    "entries": {
      "armoriq": {
        "policyUpdateAllowList": [
          "6193457473",
          "@your_username",
          "telegram:6193457473"
        ]
      }
    }
  }
}

Configuration Options

FieldDescriptionDefault
enabledEnable Telegram channeltrue
dmPolicyAccess control: allowlist, pairing, open, disabledpairing
botTokenBot token from BotFather-
tokenFilePath to file containing token~/.openclaw/credentials/telegram-token.txt
allowFromUser IDs allowed to interact[]
groupPolicyGroup chat policy: allowlist, open, disabledallowlist
streamModeResponse streaming: partial, full, offpartial

Security Best Practices

Use Allowlist Policy

SAFE - Only specific users can interact:

{
  "channels": {
    "telegram": {
      "dmPolicy": "allowlist",
      "allowFrom": ["6193457473", "1234567890"]
    }
  }
}

DANGEROUS - Anyone who finds your bot can control it:

{
  "channels": {
    "telegram": {
      "dmPolicy": "open",
      "allowFrom": ["*"]  // NEVER DO THIS IN PRODUCTION!
    }
  }
}

Token Storage

Best practice: Store token in credentials file

~/.openclaw/credentials/telegram-token.txt

Alternative: Use environment variable

export TELEGRAM_BOT_TOKEN="1234567890:ABCdef..."

Then reference in config:

{
  "channels": {
    "telegram": {
      "botToken": "${TELEGRAM_BOT_TOKEN}"
    }
  }
}

Verify Setup

Check Configuration

# Validate JSON syntax
cat ~/.openclaw/openclaw.json | jq '.channels.telegram'

Test Bot

  1. Start gateway:

    cd /path/to/aiq-openclaw
    node scripts/run-node.mjs gateway
  2. Expected log output:

    [telegram] [default] starting provider (@your_bot)
  3. Send test message:

    • Find your bot in Telegram
    • Click "Start"
    • Send: Hello!
    • Bot should respond

Troubleshooting

Bot doesn't respond

Check:

  • Bot token is correct (no extra spaces)
  • "enabled": true for telegram channel
  • Your user ID is in allowFrom list
  • Gateway is running: look for [telegram] starting provider

Solution:

# Restart gateway
# Check logs
tail -f /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log | grep telegram

Token validation error

Error: Telegram bot token invalid

Fix:

  1. Go to @BotFather
  2. Send /mybots → Select your bot → "API Token"
  3. Copy the fresh token
  4. Update config or credentials file

Pairing required

If using "pairing" mode, check terminal for pairing code:

[telegram] Pairing required from 6193457473
[telegram] Pairing code: ABC123

Send the code to your bot to complete pairing.


Next Steps

Telegram configured!

Configure additional channels:

On this page