{"id":21046605,"url":"https://github.com/talaxy009/mirai-http-webhook","last_synced_at":"2025-05-15T19:31:12.005Z","repository":{"id":44962887,"uuid":"384182964","full_name":"Talaxy009/mirai-http-webhook","owner":"Talaxy009","description":"通过 mirai-api-http 来实现 webhook 功能","archived":false,"fork":false,"pushed_at":"2022-07-19T12:25:59.000Z","size":99,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T13:13:22.352Z","etag":null,"topics":["mirai","mirai-api-http","webhook"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Talaxy009.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-08T16:16:06.000Z","updated_at":"2023-04-12T02:46:32.000Z","dependencies_parsed_at":"2022-07-13T10:00:27.594Z","dependency_job_id":null,"html_url":"https://github.com/Talaxy009/mirai-http-webhook","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Talaxy009%2Fmirai-http-webhook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Talaxy009%2Fmirai-http-webhook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Talaxy009%2Fmirai-http-webhook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Talaxy009%2Fmirai-http-webhook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Talaxy009","download_url":"https://codeload.github.com/Talaxy009/mirai-http-webhook/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254407281,"owners_count":22066207,"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":["mirai","mirai-api-http","webhook"],"created_at":"2024-11-19T14:31:03.696Z","updated_at":"2025-05-15T19:31:11.591Z","avatar_url":"https://github.com/Talaxy009.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mirai-http-webhook\n\n通过 mirai-api-http 来实现 webhook 功能\n\n注意：\n\n- 本项目仍在开发中，若遇到问题请提交至 issues\n- 已适配至 2.0 的 [mirai-api-http](https://github.com/project-mirai/mirai-api-http/)，请检查 `config.json` 字段名是否与 [config.default.json](./config.default.json) 的一致\n\n## 使用方式\n\n1. 克隆本项目 `git clone https://github.com/Talaxy009/mirai-http-webhook.git`\n2. 移动到本地仓库 `cd ./mirai-http-webhook`\n3. 安装依赖 `npm install` 或 `yarn`\n4. 复制一份 `config.default.json` 修改名字为 `config.json` 后对其进行编辑，设置文件相关说明在此 → [点我](./docs/config.md)\n5. 启动 `npm start`\n\n## 接口调用说明\n\n### 请求方式：`GET`\n\n请求示例：`http://host:port?token=abcd\u0026text=测试\u0026image=https://bkimg.cdn.bcebos.com/pic/6609c93d70cf3bc79f3ded3c434bada1cd11738bfc82`\n\n| 参数名 | 类型            | 方式  | 说明                                                     |\n| ------ | --------------- | ----- | -------------------------------------------------------- |\n| token  | string (非必须) | query | 需要与配置文件中的 token 一致，若没有配置 token 可以不传 |\n| text   | string (非必须) | query | 需要发送的文字信息                                       |\n| image  | string (非必须) | query | 需要发送的图片的 URL                                     |\n\n### 请求方式：`POST`\n\n请求头必须带有 `Content-Type` , `text/plain` 或 `application/json`\n\n#### `Content-Type: text/plain`\n\n请求格式：`http://host:port?token=abcd`, Body 为 需要发送的文字信息，等价于 `GET` 方式的 `text`\n\n请求示例：`curl -H 'Content-Type: text/plain' -d '测试' -X POST http://host:port?token=abcd`\n\n| 参数名 | 类型            | 方式  | 说明                                                     |\n| ------ | --------------- | ----- | -------------------------------------------------------- |\n| token  | string (非必须) | query | 需要与配置文件中的 token 一致，若没有配置 token 可以不传 |\n\n#### `Content-Type: application/json`\n\n请求格式：`http://host:port[?token=abcd]`\n\nBody：`{ \"token\": \"\", \"text\": \"\", \"image\": \"\" }`\n\n请求示例：`curl -H 'Content-Type: application/json' -d '{ \"token\": \"abcd\", \"text\": \"测试\", \"image\": \"https://bkimg.cdn.bcebos.com/pic/6609c93d70cf3bc79f3ded3c434bada1cd11738bfc82\" }' -X POST http://host:port`\n\n请求示例：`curl -H 'Content-Type: application/json' -d '{ \"text\": \"测试\", \"image\": \"https://bkimg.cdn.bcebos.com/pic/6609c93d70cf3bc79f3ded3c434bada1cd11738bfc82\" }' -X POST http://host:port?token=abcd`\n\n| 参数名 | 类型            | 方式          | 说明                                                     |\n| ------ | --------------- | ------------- | -------------------------------------------------------- |\n| token  | string (非必须) | query 或 body | 需要与配置文件中的 token 一致，若没有配置 token 可以不传 |\n| text   | string (非必须) | body          | 需要发送的文字信息                                       |\n| image  | string (非必须) | body          | 需要发送的图片的 URL                                     |\n\n## 返回说明\n\n返回类型：`application/json;charset=utf-8`\n\n返回示例：\n\n```json\n{\"err\": 0, \"msg\": \"success\"}\n```\n\n| err | msg                | 说明                                           |\n| --- | ------------------ | ---------------------------------------------- |\n| 0   | success            | 调用成功                                       |\n| 1   | token invalid      | 未发送 token 或发送 token 与服务端的不匹配     |\n| 2   | unsupported method | 不支持的请求方式                               |\n| 3   | server error       | 由于某种原因导致流程异常，包括但不限于传参有误 |\n\n## TODO 🕊\n\n- [x] ~~实现对 post 请求的处理~~ (感谢 [Anankke](https://github.com/Anankke))\n- [x] ~~适配 mirai-api-http 2.0~~\n- [ ] 支持调用接口时指定发送对象\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftalaxy009%2Fmirai-http-webhook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftalaxy009%2Fmirai-http-webhook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftalaxy009%2Fmirai-http-webhook/lists"}