{"id":49312306,"url":"https://github.com/suboat/go-wkteam","last_synced_at":"2026-04-26T13:31:00.790Z","repository":{"id":57500703,"uuid":"215429508","full_name":"suboat/go-wkteam","owner":"suboat","description":"微控管家golang SDK https://wkteam.gitbook.io/doc/","archived":false,"fork":false,"pushed_at":"2019-10-18T07:40:05.000Z","size":72,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-14T09:40:31.058Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/suboat.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":"2019-10-16T01:28:58.000Z","updated_at":"2020-01-02T18:27:05.000Z","dependencies_parsed_at":"2022-08-30T20:10:20.223Z","dependency_job_id":null,"html_url":"https://github.com/suboat/go-wkteam","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/suboat/go-wkteam","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suboat%2Fgo-wkteam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suboat%2Fgo-wkteam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suboat%2Fgo-wkteam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suboat%2Fgo-wkteam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suboat","download_url":"https://codeload.github.com/suboat/go-wkteam/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suboat%2Fgo-wkteam/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32299628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T09:34:17.070Z","status":"ssl_error","status_checked_at":"2026-04-26T09:34:00.993Z","response_time":129,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-04-26T13:30:58.763Z","updated_at":"2026-04-26T13:31:00.784Z","avatar_url":"https://github.com/suboat.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-wkteam\n\n微控管家 SDK in Golang.\n\n参考文档：https://wkteam.gitbook.io/doc/\n\n## 快速开始\n\n### 下载与安装\n\n    go get github.com/suboat/go-wkteam\n\n### 快速启动 `hello.go`\n```go\npackage main\n\nimport \"github.com/suboat/go-wkteam\"\n\nfunc main() {\n\tapi := \u0026wkteam.WkTeam{\n\t\tPhone:    \"13700000000\",                                                      // 微控平台手机号\n\t\tPassword: \"wd2dQ6enmYcj2V5K\",                                                 // 微控平台密码\n\t\tSecret:   \"SQjDw77MEdyWRnTu2ZejfzAtNQBt6arxjGUAhA2QApQAuUCnVq5NCpXDv8nMDbmK\", // 微控平台密钥 64字节\n\t\tAccount:  \"wx_2dQ6enmYcj2V5K\",                                                // 托管在微控上的微信账号\n\t}\n\tif info, err := api.GetAgent(); err != nil {\n\t\tpanic(err)\n\t} else {\n\t\tprintln(wkteam.PubJSON(info))\n\t}\n}\n```\n\n### 监听消息 `serve.go`\n```go\npackage main\n\nimport \"github.com/suboat/go-wkteam\"\n\nfunc main() {\n\tapi := \u0026wkteam.WkTeam{\n\t\tPhone:    \"13700000000\",                                                      // 微控平台手机号\n\t\tPassword: \"wd2dQ6enmYcj2V5K\",                                                 // 微控平台密码\n\t\tSecret:   \"SQjDw77MEdyWRnTu2ZejfzAtNQBt6arxjGUAhA2QApQAuUCnVq5NCpXDv8nMDbmK\", // 微控平台密钥 64字节\n\t\tAccount:  \"wx_2dQ6enmYcj2V5K\",                                                // 托管在微控上的微信账号\n\t}\n\n\t// hook新单聊消息\n\tapi.HookMsgUser = func(msg *wkteam.MsgUser) error {\n\t\tapi.Log.Infof(\"%s 发了一条消息给 %s，内容是：%s\", msg.GetFromName(), msg.GetToName(), msg.Content)\n\t\treturn nil\n\t}\n\n\t// hook群聊消息\n\tapi.HookMsgGroup = func(msg *wkteam.MsgGroup) error {\n\t\tapi.Log.Infof(\"%s 在群【%s】发了一条消息:%s\", msg.GetName(), msg.GroupName, msg.Content)\n\t\treturn nil\n\t}\n\n\t// 监听地址\n\tif err := api.ListenAndServe(\n\t\t\"http://0.0.0.0:8080/api/wkteam/\",  // 本机监听地址，还需要nginx等工具暴露给公网\n\t\t\"https://yourhost.com/api/wkteam/\", // 公网地址，微控收到新消息会往这个地址POST数据\n\t); err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\n### 拉取消息 `sync.go`\n```go\npackage main\n\nimport (\n\t\"github.com/suboat/go-wkteam\"\n\t\"time\"\n)\n\nfunc main() {\n\tapi := \u0026wkteam.WkTeam{\n\t\tPhone:    \"13700000000\",                                                      // 微控平台手机号\n\t\tPassword: \"wd2dQ6enmYcj2V5K\",                                                 // 微控平台密码\n\t\tSecret:   \"SQjDw77MEdyWRnTu2ZejfzAtNQBt6arxjGUAhA2QApQAuUCnVq5NCpXDv8nMDbmK\", // 微控平台密钥 64字节\n\t\tAccount:  \"wx_2dQ6enmYcj2V5K\",                                                // 托管在微控上的微信账号\n\t}\n\n\t// 拉取12小时内的与某人的聊天记录\n\tif data, err := api.GetMsgUserSince(\"某好友的微信ID\", time.Now().Add(-time.Hour*12)); err != nil {\n\t\tpanic(err)\n\t} else {\n\t\tfor i, d := range data {\n\t\t\tapi.Log.Infof(\"#%d %s %s -\u003e %s : %s\", i+1, d.Time, d.GetFromName(), d.GetToName(), d.Content)\n\t\t}\n\t}\n\n\t// 拉取6小时内的某群的聊天记录\n\tif data, err := api.GetMsgGroupSince(\"某群的微信ID\", time.Now().Add(-time.Hour*6)); err != nil {\n\t\tpanic(err)\n\t} else {\n\t\tfor i, d := range data {\n\t\t\tapi.Log.Infof(\"#%d %s %s(%s) : %s\", i+1, d.Time, d.Uid, d.GetName(), d.Content)\n\t\t}\n\t}\n}\n```\n\n## License\n\nThe [MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuboat%2Fgo-wkteam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuboat%2Fgo-wkteam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuboat%2Fgo-wkteam/lists"}