{"id":17330397,"url":"https://github.com/voidint/wecombot","last_synced_at":"2026-03-27T04:52:50.473Z","repository":{"id":192022420,"uuid":"685894437","full_name":"voidint/wecombot","owner":"voidint","description":"wecom bot sdk. 企业微信群机器人sdk。","archived":false,"fork":false,"pushed_at":"2023-09-06T02:13:05.000Z","size":29,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-03T11:32:31.316Z","etag":null,"topics":["bot","sdk","wecom","wecombot"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/voidint/wecombot","language":"Go","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/voidint.png","metadata":{"files":{"readme":"README.md","changelog":"news.go","contributing":null,"funding":null,"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}},"created_at":"2023-09-01T08:55:04.000Z","updated_at":"2025-05-31T03:26:40.000Z","dependencies_parsed_at":"2024-10-15T14:51:10.235Z","dependency_job_id":null,"html_url":"https://github.com/voidint/wecombot","commit_stats":null,"previous_names":["voidint/wecombot"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/voidint/wecombot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidint%2Fwecombot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidint%2Fwecombot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidint%2Fwecombot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidint%2Fwecombot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voidint","download_url":"https://codeload.github.com/voidint/wecombot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voidint%2Fwecombot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268192551,"owners_count":24210541,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","sdk","wecom","wecombot"],"created_at":"2024-10-15T14:51:08.248Z","updated_at":"2026-03-27T04:52:45.433Z","avatar_url":"https://github.com/voidint.png","language":"Go","readme":"# wecombot\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/voidint/wecombot)](https://pkg.go.dev/github.com/voidint/wecombot?tab=doc)\n[![Go Report Card](https://goreportcard.com/badge/github.com/voidint/wecombot)](https://goreportcard.com/report/github.com/voidint/wecombot)\n[![codebeat badge](https://codebeat.co/badges/f6d30cce-7c65-4d72-a698-40fbc32eda9d)](https://codebeat.co/projects/github-com-voidint-wecombot-main)\n\nwecombot 是[企业微信群机器人](https://developer.work.weixin.qq.com/document/path/91770)的一个 go 语言 sdk，API友好，无任何第三方依赖。\n\n## 安装\n```sehll\n$ go get github.com/voidint/wecombot@latest\n```\n\n\n## 用法\n### 发送[文本](https://developer.work.weixin.qq.com/document/path/91770#%E6%96%87%E6%9C%AC%E7%B1%BB%E5%9E%8B)类型消息\n```go\npackage main\n\nimport \"github.com/voidint/wecombot\"\n\nfunc main() {\n\tbot := wecombot.NewBot(\"YOUR_KEY\")\n\tbot.SendText(\"hello 世界！\") // 最长不超过2048个字节\n\tbot.SendText(\n\t\t\"你好 world!\",\n\t\twecombot.WithMentionedMobileList(\"186xxxx1234\", \"170xxxx9876\"), // 发送文字内容并@某些手机用户\n\t)\n}\n```\n\n### 发送[Markdown](https://developer.work.weixin.qq.com/document/path/91770#markdown%E7%B1%BB%E5%9E%8B)类型消息\n```go\npackage main\n\nimport \"github.com/voidint/wecombot\"\n\nvar md = `\n# 成绩单\n**姓名：**张三\n**数学：**\u003cfont color=\"info\"\u003e97\u003c/font\u003e\n**语文：**\u003cfont color=\"comment\"\u003e72\u003c/font\u003e\n**英语：**\u003cfont color=\"warning\"\u003e61\u003c/font\u003e\n`\n\nfunc main() {\n\twecombot.NewBot(\"YOUR_KEY\").SendMarkdown(md) // 最长不超过4096个字节\n}\n```\n\n**注意**：企业微信群消息[仅支持有限的 markdown 语法](https://developer.work.weixin.qq.com/document/path/91770#markdown%E7%B1%BB%E5%9E%8B)\n\n\n### 发送[图片](https://developer.work.weixin.qq.com/document/path/91770#%E5%9B%BE%E7%89%87%E7%B1%BB%E5%9E%8B)类型消息\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/voidint/wecombot\"\n)\n\nfunc main() {\n\tf, err := os.ReadFile(\"logo.jpg\") // 图片最大不能超过2M，支持JPG,PNG格式。\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\twecombot.NewBot(\"YOUR_KEY\").SendImage(f)\n}\n```\n\n### 发送[图文](https://developer.work.weixin.qq.com/document/path/91770#%E5%9B%BE%E6%96%87%E7%B1%BB%E5%9E%8B)类型消息\n```go\npackage main\n\nimport (\n\t\"github.com/voidint/wecombot\"\n)\n\nfunc takePointer(s string) *string {\n\treturn \u0026s\n}\n\nfunc main() {\n\twecombot.NewBot(\"YOUR_KEY\").SendNews(\u0026wecombot.Article{\n\t\tTitle:       \"中秋节礼品领取\",\n\t\tDescription: takePointer(\"今年中秋节公司有豪礼相送\"), // 可选字段使用指针类型\n\t\tURL:         \"www.qq.com\",\n\t\tPicURL:      takePointer(\"http://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png\"),\n\t})\n}\n```\n\n### 发送[文件](https://developer.work.weixin.qq.com/document/path/91770#%E6%96%87%E4%BB%B6%E7%B1%BB%E5%9E%8B)类型消息\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/voidint/wecombot\"\n)\n\nfunc main() {\n\tdata, err := os.ReadFile(\"学生成绩单.xlsx\") // 文件大小不超过20M\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\twecombot.NewBot(\"YOUR_KEY\").SendFile(data, \"学生成绩单.xlsx\")\n}\n```\n\n\n### 发送[语音](https://developer.work.weixin.qq.com/document/path/91770#%E8%AF%AD%E9%9F%B3%E7%B1%BB%E5%9E%8B)类型消息\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/voidint/wecombot\"\n)\n\nfunc main() {\n\tdata, err := os.ReadFile(\"生日祝福.amr\") // 文件大小不超过2M，播放长度不超过60s，仅支持AMR格式。\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\twecombot.NewBot(\"YOUR_KEY\").SendVoice(data, \"生日祝福.amr\")\n}\n```\n\n### 发送[文本通知模板卡片](https://developer.work.weixin.qq.com/document/path/91770#%E6%96%87%E6%9C%AC%E9%80%9A%E7%9F%A5%E6%A8%A1%E7%89%88%E5%8D%A1%E7%89%87)类型消息\n\n```go\npackage main\n\nimport (\n\t\"github.com/voidint/wecombot\"\n)\n\nfunc takePointer(s string) *string {\n\treturn \u0026s\n}\n\nfunc main() {\n\tvar msg wecombot.TextNoticeTemplateCardMessage\n\tmsg.TemplateCard.MainTitle.Title = takePointer(\"欢迎使用企业微信\")\n\tmsg.TemplateCard.MainTitle.Desc = takePointer(\"您的好友正在邀请您加入企业微信\")\n\tmsg.TemplateCard.CardAction.Type = 1\n\tmsg.TemplateCard.CardAction.URL = takePointer(\"https://work.weixin.qq.com/?from=openApi\")\n\t// 参数较多，详见文档。\n\n\twecombot.NewBot(\"YOUR_KEY\").SendTextNoticeTemplateCardMessage(\u0026msg)\n}\n```\n\n### 发送[图文展示模板卡片](https://developer.work.weixin.qq.com/document/path/91770#%E5%9B%BE%E6%96%87%E5%B1%95%E7%A4%BA%E6%A8%A1%E7%89%88%E5%8D%A1%E7%89%87)类型消息\n\n```go\npackage main\n\nimport (\n\t\"github.com/voidint/wecombot\"\n)\n\nfunc takePointer(s string) *string {\n\treturn \u0026s\n}\n\nfunc main() {\n\tvar msg wecombot.NewsNoticeTemplateCardMessage\n\tmsg.TemplateCard.MainTitle.Title = takePointer(\"欢迎使用企业微信\")\n\tmsg.TemplateCard.MainTitle.Desc = takePointer(\"您的好友正在邀请您加入企业微信\")\n\tmsg.TemplateCard.CardImage.URL = *takePointer(\"https://wework.qpic.cn/wwpic/354393_4zpkKXd7SrGMvfg_1629280616/0\")\n\tmsg.TemplateCard.CardAction.Type = 1\n\tmsg.TemplateCard.CardAction.URL = takePointer(\"https://work.weixin.qq.com/?from=openApi\")\n\t// 参数较多，详见文档。\n\n\twecombot.NewBot(\"YOUR_KEY\").SendNewsNoticeTemplateCardMessage(\u0026msg)\n}\n```\n\n### [文件上传](https://developer.work.weixin.qq.com/document/path/91770#%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0%E6%8E%A5%E5%8F%A3)\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/voidint/wecombot\"\n)\n\nfunc main() {\n\tdata, err := os.ReadFile(\"学生成绩单.xlsx\") // 文件大小不超过20M\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tmediaRes, err := wecombot.NewBot(\"YOUR_KEY\").UploadMedia(wecombot.NormalFile, data, \"学生成绩单.xlsx\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Printf(\"media id: %s\", mediaRes.MediaID)\n}\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoidint%2Fwecombot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoidint%2Fwecombot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoidint%2Fwecombot/lists"}