{"id":19621608,"url":"https://github.com/pkg6/go-notify","last_synced_at":"2025-02-26T19:16:01.276Z","repository":{"id":166633959,"uuid":"633426257","full_name":"pkg6/go-notify","owner":"pkg6","description":":calling: 一款满足你的多种渠道消息通知","archived":false,"fork":false,"pushed_at":"2024-03-19T08:09:54.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-09T11:41:01.255Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pkg6.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-04-27T13:23:38.000Z","updated_at":"2023-04-28T06:32:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"115ea6d7-047c-4695-b814-923b9ec22ef2","html_url":"https://github.com/pkg6/go-notify","commit_stats":null,"previous_names":["pkg6/go-notify"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fgo-notify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fgo-notify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fgo-notify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fgo-notify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pkg6","download_url":"https://codeload.github.com/pkg6/go-notify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240917723,"owners_count":19878308,"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":[],"created_at":"2024-11-11T11:23:43.184Z","updated_at":"2025-02-26T19:16:01.253Z","avatar_url":"https://github.com/pkg6.png","language":"Go","readme":"\u003ch1 align=\"center\"\u003eGo Notify\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e:calling: 一款满足你的多种渠道消息通知\u003c/p\u003e\n\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/pkg6/go-notify)](https://goreportcard.com/report/github.com/pkg6/go-notify)\n[![Go.Dev reference](https://img.shields.io/badge/go.dev-reference-blue?logo=go\u0026logoColor=white)](https://pkg.go.dev/github.com/pkg6/go-notify?tab=doc)\n[![Sourcegraph](https://sourcegraph.com/github.com/pkg6/go-notify/-/badge.svg)](https://sourcegraph.com/github.com/pkg6/go-notify?badge)\n[![Release](https://img.shields.io/github/release/pkg6/go-notify.svg?style=flat-square)](https://github.com/pkg6/go-notify/releases)\n\n\n## 安装\n\n```\n$ go get github.com/pkg6/go-notify\n```\n\n## 使用\n\n\n\n## 平台支持\n\n* [钉钉群机器人](https://developers.dingtalk.com/document/app/custom-robot-access)\n* [微信群机器人](https://developer.work.weixin.qq.com/document/path/91770)\n* [邮件](https://github.com/go-gomail/gomail)\n* [SendCloud](https://www.sendcloud.net/doc/email_v2/send_email/)\n* [阿里邮件推送](https://help.aliyun.com/document_detail/29444.html?spm=a2c4g.29443.0.0.342a7bcdte5ZJ9)\n\n\n\n## 使用\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e钉钉群机器人\u003c/b\u003e\u003c/summary\u003e\n\n```\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/pkg6/go-notify\"\n\t\"github.com/pkg6/go-notify/dingtalk\"\n)\n\nfunc main() {\n\tclient := \u0026dingtalk.Client{\n\t\tAccessToken: \"27bbe68cc8b57acc2973b59fd7ae2460fb0b2322ce2e8660f5fb5b75aee04e88\",\n\t\tSecret:      \"SEC55f77c19089ef4aee0be143a77d12730f2daaa2390b212cffb1e1ac1f23f8ccc\",\n\t}\n\tmessage := \u0026dingtalk.TextMessage{}\n\tmessage.Text.Content = \"测试发送dingtalk2\"\n\tn := notify.New(client)\n\tsender := n.Send(message)\n\tfor _, result := range sender {\n\t\tfmt.Println(fmt.Sprintf(\"%#v\", result.Result()))\n\t\tfmt.Println(fmt.Sprintf(\"%#v\", result.Status()))\n\t\tfmt.Println(fmt.Sprintf(\"%#v\", result.Error()))\n\t}\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e微信群机器人\u003c/b\u003e\u003c/summary\u003e\n\n```\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/pkg6/go-notify\"\n\t\"github.com/pkg6/go-notify/wework\"\n)\n\nfunc main() {\n\tclient := \u0026wework.Client{\n\t\tKey: \"693a91f6-7xxx-4bc4-97a0-0ec2sifa5aaa\",\n\t}\n\tmessage := \u0026wework.TextMessage{}\n\tmessage.Text.Content = \"测试发送wework\"\n\tn := notify.New(client)\n\tsender := n.Send(message)\n\tfor _, result := range sender {\n\t\tfmt.Println(fmt.Sprintf(\"%#v\", result.Result()))\n\t\tfmt.Println(fmt.Sprintf(\"%#v\", result.Status()))\n\t\tfmt.Println(fmt.Sprintf(\"%#v\", result.Error()))\n\t}\n}\n```\n\u003c/details\u003e\n\n\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e邮件\u003c/b\u003e\u003c/summary\u003e\n\n```\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/pkg6/go-notify\"\n\t\"github.com/pkg6/go-notify/mail\"\n)\n\nfunc main() {\n\tclient := \u0026mail.Client{\n\t\tHost:     \"smtp.126.com\",\n\t\tPort:     456,\n\t\tUsername: \"******@126.com\",\n\t\tPassword: \"***************\",\n\t}\n\tmessage := \u0026mail.Message{}\n\tmessage.SetForm(\"********@126.com\")\n\tmessage.SetTo(\"**********@qq.com\")\n\tmessage.Html(\"\u003ch3\u003eGO-Notify\u003c/h3\u003e\u003cp\u003e欢迎使用GO-Notify\u003c/p\u003e\")\n\tn := notify.New(client)\n\tsender := n.Send(message)\n\tfor _, result := range sender {\n\t\tfmt.Println(fmt.Sprintf(\"%#v\", result.Result()))\n\t\tfmt.Println(fmt.Sprintf(\"%#v\", result.Status()))\n\t\tfmt.Println(fmt.Sprintf(\"%#v\", result.Error()))\n\t}\n}\n```\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eSendCloud\u003c/b\u003e\u003c/summary\u003e\n\n```\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/pkg6/go-notify\"\n\t\"github.com/pkg6/go-notify/sendcloudmail\"\n)\n\nfunc main() {\n\tclient := \u0026sendcloudmail.Client{ApiKey: \"\", ApiUser: \"\"}\n\tmessage := sendcloudmail.NewNormalMessage(\"form-pkg6@github.com\", \"Go Notify\", \"to-pkg6@github.com\")\n\tmessage.Html(\"Go Notify\")\n\tn := notify.New(client)\n\tsender := n.Send(message)\n\tfor _, result := range sender {\n\t\tfmt.Println(fmt.Sprintf(\"%#v\", result.Result()))\n\t\tfmt.Println(fmt.Sprintf(\"%#v\", result.Status()))\n\t\tfmt.Println(fmt.Sprintf(\"%#v\", result.Error()))\n\t}\n}\n```\n\u003c/details\u003e\n\n\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003e阿里邮件推送\u003c/b\u003e\u003c/summary\u003e\n\n```\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/pkg6/go-notify\"\n\t\"github.com/pkg6/go-notify/alimail\"\n)\n\nfunc main() {\n\tclient := \u0026alimail.Client{AccessKeyId: \"\", AccessKeySecret: \"\"}\n\t\tmessage := alimail.NewMailMessage(\"form-pkg6@github.com\", \"Go Notify\", \"to-pkg6@github.com\")\n\tmessage.HtmlBody(\"Go Notify\")\n\tn := notify.New(client)\n\tsender := n.Send(message)\n\tfor _, result := range sender {\n\t\tfmt.Println(fmt.Sprintf(\"%#v\", result.Result()))\n\t\tfmt.Println(fmt.Sprintf(\"%#v\", result.Status()))\n\t\tfmt.Println(fmt.Sprintf(\"%#v\", result.Error()))\n\t}\n}\n```\n\u003c/details\u003e\n\n## 自定义客户端\n\n~~~\ntype IClient interface {\n\tI() IClient\n\tName() string\n\tSend(message IMessage) IResult\n}\n~~~\n\n## 自定义消息内容\n\n~~~\n// IMessage 消息\ntype IMessage interface {\n\tTransFormToRequestParams() any\n}\n~~~\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkg6%2Fgo-notify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpkg6%2Fgo-notify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkg6%2Fgo-notify/lists"}