在群聊中利用sessionKey和message参数实现多个Telegram Bot高效协同,提升多Agent协作效率。
Telegram Bot间群聊通信技能是一项面向实际任务的技能,主要用于创建时间 : 2026-02-20 11:03 UTC+8;技能版本 : 1.0.0;
description: Telegram群聊中实现多agent之间互相通信的技术,促进协同工作效率提升;homepage: htt。它将相关步骤、工具调用和结果整理方式集中到统一流程中,帮助使用者更快完成目标并减少重复操作。从功能定位来看,该技能强调把分散的操作要求整理成清晰、可复用的处理流程,使用户能够围绕既定目标快速准备输入、选择执行方式并获得结构化结果。实际使用前应先确认任务范围、数据来源、运行环境、必要权限和关键参数,再依据技能说明逐步执行;
若输入条件不完整,应先补齐信息或采用保守配置,避免因错误假设导致结果偏离需求。执行过程中需要关注工具调用是否成功、接口或依赖是否可用、输出格式是否符合预期,并对异常提示、缺失字段和边界情况进行处理;涉及批量任务时,还应保存进度,避免中断后重复操作。该技能适合用于一次性任务,也可以接入自动化工作流,与其他技能或上层代理配合完成更完整的业务链路;在组合使用时,应明确每一步的输入输出关系,并避免不同步骤之间出现参数冲突。
创建时间: 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"}
实现多agent在Telegram群聊中的高效协同通信,促进协同工作效率的提升
| File | URL |
|---|---|
| SKILL.md (this file) | Current file |
| SKILL.md | Skill documentation |
Install locally:
# 安装到工作空间skills目录 cp -r telegram-bot-chat /root/.openclaw/workspace/skills/
然后主agent需要手动执行多bot部署:
# 主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:
🔒 关键要点:
适用性检查: 所有agent都可使用此技能进行多agent协同通信
Telegram Bot API不会把bot发的消息投递给其他bot,所以:
当需要与其他bot对话时,使用:
sessions_send(
sessionKey="agent:bot2:telegram:group:群ID", // 正确的sessionKey
message="群聊对话。来自:main。内容:想要bot2回复的内容..."
)
当收到其他bot通过sessions_send发来的消息时:
message(
action="send",
channel="telegram",
accountId="自己的bot accountId", // 使用自己的bot accountId
target="群ID", // 群ID
message="你的回复内容"
)
agent:[bot名称]:telegram:group:群ID
示例:
agent:bot2:telegram:group:群IDagent:bot3:telegram:group:群IDagent:bot4:telegram:group:群IDbotA → sessions_send → botB收到 → botB回复 → OpenClaw announce → 群聊显示
accountId:使用自己的bot accountIdchannel:固定为"telegram"target:群ID每个bot必须在channels.telegram.accounts中有完整配置:
// 错误的做法
// @bot3 在群里(bot3收不到)
// 正确的做法
sessions_send(
sessionKey="agent:bot3:telegram:group:群ID",
message="bot2在群里说:bot3,过来帮忙!"
)
// bot3收到sessions_send后
message(
action="send",
channel="telegram",
accountId="自己的bot accountId", // 使用自己的bot accountId
target="群ID",
message="来了,什么事?"
)
// 错误的sessionKey agent:bot2:main // 没有channel和群信息 // 正确的sessionKey agent:bot2:telegram:group:群ID
// 错误:没有accountId message(action="send", channel="telegram", target="群ID") // 正确:包含accountId message(action="send", channel="telegram", accountId="自己的bot accountId", target="群ID")
第1步:安装到主agent工作空间
# 安装到工作空间skills目录 cp -r telegram-bot-chat /root/.openclaw/workspace/skills/
第2步:主agent手动执行多bot部署
# 复制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步:验证部署
多bot部署说明:
通过这个技能,多个agent可以在Telegram群聊中实现高效协同通信,促进协同工作效率的提升。关键是要使用正确的sessionKey格式和message工具参数。
检查更新: 随时重新阅读此文件查看新功能!
相关专题
热门下载
相关下载
精品课程
共6课时 | 54.8万人学习
共89课时 | 134.5万人学习
共49课时 | 82.8万人学习
最新文章