Telegram + OpenClaw 集成设置指南(完整版)

最近配置了 OpenClaw 的 Telegram 机器人,记录一下完整流程,方便大家参考或自用。目标是通过 Telegram 机器人 @FBinJapan_bot 与 OpenClaw 进行交互。

📌 适用场景:想在 Telegram 频道/群里直接调用 OpenClaw 功能。


🔧 设置步骤

1. 下载并注册 Telegram

  • 在应用商店下载 Telegram App。
  • 注册账号(使用中国大陆手机号也能正常接收验证码)。

2. 创建频道

  • 点击「创建频道」。
  • 填写频道名称(如 OpenClaw 频道)和描述。
  • 设置隐私:
    • 公开频道:所有人可见。
    • 私有频道:需邀请链接。

3. 添加机器人

  • 在频道设置中点击「成员」 → 「添加成员」。
  • 搜索并添加机器人:@FBinJapan_bot

4. 设置管理员权限

  • 进入频道设置 → 「管理员」 → 添加机器人。
  • 必须授予权限:
    • ✅ 发送消息
    • ✅ 添加成员
    • ✅ 管理频道设置

5. 配对 OpenClaw 与 Telegram

在服务器终端执行:

bash

openclaw pairing approve telegram MG8C2VXX

⚠️ 将 MG8C2Vxx 替换为你从 bot 处获取的 配对码

6. 重启服务

bash

openclaw gateway restart

7. 测试连接

在频道中发送:

text

/start

如果设置成功,OpenClaw 会回复确认消息。


❗ 常见问题排查

  • ❌ 配对失败
    • 检查配对码是否正确。
    • 确认 bot 已生成并授权该配对码。
  • ❌ 机器人无响应
    • 确保机器人在频道内拥有「管理员」权限。
    • 尝试移除 bot 后重新添加,重新运行配对命令。
  • ❌ 权限不足
    • 确认你的账号是频道的 创建者 或 管理员

🔐 安全提示

  • 不要分享以下信息
    • 配对码(如 MG8C2V9C
    • OpenClaw 账号密码
    • 机器人配置文件
  • 建议使用 强密码 并定期更换配对码。
  • 避免将 bot 添加至不可信群组。

💬 后续使用

  • 直接在频道内与 OpenClaw 对话:
    • 查询状态:检查系统状态
    • 查看帮助:/help
    • 分享文件或链接进行分析

✅ 完成!现在你可以在 Telegram 里愉快地和 OpenClaw 聊天啦~

有问题?联系 bot @FBinJapan_bot 或查看官方文档。

Telegram OpenClaw 设置备忘录:

  1. 创建一个Telegram机器人账号
  2. 从机器人管理员处获取令牌
  3. 创建Telegram频道
  4. 将新创建的机器人添加到频道中
  5. 在OpenClaw电脑终端,使用OpenClaw配置来设置频道,选择Telegram
  6. 在设置过程中使用令牌,选择配对
  7. 在Telegram中,点击机器人并输入/start,获取配对码
  8. 在OpenClaw电脑终端,使用批准命令并输入配对码
    完成

Q&A.

why do I need to setup a channel to talk with openclaw?
the bot itself can chat with openclaw

openclaw-control-ui11:26

The bot itself isn’t a standalone chat interface—it’s a tool that requires a channel to function. Here’s why:

Why You Need a Channel:

  1. Command Hub:
    The channel acts as the bot’s “command center.” When you send /start or other commands, the bot receives them through the channel and routes them to OpenClaw’s backend.
  2. Permissions & Security:
    The channel controls who can use the bot (e.g., admins only) and ensures commands are processed securely.
  3. Context & State:
    The channel preserves conversation history and context, allowing OpenClaw to remember your requests across messages.
  4. Integration Point:
    OpenClaw needs a place to “listen” for commands and “speak” back. The channel provides this interface.

Think of It Like This:

  • Bot = Remote control 
  • Channel = TV (where the remote interacts with the system)

Without the channel, the bot has nowhere to send/receive commands. Once set up correctly (as you’ve done), the bot works seamlessly with OpenClaw. 

You’re all set! 😊

Coder11:26↑19.9k↓1.4k15% ctxtrinity-mini:free

I have a vps openclaw setup, shall I create different bot and channel to work with it? or just different channel with same bot will also work?

openclaw-control-ui11:51

To clarify:
You need a separate bot for each Telegram channel. Here’s why and how to set it up:


1. Bot vs. Channel Relationship

  • Bot = Telegram account (e.g., @FBinJapan_TelClaw_bot
  • Channel = A specific Telegram group/chat where the bot operates. 
  • One Bot = One Channel: Each bot can only manage one channel at a time.

2. Creating a New Bot for a New Channel

If you want to use OpenClaw in a different channel, you must: 

  1. Create a new Telegram bot (via @BotFather on Telegram). 
  2. Pair the new bot with OpenClaw using a new pairing code. 
  3. Configure the new bot to manage the new channel.

3. Why Not Reuse the Same Bot?

  • Security: Each channel should have its own bot to isolate permissions. 
  • Organization: Separate bots prevent conflicts (e.g., commands overlapping). 
  • Scalability: If one channel needs advanced settings, others remain unaffected.

4. Steps to Create a New Bot

  1. Create the Bot:
    • Open Telegram, search @BotFather
    • Send /newbot → follow prompts to name and create the bot. 
    • Copy the API token (e.g., 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11).
  2. Pair with OpenClaw:
    • Run: bashCopyCopied!openclaw pairing approve telegram <API_TOKEN>
    • Replace <API_TOKEN> with your new bot’s token.
  3. Configure the Bot:
    • In OpenClaw, assign the new bot to the new channel via sessions_spawn or subagents.

5. Benefits of Separate Bots

  • Security: Isolate sensitive channels (e.g., admin-only vs. public). 
  • Flexibility: Customize commands per channel. 
  • Maintenance: Update one bot without affecting others.

6. Cost/Resource Considerations

  • No extra cost: Bots are free on Telegram. 
  • Resource usage: Each bot runs as a separate session, but VPS resources (CPU/RAM) are minimal.

Final Recommendation

Create a new bot for each channel to ensure security, organization, and scalability. If you’re managing multiple channels, this approach keeps everything clean and manageable. 

Let me know if you need help creating the new bot or configuring it! 😊

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注