{"id":15039721,"url":"https://github.com/danni-cool/wechatbot-webhook","last_synced_at":"2025-09-25T10:30:19.440Z","repository":{"id":195682942,"uuid":"693433320","full_name":"danni-cool/wechatbot-webhook","owner":"danni-cool","description":"轻量、可部署的微信机器人webhook服务，使用http接口收发微信消息, 用它作为个人通知、AIGC 应用或者 coze、n8n等自动化工作流的消息节点","archived":false,"fork":false,"pushed_at":"2024-12-01T15:56:51.000Z","size":777,"stargazers_count":1759,"open_issues_count":29,"forks_count":289,"subscribers_count":38,"default_branch":"main","last_synced_at":"2025-01-09T08:00:46.917Z","etag":null,"topics":["bot","http-service","webhook","wechat","wechat-bot","wechaty"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danni-cool.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":null},"created_at":"2023-09-19T02:54:52.000Z","updated_at":"2025-01-09T07:49:35.000Z","dependencies_parsed_at":"2024-02-06T12:55:52.492Z","dependency_job_id":"239107fb-df25-49c3-8ef4-a6dd3ca9dcc4","html_url":"https://github.com/danni-cool/wechatbot-webhook","commit_stats":null,"previous_names":["danni-cool/docker-wechat-roombot","danni-cool/docker-wechatbot-webhook","danni-cool/wechatbot-webhook","wechatbotkit/wechatbot-webhook"],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danni-cool%2Fwechatbot-webhook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danni-cool%2Fwechatbot-webhook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danni-cool%2Fwechatbot-webhook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danni-cool%2Fwechatbot-webhook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danni-cool","download_url":"https://codeload.github.com/danni-cool/wechatbot-webhook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234175896,"owners_count":18791470,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","http-service","webhook","wechat","wechat-bot","wechaty"],"created_at":"2024-09-24T20:43:43.823Z","updated_at":"2025-09-25T10:30:19.123Z","avatar_url":"https://github.com/danni-cool.png","language":"JavaScript","readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"./docs/Jietu20240506-220141%402x.jpg\" width=\"500\"/\u003e\n\n![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/danni-cool/wechatbot-webhook/release.yml) ![npm dowloads](https://img.shields.io/npm/dm/wechatbot-webhook?label=npm/downloads)\n ![Docker Pulls](https://img.shields.io/docker/pulls/dannicool/docker-wechatbot-webhook) ![GitHub release (with filter)](https://img.shields.io/github/v/release/danni-cool/wechatbot-webhook)\n\u003ca href=\"https://discord.gg/qBF9VsBdc8\"\u003e\u003cimg src=\"https://img.shields.io/discord/1165844612473172088?logo=Discord\u0026link=https%3A%2F%2Fdiscord.gg%qBF9VsBdc8\" /\u003e\u003c/a\u003e\n\n\n[🚢 Docker 镜像](https://hub.docker.com/r/dannicool/docker-wechatbot-webhook/tags) | [📦 NPM包](https://www.npmjs.com/package/wechatbot-webhook)｜[🔍 FAQ](https://github.com/danni-cool/wechatbot-webhook/issues/72)\n\n一个小小的微信机器人webhook，帮你抹平了很多自己开发的障碍，基于 http 请求，与hooks微信不同，因为基于web api，所以优势在于可以部署到arm架构等设备上\n\u003c/div\u003e\n\n\n## ✨ Features\n\n\u003e [!Caution] \n\u003e 项目目前基于web微信，其本身就有被限制风险，另外大概两天一掉线，除了正常功能修补，不接新的 feature request。 windows 协议正在WIP，近期应该会和大家见面！\n\n| **功能** | web协议 | windows协议 |\n| --- | --- | --- |\n| 目前可用性 | ✅ | ❌ |\n| 代码分支 | main | windows |\n| Docker Tag | latest | windows |\n| **\u003c发送消息\u003e** | ✅ 单条 / 多条 / 群发  | ✅ 单条 / 多条 / 群发 |\n| 发文字 | ✅ | ✅ |\n| 发图片 | ✅ 本地图片 / url图片解析 | ✅ 本地图片 / url图片解析 |\n| 发视频（mp4) | ✅ 本地视频 / url视频解析 |  |\n| 发文件 | ✅ 本地文件 / url文件解析 | ✅ 本地文件 / url文件解析 |\n| **\u003c接收消息\u003e** | |  |\n| 接收文字 | ✅ | ✅ |\n| 接收语音 | ✅ |  |\n| 接收图片 | ✅ |  |\n| 接收视频 | ✅ |  |\n| 接收文件 | ✅ |  |\n| 接收公众号推文链接 | ✅ |  |\n| 接收系统通知 | ✅ 上线通知 / 掉线通知 / 异常通知 |  |\n| [头像获取](#33-获取静态资源接口) | ✅ |  |\n| [快捷回复](#返回值-response-结构可选) | ✅  | ✅ |\n| **\u003c群管理\u003e** |  |  |\n| **\u003c好友管理\u003e** |  |  |\n| 接收好友申请 | ✅ |  |\n| 通过好友申请 | ✅ | |\n| 获取联系人列表 | | |\n| **\u003c其他功能\u003e** |  |  |\n| 非掉线自动登录 | ✅ |  |\n| API 鉴权 | ✅ | ✅ |\n| [n8n](https://n8n.io/) 无缝接入 | ✅ |  |\n| 支持docker部署 | ✅ arm64 / amd64 | ✅ amd64  |\n| 日志文件导出 | ✅ | ✅  |\n\n### ⚠️ 特别说明：\n\n以上提到的功能 ✅ 为已实现，受限于微信协议限制，不同协议支持功能也是不同的，并不是所有功能都可以对接，例如：\n\n  - 企业微信消息的收发 [#142](https://github.com/danni-cool/wechatbot-webhook/issues/142)\n  - 发送语音消息 / 分享音乐 / 公众号等在 features 中未提到的功能\n\n## 🚀 一分钟 Demo\n\n### 1. 运行 \u0026 扫码\n\n```bash\nnpx wechatbot-webhook\n```\n\n\u003e 除非掉线，默认记住上次登录，换帐号请运行以下命令 `npx wechatbot-webhook -r`\n\n\u003e 如遇安装报错，请确保自己的node版本 \u003e= 18.14.1 [#227](https://github.com/danni-cool/wechatbot-webhook/issues/227)\n\n### 2. 复制推消息 api\n\n从命令行中复制推消息api，例如 http://localhost:3001/webhook/msg/v2?token=[YOUR_PERSONAL_TOKEN]\n\n![](https://cdn.jsdelivr.net/gh/danni-cool/danni-cool@cdn/image/wechatbot-demo.gif)\n\n### 3. 使用以下结构发消息\n\n新开个终端试试以下 curl，to、token 字段值换成你要值\n\n```bash\ncurl --location 'http://localhost:3001/webhook/msg/v2?token=[YOUR_PERSONAL_TOKEN]' \\\n--header 'Content-Type: application/json' \\\n--data '{ \"to\": \"测试昵称\", data: { \"content\": \"Hello World!\" }}'\n```\n\n## 🔧 开发\n\n\u003e [!IMPORTANT] \n\u003e 包管理器迁移已至 pnpm，安装依赖请使用它，以支持一些不定时的临时包修补（patches）和加速依赖安装\n\n## ⛰️ 部署 Deploy（推荐）\n\n\n#### 1.使用 docker 部署\n\n##### 拉取最新镜像\n\n```\ndocker pull dannicool/docker-wechatbot-webhook\n```\n\n##### docker 部署\n\n```bash\n# 启动容器并映射日志目录，日志按天维度生成，e.g: app.2024-01-01.log\ndocker run -d --name wxBotWebhook -p 3001:3001 \\\n-v ~/wxBot_logs:/app/log \\\ndannicool/docker-wechatbot-webhook\n```\n\n##### 使用 compose 部署 (可选)\n\n```bash\nwget -O docker-compose.yml https://cdn.jsdelivr.net/gh/danni-cool/wechatbot-webhook@main/docker-compose.yml \u0026\u0026 docker-compose down \u0026\u0026 docker-compose -p wx_bot_webhook up\n```\n\n#### 2.登录\n\n```bash\ndocker logs -f wxBotWebhook\n```\n\n找到二维码登录地址，图下 url 部分，浏览器访问，扫码登录wx\n\n\u003chttps://localhost:3001/login?token=[YOUR_PERSONAL_TOKEN]\u003e\n\n#### 可选 env 参数\n\n\u003e Tips：需要增加参数使用 -e，多行用 \\ 隔开，例如 -e  RECVD_MSG_API=\"\u003chttps://example.com/your/url\u003e\" \\\n\n| 功能  | 变量 | 备注 |\n|--|--|--|\n| 日志级别 | LOG_LEVEL=info | 日志级别，默认 info，只影响当前日志输出，详细输出考虑使用 debug。无论该值如何变化，日志文件总是记录debug级别的日志 |\n|  收消息 API |  RECVD_MSG_API=\u003chttps://example.com/your/url\u003e   |  如果想自己处理收到消息的逻辑，比如根据消息联动，填上你的处理逻辑 url |\n| 收消息 API 接受自己发的消息 | ACCEPT_RECVD_MSG_MYSELF=false | RECVD_MSG_API 是否接收来自自己发的消息（设置为true，即接收, 默认false） |\n| 自定义登录 API token | LOGIN_API_TOKEN=abcdefg123 | 你也可以自定义一个自己的登录令牌，不配置的话，默认会生成一个 |\n| 禁用自动登录 | DISABLE_AUTO_LOGIN=true |  **非微信踢下线账号，可以依靠当前登录的session免登**, 如果想每次都扫码登陆，则增加该条配置 |\n\n## 🛠️ API\n\n### 1. 推消息 API\n\n\u003e v2版本接口增加了群发功能，v1 版本接口请移步 [legacy-api](./docs/legacy-api.md)\n\n- Url：\u003chttp://localhost:3001/webhook/msg/v2?token=[YOUR_PERSONAL_TOKEN]\u003e\n- Methods: `POST`\n- ContentType: `application/json`\n- Body: 格式见下面表格\n\n#### `payload` 结构\n\n\u003e 发文字或文件外链, 外链会解析成图片或者文件\n\n| 参数 |  说明 | 数据类型 | 默认值 | 可否为空 | 可选参数 |\n| -- | -- | -- | -- | -- | -- |\n| to | **消息接收方**，传入`String` 默认是发给昵称（群名同理）, 传入`Object` 结构支持发给备注过的人，比如：`{alias: '备注名'}`，群名不支持备注名 | `String`  `Object` | -  |  N  | - |\n| isRoom | **是否发给群消息**，这个参数决定了找人的时候找的是群还是人，因为昵称其实和群名相同在技术处理上 | `Boolean` | `false`  | Y  |  `true`  `false`  |\n| data | 消息体结构,见下方 `payload.data` | `Object`  `Array` | `false`  | N  |  `true`  `false`  |\n\n#### `payload.data` 结构\n\n| 参数 |  说明 | 数据类型 | 默认值 | 可否为空 | 可选参数 |\n| -- | -- | -- | -- | -- | -- |\n| type | **消息类型**, 字段留空解析为纯文本 | `String`  `text` | - | Y | `text`  `fileUrl` | 支持 **文字** 和 **文件**，  |\n| content | **消息内容**，如果希望发多个Url并解析，type 指定为 fileUrl 同时，content 里填 url 以英文逗号分隔 | `String` | - | N | - |\n\n#### Example（curl）\n\n##### 发单条消息\n\n```bash\ncurl --location 'http://localhost:3001/webhook/msg/v2?token=[YOUR_PERSONAL_TOKEN]' \\\n--header 'Content-Type: application/json' \\\n--data '{\n    \"to\": \"testUser\",\n    \"data\": { \"content\": \"你好👋\" }\n}'\n```\n\n##### 发文件 url 同时支持修改成目标文件名\n\n\u003e 有些情况下，直接发送 url 文件名可能不是我们想要的，给 url 拼接 query 参数 `$alias` 可用于指定发送给目标的文件名（注意：别名不做文件转换）\n\n```bash\ncurl --location 'http://localhost:3001/webhook/msg/v2?token=[YOUR_PERSONAL_TOKEN]' \\\n--header 'Content-Type: application/json' \\\n--data '{\n    \"to\": \"testUser\",\n    \"data\": { \n      \"type\": \"fileUrl\" , \n      \"content\": \"https://download.samplelib.com/jpeg/sample-clouds-400x300.jpg?$alias=cloud.jpg\" \n    }\n}'\n```\n\n##### 发给群消息\n\n```bash\ncurl --location 'http://localhost:3001/webhook/msg/v2?token=[YOUR_PERSONAL_TOKEN]' \\\n--header 'Content-Type: application/json' \\\n--data '{\n    \"to\": \"testGroup\",\n    \"isRoom\": true,\n    \"data\": { \"type\": \"fileUrl\" , \"content\": \"https://download.samplelib.com/jpeg/sample-clouds-400x300.jpg\" },\n}'\n```\n\n##### 同一对象多条消息(群消息同理)\n\n```bash\ncurl --location 'http://localhost:3001/webhook/msg/v2?token=[YOUR_PERSONAL_TOKEN]' \\\n--header 'Content-Type: application/json' \\\n--data '{\n    \"to\": \"testUser\",\n    \"data\": [\n        {\n            \"type\": \"text\",\n            \"content\": \"你好👋\"\n        },\n        {\n            \"type\": \"fileUrl\",\n            \"content\": \"https://samplelib.com/lib/preview/mp3/sample-3s.mp3\"\n        }\n    ]\n}'\n```\n\n##### 群发消息\n\n``` bash\ncurl --location 'http://localhost:3001/webhook/msg/v2?token=[YOUR_PERSONAL_TOKEN]' \\\n--header 'Content-Type: application/json' \\\n--data '[\n    {\n        \"to\": \"testUser1\",\n        \"data\": {\n            \"content\": \"你好👋\"\n        }\n    },\n    {\n        \"to\": \"testUser2\",\n        \"data\": [\n          {\n            \"content\": \"你好👋\"\n          },\n          {\n            \"content\": \"近况如何？\"\n          }\n        ]\n    }\n]'\n```\n\n#### 返回值 `response` 结构\n\n- **`success`**: 消息发送成功与否，群发消息即使部份发送成功也会返回 `true`\n- **`message`**: 出错时提示的消息\n  - 消息发送成功: Message sent successfully\n  - 参数校验不通过: Some params is not valid, sending task is suspend...\n  - 消息都发送失败: All Messages [number] sent failed...\n  - 部份发送成功: Part of the message sent successfully...\n- **`task`**: 发送任务详细信息\n  - `task.successCount`: 发送成功条数\n  - `task.totalCount`: 总消息条数\n  - `task.failedCount`: 发送失败条数\n  - `task.reject`: 因为参数校验不通过的参数和 error 提示\n  - `task.sentFailed`: 因为发送失败和 error 提示\n  - `task.notFound`: 因为未找到用户或者群和 error 提示\n\n\u003e 确保消息单次发送一致性，某一条参数校验失败会终止所有消息发送任务\n\n```json\n{\n    \"success\": true,\n    \"message\": \"\",\n    \"task\": {\n        \"successCount\": 0,\n        \"totalCount\": 0,\n        \"failedCount\": 0,\n        \"reject\": [],\n        \"sentFailed\": [],\n        \"notFound\": []\n    }\n}\n```\n\n#### 读文件发送\n\n\u003e 读文件暂时只支持单条发送\n\n- Url：\u003chttp://localhost:3001/webhook/msg?token=[YOUR_PERSONAL_TOKEN]\u003e\n- Methods: `POST`\n- ContentType: `multipart/form-data`\n- FormData: 格式见下面表格\n\n##### `payload` 结构\n\n| 参数    | 说明                                                                             | 数据类型 | 默认值 | 可否为空 | 可选值  |\n| ------- | -------------------------------------------------------------------------------- | -------- | ------ | -------- | ------- |\n| to      | 消息接收方，传入`String` 默认是发给昵称（群名同理）, 传入 Json String 结构支持发给备注过的人，比如：--form 'to=\"{alias: \\\"小号\\\"}\"'，群名不支持备注名称                                       | `String` | -      | N        | -       |\n| isRoom  | **是否发的群消息**，formData纯文本只能使用 `String` 类型，`1`代表是，`0`代表否， | `String` | `0`    | Y        | `1` `0` |\n| content | **文件**，本地文件一次只能发一个，多个文件手动调用多次                           | `Binary` | -      | N        | -       |\n\n##### Curl\n\n```bash\ncurl --location --request POST 'http://localhost:3001/webhook/msg?token=[YOUR_PERSONAL_TOKEN]' \\\n--form 'to=testGroup' \\\n--form content=@\"$HOME/demo.jpg\" \\\n--form 'isRoom=1'\n```\n\n#### 返回值 `response` 结构\n\n```json\n{\n  \"success\": true,\n  \"message\": \"Message sent successfully\"\n}\n```\n\n### 2. 收消息 API\n\n#### `payload` 结构\n  - Methods: `POST`\n  - ContentType: `multipart/form-data`\n  - Form格式如下\n\n| formData      | 说明                                                                                                                                                                                                                                                                      | 数据类型          | 可选值                  | 示例                                             |\n| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | ----------------------- | ------------------------------------------------ |\n| type          | \u003cdiv\u003e功能类型\u003c/div\u003e\u003cul\u003e\u003cli\u003e✅ 文字(text)\u003c/li\u003e\u003cli\u003e✅ 链接卡片(urlLink)\u003c/li\u003e\u003cli\u003e✅ 图片(file)\u003c/li\u003e\u003cli\u003e✅ 视频(file)\u003c/li\u003e\u003cli\u003e✅ 附件(file)\u003c/li\u003e \u003cli\u003e✅ 语音(file)\u003c/li\u003e\u003cli\u003e✅ 添加好友邀请(friendship)\u003c/li\u003e\u003c/ul\u003e\u003cdiv\u003e其他类型\u003c/div\u003e\u003cul\u003e\u003cli\u003e未实现的消息类型(unknown)\u003c/li\u003e\u003c/ul\u003e\u003cdiv\u003e系统类型\u003c/div\u003e\u003cul\u003e\u003cli\u003e✅ 登录(system_event_login)\u003c/li\u003e\u003cli\u003e✅ 登出(system_event_logout)\u003c/li\u003e\u003cli\u003e✅ 异常报错(system_event_error)\u003c/li\u003e\u003cli\u003e✅ 快捷回复后消息推送状态通知(system_event_push_notify)\u003c/li\u003e\u003c/ul\u003e | `String`          | `text` `file` `urlLink` `friendship` `unknown` `system_event_login` `system_event_logout` `system_event_error` `system_event_push_notify`| -                                                |\n| content       | 传输的内容, 文本或传输的文件共用这个字段，结构映射请看示例                                                                                                                                                                                                                | `String` `Binary` |                         | [示例](docs/recvdApi.example.md#formdatacontent) |\n| source        | 消息的相关发送方数据, JSON String                                                                                                                                                                                                                                         | `String`          |                         | [示例](docs/recvdApi.example.md#formdatasource)  |\n| isMentioned   | 该消息是@我的消息 [#38](https://github.com/danni-cool/wechatbot-webhook/issues/38)                                                                                                                                                                                  | `String`          | `1` `0`                 | -                                                |\n| isMsgFromSelf | 是否是来自自己的消息 [#159](https://github.com/danni-cool/wechatbot-webhook/issues/159) | `String`          | `1` `0`                 | -                                                |\n\n**服务端处理 formData 一般需要对应的处理程序，假设你已经完成这一步，你将得到以下 request**\n\n```json\n  {\n    \"type\": \"text\",\n    \"content\": \"你好\",\n    \"source\": \"{\\\"room\\\":\\\"\\\",\\\"to\\\":{\\\"_events\\\":{},\\\"_eventsCount\\\":0,\\\"id\\\":\\\"@f387910fa45\\\",\\\"payload\\\":{\\\"alias\\\":\\\"\\\",\\\"avatar\\\":\\\"/cgi-bin/mmwebwx-bin/webwxgeticon?seq=1302335654\u0026username=@f38bfd1e0567910fa45\u0026skey=@crypaafc30\\\",\\\"friend\\\":false,\\\"gender\\\":1,\\\"id\\\":\\\"@f38bfd1e10fa45\\\",\\\"name\\\":\\\"ch.\\\",\\\"phone\\\":[],\\\"star\\\":false,\\\"type\\\":1}},\\\"from\\\":{\\\"_events\\\":{},\\\"_eventsCount\\\":0,\\\"id\\\":\\\"@6b5111dcc269b6901fbb58\\\",\\\"payload\\\":{\\\"address\\\":\\\"\\\",\\\"alias\\\":\\\"\\\",\\\"avatar\\\":\\\"/cgi-bin/mmwebwx-bin/webwxgeticon?seq=123234564\u0026username=@6b5dbb58\u0026skey=@crypt_ec356afc30\\\",\\\"city\\\":\\\"Mars\\\",\\\"friend\\\":false,\\\"gender\\\":1,\\\"id\\\":\\\"@6b5dbd3facb58\\\",\\\"name\\\":\\\"Daniel\\\",\\\"phone\\\":[],\\\"province\\\":\\\"Earth\\\",\\\"signature\\\":\\\"\\\",\\\"star\\\":false,\\\"weixin\\\":\\\"\\\",\\\"type\\\":1}}}\",\n    \"isMentioned\": \"0\",\n    \"isMsgFromSelf\": \"0\",\n    \"isSystemEvent\": \"0\" // 考虑废弃，请使用type类型判断系统消息\n  }\n```\n\n**收消息 api curl示例(直接导入postman调试）**\n\n```curl\ncurl --location 'https://your.recvdapi.com' \\\n--form 'type=\"file\"' \\\n--form 'content=@\"/Users/Downloads/13482835.jpeg\"' \\\n--form 'source=\"{\\\\\\\"room\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"to\\\\\\\":{\\\\\\\"_events\\\\\\\":{},\\\\\\\"_eventsCount\\\\\\\":0,\\\\\\\"id\\\\\\\":\\\\\\\"@f387910fa45\\\\\\\",\\\\\\\"payload\\\\\\\":{\\\\\\\"alias\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"avatar\\\\\\\":\\\\\\\"/cgi-bin/mmwebwx-bin/webwxgeticon?seq=1302335654\u0026username=@f38bfd1e0567910fa45\u0026skey=@crypaafc30\\\\\\\",\\\\\\\"friend\\\\\\\":false,\\\\\\\"gender\\\\\\\":1,\\\\\\\"id\\\\\\\":\\\\\\\"@f38bfd1e10fa45\\\\\\\",\\\\\\\"name\\\\\\\":\\\\\\\"ch.\\\\\\\",\\\\\\\"phone\\\\\\\":[],\\\\\\\"star\\\\\\\":false,\\\\\\\"type\\\\\\\":1}},\\\\\\\"from\\\\\\\":{\\\\\\\"_events\\\\\\\":{},\\\\\\\"_eventsCount\\\\\\\":0,\\\\\\\"id\\\\\\\":\\\\\\\"@6b5111dcc269b6901fbb58\\\\\\\",\\\\\\\"payload\\\\\\\":{\\\\\\\"address\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"alias\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"avatar\\\\\\\":\\\\\\\"/cgi-bin/mmwebwx-bin/webwxgeticon?seq=123234564\u0026username=@6b5dbb58\u0026skey=@crypt_ec356afc30\\\\\\\",\\\\\\\"city\\\\\\\":\\\\\\\"Mars\\\\\\\",\\\\\\\"friend\\\\\\\":false,\\\\\\\"gender\\\\\\\":1,\\\\\\\"id\\\\\\\":\\\\\\\"@6b5dbd3facb58\\\\\\\",\\\\\\\"name\\\\\\\":\\\\\\\"Daniel\\\\\\\",\\\\\\\"phone\\\\\\\":[],\\\\\\\"province\\\\\\\":\\\\\\\"Earth\\\\\\\",\\\\\\\"signature\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"star\\\\\\\":false,\\\\\\\"weixin\\\\\\\":\\\\\\\"\\\\\\\",\\\\\\\"type\\\\\\\":1}}}\"' \\\n--form 'isMentioned=\"0\"'\n```\n\n\n#### 返回值 `response` 结构（可选）\n\n\u003e 如果期望用 `RECVD_MSG_API` 收消息后立即回复(**快捷回复**)，请按以下结构返回返回值，无返回值则不会回复消息\n\n- ContentType: `json`\n\n| 参数 |  说明 | 数据类型 | 默认值 | 可否为空 | 可选参数 |\n| -- | -- | -- | -- | -- | -- |\n| success | 该条请求成功与否，返回 false 或者无该字段，不会处理回复，**有一些特殊消息也通过这个字段控制，比如加好友邀请，返回 `true` 则会通过好友请求** | `Boolean` | - | Y | `true` `false` |\n| data | 如果需要回复消息的话，需要定义data字段 | `Object` `Object Array` | - | Y | |\n\n#### `response.data` 结构\n\n| 参数 |  说明 | 数据类型 | 默认值 | 可否为空 | 可选参数 |\n| -- | -- | -- | -- | -- | -- |\n| type | **消息类型**，该字段不填默认当文本类型传输 | `String`  | `text` | Y | `text`  `fileUrl` | 支持 **文字** 和 **文件**，  |\n| content | **消息内容**，如果希望发多个Url并解析，type 指定为 fileUrl 同时，content 里填 url 以英文逗号分隔 | `String` | - | N | - |\n\n如果回复单条消息\n\n```json\n {\n    \"success\": true,\n    \"data\": {\n      \"type\": \"text\",\n      \"content\": \"hello world！\"\n    }\n  }\n```\n\n组合回复多条消息\n\n```json\n {\n    \"success\": true,\n    \"data\": [\n      {\n        \"type\": \"text\",\n        \"content\": \"hello world！\"\n      },\n      {\n        \"type\": \"fileUrl\",\n        \"content\": \"https://samplelib.com/lib/preview/mp3/sample-3s.mp3\"\n      }\n    ]\n  }\n```\n\n### 3. 其他API\n\n#### token 配置说明\n\u003e 除了在 docker 启动时配置token，在默认缺省 token 的情况，会默认生成一个写入 `.env` 文件中\n\n#### 3.1 获取登录二维码接口\n- **地址**：`/login`\n- **methods**: `GET`\n- **query**: token\n- **status**: `200`\n- **example**: http://localhost:3001/login?token=[YOUR_PERSONAL_TOKEN]\n\n##### 登录成功\n\n返回 json 包含当前用户\n\n```json\n{\"success\":true,\"message\":\"Contact\u003cTestUser\u003eis already login\"}\n```\n\n##### 登录失败\n\n展示微信登录扫码页面\n\n#### 3.2 健康检测接口\n\n可以主动轮询该接口，检查服务是否正常运行\n\n- **地址**：`/healthz`\n- **methods**: `GET`\n- **query**: token\n- **status**: `200`\n- **example**: http://localhost:3001/healthz?token=[YOUR_PERSONAL_TOKEN]\n\n微信已登录, 返回纯文本 `healthy`，否则返回 `unHealthy`\n\n#### 3.3 获取静态资源接口\n\n从 2.8.0 版本开始，可以通过本接口访问到头像等静态资源，具体见 [recvd_api 数据结构示例的 avatar 字段](/docs/recvdApi.example.md#2-formdatasource-string)\n\n注意所有上报 recvd_api 的静态资源地址不会默认带上 token, 需要自己拼接，否则会返回 401 错误, 请确保自己微信已登录，需要通过登录态去获取资源\n\n- **地址**：`/resouces`\n- **methods**: `GET`\n- **query**: \n  - token: 登录token\n  - media: encode过的相对路径，比如 `/avatar/1234567890.jpg` encode为 `avatar%2F1234567890.jpg`\n- **status**: `200` `404` `401`\n\n- **example**：http://localhost:3001/resouces?media=%2Fcgi-bin%2Fmmwebwx-bin%2Fwebwxgetheadimg%3Fseq%3D83460%26username%3D%40%4086815a%26skey%3D\u0026token=[YOUR_PERSONAL_TOKEN]\n\n##### status: `200`\n\n成功获取资源, 返回静态资源文件\n\n##### status: `404`\n\n获取资源失败\n\n##### status: `401` 未携带登录token\n\n```json\n{\"success\":false, \"message\":\"Unauthorized: Access is denied due to invalid credentials.\"}\n```\n\n##### status: `401` 微信登录态已过期\n\n```json\n{\n   \"success\": false, \"message\": \"you must login first\"\n}\n```\n\n\n## 🌟 Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=danni-cool/wechatbot-webhook\u0026type=Date)](https://star-history.com/#danni-cool/wechatbot-webhook\u0026Date)\n\n## Contributors\n\nThanks to all our contributors!\n\n\u003ca href=\"https://github.com/danni-cool/wechatbot-webhook/graphs/contributors\"\u003e![](https://contrib.rocks/image?repo=danni-cool/wechatbot-webhook)\u003c/a\u003e\n\n## ⏫ 更新日志\n\n更新内容参见 [CHANGELOG](https://github.com/danni-cool/docker-wechat-roomBot/blob/main/CHANGELOG.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanni-cool%2Fwechatbot-webhook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanni-cool%2Fwechatbot-webhook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanni-cool%2Fwechatbot-webhook/lists"}