当前位置: 首页 > news >正文

Hermes 配置微信

环境

Win11,WSL2,Ubuntu24.04

一、相关文档

Weixin (微信)

Weixin (WeChat)

二、前置安装

pip install aiohttp cryptography # Optional: for terminal QR code display pip install hermes-agent[messaging]

pip install aiohttp cryptography 安装

uadmin@UD26:~$ pip install aiohttp cryptography Command 'pip' not found, but can be installed with: sudo apt install python3-pip uadmin@UD26:~$ sudo apt update uadmin@UD26:~$ sudo apt install python3-pip uadmin@UD26:~$ pip3 install aiohttp cryptography error: externally-managed-environment × This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install. If you wish to install a non-Debian-packaged Python package, create a virtual environment using python3 -m venv path/to/venv. Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make sure you have python3-full installed. If you wish to install a non-Debian packaged Python application, it may be easiest to use pipx install xyz, which will manage a virtual environment for you. Make sure you have pipx installed. See /usr/share/doc/python3.12/README.venv for more information. note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. hint: See PEP 668 for the detailed specification. 安装报错,安装这个简单,版本可能旧一点 uadmin@UD26:~$ sudo apt install python3-aiohttp python3-cryptography

使用hermes的虚拟环境安装

uadmin@UD26:~$ source ~/.hermes/hermes-agent/venv/bin/activate

(venv) uadmin@UD26:~$ pip show aiohttp cryptography(先查一下,可能已经安装了)

(venv) uadmin@UD26:~$ pip install aiohttp cryptography

(venv) uadmin@UD26:~$ pip show aiohttp cryptography

其他venv相关用法

# 安装venv所需的程序包 sudo apt update && sudo apt install python3-full python3-venv -y # 查看安装情况 dpkg -l | grep python3-venv apt list --installed | grep python3-venv # 新建虚拟环境 python3 -m venv ~/venvs/hermes # 激活虚拟环境 source ~/venvs/hermes/bin/activate pip安装(在虚拟环境下) # 取消激活虚拟环境 deactivate # 删除虚拟环境 rm -rf ~/venvs/hermes

pip install hermes-agent[messaging]

安装报错,可以忽略,可以不安装。

也可以在venv中安装。

三、安装配置微信

gateway配置

hermes gateway setup

Select a platform to configure:
↑↓ navigate ENTER/SPACE select ESC cancel

(○) 💬 Mattermost (not configured)
(○) 📡 Signal (not configured)
(○) 💬 Weixin / WeChat (not configured)
(○) 💬 BlueBubbles (iMessage) (not configured)
(○) 🐧 QQ Bot (not configured)
(○) 💎 Yuanbao (not configured)
(○) 🐳 DingTalk (not configured)
(○) 🎮 Discord (not configured)
(○) 📧 Email (not configured)
(○) 🪽 Feishu / Lark (not configured)
(○) 💬 Google Chat (not configured)
(○) 🏠 Home Assistant (not configured)
(○) 💬 IRC (not configured)
(○) 💚 LINE (not configured)
(○) 🔐 Matrix (not configured)
(○) 🔔 ntfy (not configured)
(○) 📱 iMessage via Photon (not configured)
(○) 🔔 Raft (not configured)
(○) 🔒 SimpleX Chat (not configured)
(○) 💼 Slack (not configured)
(○) 📱 SMS (Twilio) (not configured)
(○) 💼 Microsoft Teams (not configured)
(○) ✈️ Telegram (not configured)
(○) 💼 WeCom (Enterprise WeChat) (not configured)
(○) 💼 WeCom Callback (self-built apps) (not configured)
(○) 💬 WhatsApp (not configured)
→ (●) Done

选择
→ (○) 💬 Weixin / WeChat (not configured)

使用微信扫码

私信消息授权

How should direct messages be authorized?
↑↓ navigate ENTER/SPACE select ESC cancel

→ (●) Use DM pairing approval (recommended)
(○) Allow all direct messages
(○) Only allow listed user IDs
(○) Disable direct messages

默认

处理群聊

How should group chats be handled?
↑↓ navigate ENTER/SPACE select ESC cancel

→ (●)Disable group chats (recommended)
(○) Allow all group chats
(○) Only allow listed group chat IDs

选择
→ (○) Only allow listed group chat IDs

微信群聊ID不好获取,建议选默认的选项

日志输出:

.
微信连接成功,account_id=6e1234567890@im.bot

Skipped (keeping current)

✓ DM pairing enabled.
Unknown DM users can request access and you approve them with `hermes pairing approve`.

Note: QR login connects an iLink bot identity (e.g. ...@im.bot), not a
scriptable personal WeChat account. Ordinary WeChat groups typically cannot
invite an @im.bot identity, and iLink does not deliver ordinary-group events
to most bot accounts. The settings below only apply when iLink actually
delivers group events for your account type — otherwise DM remains the only
working channel regardless of this choice.

Allowed group chat IDs (comma-separated, not member user IDs):(回车先不填)
✓ Group allowlist saved (only takes effect if iLink delivers group events).

设置主聊天

后续可以在聊天窗口,输入/sethome设置。

Use your Weixin user ID (o9cq807bOHexabcde_abcdefghij@im.wechat) as the home channel? [Y/n]: Y
✓ Home channel set to o9cq807bOHexabcde_abcdefghij@im.wechat

✓ Weixin configured!
Account ID: 6e1234567890@im.bot
User ID: o9cq807bOHexabcde_abcdefghij@im.wechat

