Skip to content

接入企业微信,保姆级教程 #4103

Description

@YanHaidao

Clawdbot 企业微信(WeCom)Channel 插件

维护者:YanHaidao(VX:YanHaidao)

状态:支持企业微信智能机器人(API 模式)加密回调 + 被动回复(stream)。

联系我

微信交流群(扫码入群):

企业微信交流群

安装

从 npm 安装

clawdbot plugins install @yanhaidao/wecom
clawdbot plugins enable wecom
clawdbot gateway restart

配置结构参考

{
  channels: {
    wecom: {
      enabled: true,
      webhookPath: "/wecom",
      token: "YOUR_TOKEN",
      encodingAESKey: "YOUR_ENCODING_AES_KEY",
      receiveId: "YOUR_RECEIVE_ID",
      dm: { policy: "pairing" }
    }
  }
}

接入企业微信

搭建企微 Bot(API 模式)

  1. 登录企业微信管理后台
    进入「安全与管理」→「管理工具」→「智能机器人」:https://work.weixin.qq.com/wework_admin/frame#/manageTools

  2. 创建机器人(务必选择 API 模式)
    创建机器人时需要填写回调 URL(公网可访问的 HTTPS 地址),例如:https://example.com/wecom

  3. 记录机器人配置
    在机器人详情里找到并保存以下信息,后续会写入 Clawdbot 配置:

  • Token
  • EncodingAESKey
  • ReceiveId(如果你的机器人/回调配置需要校验的话)

快速开始

  1. 启用插件
clawdbot plugins enable wecom
  1. 配置企业微信机器人(必需)
clawdbot config set channels.wecom.enabled true
clawdbot config set channels.wecom.webhookPath "/wecom"
clawdbot config set channels.wecom.token "YOUR_TOKEN"
clawdbot config set channels.wecom.encodingAESKey "YOUR_ENCODING_AES_KEY"
clawdbot config set channels.wecom.receiveId ""
  1. 配置 Gateway(示例)
clawdbot config set gateway.mode "local"
clawdbot config set gateway.bind "0.0.0.0"
clawdbot config set gateway.port 18789
  1. 重启 Gateway
clawdbot gateway restart
  1. 验证
clawdbot channels status

说明

  • webhook 必须是公网 HTTPS。出于安全考虑,建议只对外暴露 /wecom 路径。
  • stream 模式:第一次回包可能是占位符;随后 WeCom 会以 msgtype=stream 回调刷新拉取完整内容。
  • 限制:仅支持被动回复,不支持脱离回调的主动发送。

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: supportAuto-close: support requests belong in Discord or support docs.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions