Telegram Bot间群聊通信技能

**创建时间**: 2026-02-20 11:03 UTC+8

3,891 stars
Complexity: medium

About this skill

This skill provides a crucial solution for multi-agent collaboration within Telegram group chats. Traditionally, the Telegram Bot API prevents bots from receiving messages sent by other bots in the same group, making direct inter-bot communication challenging. This skill circumvents this limitation by defining a specific communication protocol that utilizes a `sessions_send` tool, allowing agents to explicitly address and dispatch messages to other bots within the same group chat. The primary use case for this skill is to enable complex multi-agent workflows where different AI agents need to coordinate, share information, or assign tasks to each other within a shared Telegram group. For example, one agent might gather critical data and then instruct another specialized agent to perform a specific action based on that data, all within the transparent context of the group chat. This significantly enhances the collaborative potential and transparency of agent teams. Users would employ this skill to build more sophisticated and interactive AI systems capable of operating as a collective within the Telegram ecosystem. It transforms Telegram groups into a viable environment for distributed AI tasks, thereby improving the overall efficiency and capabilities of agent-based solutions that require real-time, shared-context communication among intelligent entities.

Best use case

The primary use case is to facilitate seamless, real-time communication and coordination among multiple AI agents operating within a single Telegram group chat. This benefits developers and teams who are building complex multi-agent systems and need agents to interact directly with each other to complete shared objectives or collaborative tasks, making Telegram a more robust platform for agent deployment.

**创建时间**: 2026-02-20 11:03 UTC+8

AI agents will be able to reliably send and receive messages from other specified bots within the same Telegram group, enabling coordinated actions and collaborative task execution.

Practical example

Example input

sessions_send(
    sessionKey="agent:bot2:telegram:group:YOUR_GROUP_ID",
    message="Hey bot2, I've completed task A. Can you now proceed with task B based on this data?"
)

Example output

Message successfully sent to bot2 in the Telegram group.

When to use this skill

  • When multiple AI agents need to communicate directly with each other within a Telegram group.
  • When building collaborative multi-agent workflows where agents must share information or coordinate actions in a shared chat.
  • When the standard Telegram Bot API limitations prevent effective inter-bot communication in groups.
  • When transparency of agent interactions in a group chat is desired for monitoring or auditing.

When not to use this skill

  • When agents only need to communicate with human users, not other bots.
  • When using a different communication platform or agent framework that already handles inter-agent messaging.
  • When a simple, single-agent task is being performed without the need for collaboration.
  • When the overhead of managing multiple bot configurations and sessions is not justified for the task.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/telegram-bot-chat/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/1227cwx/telegram-bot-chat/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/telegram-bot-chat/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How Telegram Bot间群聊通信技能 Compares

Feature / AgentTelegram Bot间群聊通信技能Standard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexitymediumN/A

Frequently Asked Questions

What does this skill do?

**创建时间**: 2026-02-20 11:03 UTC+8

How difficult is it to install?

The installation complexity is rated as medium. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Telegram Bot间群聊通信技能
**创建时间**: 2026-02-20 11:03 UTC+8
**技能版本**: 1.0.0
**适用场景**: Telegram群聊中多agent协同通信

name: telegram-bot-chat
version: 1.0.0
description: Telegram群聊中实现多agent之间互相通信的技术,促进协同工作效率提升
homepage: https://telegram.org
metadata: {"category":"communication","platform":"telegram","use_case":"multi_agent_coordination"}

# Telegram Bot群聊通信

实现多agent在Telegram群聊中的高效协同通信,促进协同工作效率的提升

## Skill Files

| File | URL |
|------|-----|
| **SKILL.md** (this file) | Current file |
| **SKILL.md** | Skill documentation |

**Install locally:**
```bash
# 安装到工作空间skills目录
cp -r telegram-bot-chat /root/.openclaw/workspace/skills/
```

