通过 grammY 的 Bot API,支持 DM 和群组。默认长轮询模式,可选 Webhook 模式。
快速设置
# 1. 在 BotFather 创建 bot token
# 打开 Telegram → @BotFather → /newbot → 保存 token{
channels: {
telegram: {
enabled: true,
botToken: "123:abc",
dmPolicy: "pairing",
groups: { "*": { requireMention: true } },
},
},
}# 2. 启动 Gateway 并审批第一个 DM
openclaw gateway
openclaw pairing list telegram
openclaw pairing approve telegram <CODE>注意:Telegram 不使用 openclaw channels login,在配置/env 中设置 token 后启动 Gateway。
环境变量
TELEGRAM_BOT_TOKEN=... # 仅默认账号多账号
{
channels: {
telegram: {
accounts: {
main: { botToken: "token1" },
secondary: { botToken: "token2" },
},
},
},
}Webhook 模式
{
channels: {
telegram: {
mode: "webhook",
webhookUrl: "https://your-domain.com/telegram/webhook",
},
},
}相关
- concepts/channels-overview — Channel 总览
- concepts/pairing — 配对机制