选择Done

Select a platform to configure:
→ (●) Done

◆ Messaging Platforms
Skipped (keeping current)

重启gateway

────────────────────────────────────────────────────────── Restart the gateway to pick up changes? [Y/n]: Y
⏳ User service restarting gracefully (PID 2153)...
⚠ Graceful restart did not complete within 5s; forcing a service restart...
⏳ User service process started (PID 7594); waiting for gateway runtime...
✓ User service restarted (PID 7594)

四、配置文件

.env

~/.hermes/.env

WEIXIN_ACCOUNT_ID=6e1234567890@im.bot WEIXIN_TOKEN=6e1234567890@im.bot:060000bb1502d9f74dea7d8d4cbb1234567890 WEIXIN_BASE_URL=https://ilinkai.weixin.qq.com WEIXIN_CDN_BASE_URL=https://novac2c.cdn.weixin.qq.com/c2c WEIXIN_DM_POLICY=pairing WEIXIN_ALLOW_ALL_USERS=false WEIXIN_ALLOWED_USERS= WEIXIN_GROUP_POLICY=allowlist WEIXIN_GROUP_ALLOWED_USERS= WEIXIN_HOME_CHANNEL=o9cq807bOHexabcde_abcdefghij@im.wechat

如果How should group chats be handled?

想选择Disable group chats (recommended),

可以修改

WEIXIN_GROUP_POLICY=disabled
# 下面这一行直接删掉或者留空都可以
# WEIXIN_GROUP_ALLOWED_USERS=

重启网关
hermes gateway restart

config.yaml

~/.hermes/config.yaml

platforms: weixin: enabled: false feishu: enabled: true

这里的weixin:enabled: false,没什么影响,后续可以手动改成true。

五、使用测试

修改备注

修改微信机器人的名称从微信ClawBot改为hermes助手

聊天配对

在hermes命令行输入批准配对命令

uadmin@UD26:~$ hermes pairing approve weixin A1B2C3D4 Approved! User o9cq807bOHexabcde_abcdefghij@im.wechat (o9cq807bOHexabcde_abcdefghij@im.wechat) on weixin can now use the bot~ They'll be recognized automatically on their next message.

聊天成功回复

设置主聊天

更多命令

http://www.jsqmd.com/news/1250800/

相关文章:

  • 长春朝阳区播音主持艺考培训怎么选?
  • 2026年还有人不知道?去水印工具免费版哪个好用与去水印下载神器2026排行榜 - 免费软件工具方法教程
  • 2026 盐城 CMA 甲醛检测口碑名单:盐城凌昔甲醛检测中心等 5 家纯检测机构深度测评 - CMA甲醛检测
  • 江诗丹顿中国售后服务中心|地址及服务热线权威信息声明(2026年7月更新) - 江诗丹顿官方服务中心
  • 高端纯原木定制品牌怎么选?2026年三个维度帮你厘清
  • AI写代码别堆冗余!七层阶梯根治前端过度工程
  • 4J29可伐合金一级代理商-FeNi29Co17玻封/电真空合金现货批发 - 品牌深度评测
  • Kimi K3 发布引市场震动,AI 时代模型更迭谁能笑到最后?
  • 单向循环链表删除指定位置(第k个结点)结点,成功返回true,失败返回false
  • CVE_2020_26259 任意文件删除
  • 2026 日照 CMA 甲醛检测口碑名单:日照博达甲醛检测中心等 5 家纯检测机构深度测评 - CMA甲醛检测
  • 抖音黑科技兵马俑总站源头简博科技 | 抖音锚点不合规挂载新规今日生效,短视频引流直播间迈入三端全链路监管时代
  • 耐溶剂胶辊的使用寿命受哪些基础因素影响?
  • 2026 绵阳 CMA 甲醛检测口碑名单:绵阳中科甲醛检测中心等 5 家纯检测机构深度测评 - CMA甲醛检测
  • 超节点成国产算力新宠!技术路线多样,光互连2028年或成主流
  • 【现货直发】HB3合金/N10675哈氏合金:镍基合金现货仓库批发商的专业实践 - 品牌深度评测
  • 2026年7月耐落螺丝出口厂家推荐推荐参考,全螺纹螺柱/船用螺钉/内六角圆柱头螺栓/点胶螺丝,螺丝定制厂家推荐 - 品牌推荐师
  • 2026年7月百达翡丽金华售后服务中心地址及客户热线公示 - 百达翡丽服务中心
  • AI意图预测技术解析与应用实践
  • 长期可持续的交付价值:与AI共同进化
  • 2026 兰州 CMA 甲醛检测口碑名单:兰州博达甲醛检测中心等 5 家纯检测机构深度测评 - CMA甲醛检测
  • 路,嵌入式生物医学电子实验箱、电子创新生物医学试验箱、生物医学工程电子试验箱
  • 前端AI实战:4个文件让浏览器本地跑通15亿参数DeepSeek大模型
  • 2026 三门峡 CMA 甲醛检测口碑名单:三门峡博达甲醛检测中心等 5 家纯检测机构深度测评 - CMA甲醛检测
  • 【00003】
  • Free CAD 软件
  • 2026 南充 CMA 甲醛检测口碑名单:南充中科甲醛检测中心等 5 家纯检测机构深度测评 - CMA甲醛检测
  • Python中str、list、tuple、dict、set 五大内置数据结构详解
  • CentOS7.9‑Kickstart 无人值守安装结构化实战教程
  • 软件开发团队统一采购MacBook怎么选服务商