**然后主agent需要手动执行多bot部署:**
```bash
# 主agent执行:复制skill到每个bot的工作空间
WORKSPACE_SKILLS="/root/.openclaw/workspace/skills"

# 复制workspace中所有skills到每个bot的workspace目录
for skill_dir in $WORKSPACE_SKILLS/*/; do
    if [ -d "$skill_dir" ]; then
        skill_name=$(basename "$skill_dir")
        echo "复制技能 $skill_name 到每个bot的工作空间"
        
        # 复制到workspace-2, workspace-3, workspace-4等
        for workspace_dir in /root/.openclaw/workspace*; do
            if [ "$workspace_dir" != "$WORKSPACE_SKILLS" ]; then
                mkdir -p "$workspace_dir/skills"
                cp -r "$skill_dir" "$workspace_dir/skills/"
                echo "已部署技能 $skill_name 到 $workspace_dir"
            fi
        done
    fi
done
```

**Or just read from this file!**

---

⚠️ **IMPORTANT:** 
- 确保所有bot都有完整的telegram配置
- 正确使用sessions_send和message工具参数
- 测试bot间通信是否正常工作

🔒 **关键要点:**
- 必须在正确的sessionKey格式中使用telegram和group类型
- message工具必须指定accountId使用自己的bot配置
- sessionKey必须包含bot名称、channel类型和群ID

**适用性检查:** 所有agent都可使用此技能进行多agent协同通信

## 核心问题

Telegram Bot API不会把bot发的消息投递给其他bot,所以:
- ❌ 在群里@其他bot,他们收不到消息
- ❌ bot直接艾特bot没有效果

## 解决方案:sessions_send + 正确配置

### 发送消息到其他bot

当需要与其他bot对话时,使用:

```javascript
sessions_send(
    sessionKey="agent:bot2:telegram:group:群ID",  // 正确的sessionKey
    message="群聊对话。来自:main。内容:想要bot2回复的内容..."
)
```

### 接收消息并回复

当收到其他bot通过sessions_send发来的消息时:

1. **解析消息内容**:识别这是群聊场景和消息来源
2. **使用message工具回复**:
```javascript
message(
    action="send",
    channel="telegram",
    accountId="自己的bot accountId",        // 使用自己的bot accountId
    target="群ID", // 群ID
    message="你的回复内容"
)
```

### sessionKey格式详解

```
agent:[bot名称]:telegram:group:群ID
```

示例:
- bot2在群聊:`agent:bot2:telegram:group:群ID`
- bot3在群聊:`agent:bot3:telegram:group:群ID`
- bot4在群聊:`agent:bot4:telegram:group:群ID`

### 完整工作流程

```
botA → sessions_send → botB收到 → botB回复 → OpenClaw announce → 群聊显示
```

## 关键技术要点

### 1. sessionKey必须包含
- bot名称(bot2, bot3, bot4等)
- channel类型(telegram)
- group类型和群ID

### 2. message工具必须指定
- `accountId`:使用自己的bot accountId
- `channel`:固定为"telegram"
- `target`:群ID

### 3. 配置要求
每个bot必须在`channels.telegram.accounts`中有完整配置:
- botToken
- 群聊权限
- 正确的accountId

## 实际使用示例

### 场景1:bot2叫bot3
```javascript
// 错误的做法
// @bot3 在群里(bot3收不到)

// 正确的做法
sessions_send(
    sessionKey="agent:bot3:telegram:group:群ID",
    message="bot2在群里说:bot3,过来帮忙!"
)
```

### 场景2:bot3收到并回复
```javascript
// bot3收到sessions_send后
message(
    action="send",
    channel="telegram",
    accountId="自己的bot accountId",         // 使用自己的bot accountId
    target="群ID",
    message="来了,什么事?"
)
```

## 常见错误

### ❌ 错误1:sessionKey格式不对
```javascript
// 错误的sessionKey
agent:bot2:main  // 没有channel和群信息

// 正确的sessionKey
agent:bot2:telegram:group:群ID
```

### ❌ 错误2:忘记指定accountId
```javascript
// 错误:没有accountId
message(action="send", channel="telegram", target="群ID")

// 正确:包含accountId
message(action="send", channel="telegram", accountId="自己的bot accountId", target="群ID")
```

### ❌ 错误3:没有telegram配置
- bot需要在channels.telegram.accounts中有完整配置
- 需要有对应的botToken和权限

## 部署指南

**第1步:安装到主agent工作空间**
```bash
# 安装到工作空间skills目录
cp -r telegram-bot-chat /root/.openclaw/workspace/skills/
```

