{"id":13694816,"url":"https://github.com/hellokaton/wechat-api","last_synced_at":"2025-09-27T07:31:07.375Z","repository":{"id":22907038,"uuid":"26255685","full_name":"hellokaton/wechat-api","owner":"hellokaton","description":"🗯 wechat-api by java7.","archived":true,"fork":false,"pushed_at":"2018-03-30T03:14:32.000Z","size":11698,"stargazers_count":1812,"open_issues_count":2,"forks_count":725,"subscribers_count":153,"default_branch":"master","last_synced_at":"2025-01-07T23:05:25.232Z","etag":null,"topics":["wechat","wechat-api","wechat-bot","wechat-framework","wechat-sdk"],"latest_commit_sha":null,"homepage":"https://biezhi.github.io/wechat-api/","language":"Java","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/hellokaton.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":"2014-11-06T05:41:04.000Z","updated_at":"2025-01-03T21:48:55.000Z","dependencies_parsed_at":"2022-07-13T17:30:58.987Z","dependency_job_id":null,"html_url":"https://github.com/hellokaton/wechat-api","commit_stats":null,"previous_names":["biezhi/wechat-api"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellokaton%2Fwechat-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellokaton%2Fwechat-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellokaton%2Fwechat-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellokaton%2Fwechat-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hellokaton","download_url":"https://codeload.github.com/hellokaton/wechat-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234410012,"owners_count":18828120,"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":["wechat","wechat-api","wechat-bot","wechat-framework","wechat-sdk"],"created_at":"2024-08-02T17:01:43.712Z","updated_at":"2025-09-27T07:31:01.990Z","avatar_url":"https://github.com/hellokaton.png","language":"Java","readme":"# wechat-api\n\nwechat-api 是微信个人号的Java版本API，让个人号具备更多能力，提供方便的接口调用。\n\n[在线文档](https://biezhi.github.io/wechat-api/)\n\n[![](https://img.shields.io/travis/biezhi/wechat-api.svg)](https://travis-ci.org/biezhi/wechat-api)\n[![](https://img.shields.io/maven-central/v/io.github.biezhi/wechat-api.svg)](https://mvnrepository.com/artifact/io.github.biezhi/wechat-api)\n[![](https://img.shields.io/badge/license-MIT-FF0080.svg)](https://github.com/biezhi/wechat-api/blob/master/LICENSE)\n[![@biezhi on zhihu](https://img.shields.io/badge/zhihu-%40biezhi-red.svg)](https://www.zhihu.com/people/biezhi)\n[![](https://img.shields.io/github/followers/biezhi.svg?style=social\u0026label=Follow%20Me)](https://github.com/biezhi)\n\n## 特性\n\n- 使用简单，引入依赖即可\n- 支持本地图片和终端输出二维码\n- 本地自动登录\n- 支持文本、图片、视频、撤回消息等\n- 支持发送文本、图片、附件\n- 注解绑定消息监听\n- 群聊、单聊支持\n- 添加好友验证\n- 撤回消息获取\n- JDK7+\n\n## 使用\n\n本地开发的同学请先安装 [lombok](https://projectlombok.org/) 插件并确保你的JDK环境是1.7+\n\n引入 `maven` 依赖\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.biezhi\u003c/groupId\u003e\n    \u003cartifactId\u003ewechat-api\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.6\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n构建自己的小机器人\n\n```java\npublic class HelloBot extends WeChatBot {\n    \n    public HelloBot(Config config) {\n        super(config);\n    }\n    \n    @Bind(msgType = MsgType.TEXT)\n    public void handleText(WeChatMessage message) {\n        if (StringUtils.isNotEmpty(message.getName())) {\n            log.info(\"接收到 [{}] 的消息: {}\", message.getName(), message.getText());\n            this.sendMsg(message.getFromUserName(), \"自动回复: \" + message.getText());\n        }\n    }\n    \n    public static void main(String[] args) {\n        new HelloBot(Config.me().autoLogin(true).showTerminal(true)).start();\n    }\n    \n}\n```\n\n## Bot API\n\n```java\n/**\n * 给文件助手发送消息\n *\n * @param msg 消息内容\n * @return 发送是否成功\n */\nboolean sendMsgToFileHelper(String msg);\n\n/**\n * 给某个用户发送消息\n *\n * @param name 用户UserName\n * @param msg  消息内容\n * @return 发送是否成功\n */\nboolean sendMsg(String name, String msg);\n\n/**\n * 根据名称发送消息\n *\n * @param name 备注或昵称，精确匹配\n * @param msg  消息内容\n * @return 发送是否成功\n */\nboolean sendMsgByName(String name, String msg);\n\n/**\n * 给某个用户发送图片消息\n *\n * @param name    用户UserName\n * @param imgPath 图片路径\n * @return 发送是否成功\n */\nboolean sendImg(String name, String imgPath);\n\n/**\n * 根据名称发送图片消息\n *\n * @param name    备注或昵称，精确匹配\n * @param imgPath 图片路径\n * @return 发送是否成功\n */\nboolean sendImgName(String name, String imgPath);\n\n/**\n * 给用户发送文件\n *\n * @param name     用户UserName\n * @param filePath 文件路径\n * @return 发送是否成功\n */\nboolean sendFile(String name, String filePath);\n\n/**\n * 根据名称发送文件消息\n *\n * @param name     备注或昵称，精确匹配\n * @param filePath 文件路径\n * @return 发送是否成功\n */\nboolean sendFileName(String name, String filePath);\n```\n\n[更多API见文档](https://biezhi.github.io/wechat-api/#/?id=api%e5%88%97%e8%a1%a8)\n\n## TODO\n\n1. 接收位置\n2. 撤回消息查看\n3. 发送文件消息\n4. 多线程处理消息\n\n## 开源协议\n\n[MIT](https://github.com/biezhi/wechat-api/blob/master/LICENSE)","funding_links":[],"categories":["Java"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellokaton%2Fwechat-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellokaton%2Fwechat-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellokaton%2Fwechat-api/lists"}