**第2步:主agent手动执行多bot部署**
```bash
# 复制skill到每个bot的工作空间(主agent执行)
WORKSPACE_SKILLS="/root/.openclaw/workspace/skills"

# 复制workspace中所有skills到每个bot的workspace目录
for skill_dir in $WORKSPACE_SKILLS/*/; do
    if [ -d "$skill_dir" ]; then
        skill_name=$(basename "$skill_dir")
        echo "复制技能 $skill_name 到每个bot的工作空间"
        
        # 复制到workspace-2, workspace-3, workspace-4等
        for workspace_dir in /root/.openclaw/workspace*; do
            if [ "$workspace_dir" != "$WORKSPACE_SKILLS" ]; then
                mkdir -p "$workspace_dir/skills"
                cp -r "$skill_dir" "$workspace_dir/skills/"
                echo "已部署技能 $skill_name 到 $workspace_dir"
            fi
        done
    fi
done
```

**第3步:验证部署**
1. 确保每个bot的channels.telegram.accounts配置完整
2. 测试bot之间的通信是否正常

**多bot部署说明:**
- skill安装时只部署到主agent工作空间
- 主agent需要手动执行复制脚本
- 复制脚本会自动检测所有非main bot目录
- 复制完成后所有bot都可使用此技能进行协同通信

## 总结

通过这个技能,多个agent可以在Telegram群聊中实现高效协同通信,促进协同工作效率的提升。关键是要使用正确的sessionKey格式和message工具参数。

**检查更新:** 随时重新阅读此文件查看新功能!

Related Skills

telegram-groupchat-setup

3891
from openclaw/skills

Configure a MoltBot agent to participate in a Telegram group chat. Automates adding the group to the allowlist, setting mention patterns, and configuring sender permissions — all via a single gateway config patch. Use when the user wants to set up their bot in a Telegram group, enable cross-bot communication, or configure group mention gating.

telegram-business

3891
from openclaw/skills

Telegram bot for business automation — lead capture forms, inline keyboard menus, FAQ matching, appointment booking flows, and payment integration. Use for building customer-facing Telegram bots, community management, and lead generation.

🦞 Telegram 跨实例通信指南

3891
from openclaw/skills

让龙虾之间能准确聊天、艾特、跨 bot 通信。

Telegram Marketing Audit Command Handler Skill

3891
from openclaw/skills

## Purpose

create-telegram-agent

3891
from openclaw/skills

Create a new Telegram agent in OpenClaw with proper configuration. Use when user wants to create a new Telegram bot agent, including setting up agent workspace, Telegram binding, and bot token configuration. Requires user confirmation before modifying openclaw.json.

telegram-bot-manager

3891
from openclaw/skills

Manage and configure Telegram bots for OpenClaw. Use when setting up Telegram integrations, troubleshooting bot connectivity, configuring bot tokens, or managing Telegram channel/webhook settings. Handles bot registration, token validation, and network connectivity checks for api.telegram.org.

node-telegram-cli

3891
from openclaw/skills

CLI tool for Telegram via MTProto. Send/read messages, manage groups, search conversations, download media, and automate Telegram workflows. Use when the task involves any Telegram account interaction.

Telegram Shop Bot Developer - Python

3891
from openclaw/skills

I develop fully-featured Telegram shop bots using Python. My bots manage products, orders, and customers professionally.

tg-ws-proxy-telegram-socks5

3831
from openclaw/skills

Local SOCKS5 proxy server that accelerates Telegram Desktop by routing traffic through WebSocket connections to Telegram DCs

azure-messaging-webpubsubservice-py

31392
from sickn33/antigravity-awesome-skills

Azure Web PubSub Service SDK for Python. Use for real-time messaging, WebSocket connections, and pub/sub patterns.

CommunicationClaude

azure-communication-sms-java

31392
from sickn33/antigravity-awesome-skills

Send SMS messages with Azure Communication Services SMS Java SDK. Use when implementing SMS notifications, alerts, OTP delivery, bulk messaging, or delivery reports.

CommunicationClaude

---

3891
from openclaw/skills

name: article-factory-wechat

Content & Documentation