Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/moond4rk/notifier
notifier is a Go library to send notification to other applications.
https://github.com/moond4rk/notifier
bark bot dingtalk feishu go golang lark notifications notifiers notify
Last synced: 5 days ago
JSON representation
notifier is a Go library to send notification to other applications.
- Host: GitHub
- URL: https://github.com/moond4rk/notifier
- Owner: moonD4rk
- License: mit
- Created: 2022-04-21T02:46:06.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-07T09:23:17.000Z (8 months ago)
- Last Synced: 2024-06-20T20:15:02.292Z (5 months ago)
- Topics: bark, bot, dingtalk, feishu, go, golang, lark, notifications, notifiers, notify
- Language: Go
- Homepage:
- Size: 37.1 KB
- Stars: 20
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# notifier
![CI](https://github.com/moonD4rk/notifier/workflows/CI/badge.svg?branch=main)
notifier is a simple Go library to send notification to other applications.
## Feature
| Provider | Code |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| [DingTalk](https://www.dingtalk.com/en) | [provider/dingtalk](https://github.com/moonD4rk/notifier/tree/main/provider/dingtalk) |
| [Bark](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | [provider/bark](https://github.com/moonD4rk/notifier/tree/main/provider/bark) |
| [Lark](https://www.larksuite.com/en_us/) | [provider/lark](https://github.com/moonD4rk/notifier/tree/main/provider/lark) |
| [Feishu](https://www.feishu.cn/) | [provider/feishu](https://github.com/moonD4rk/notifier/tree/main/provider/feishu) |
| [Server 酱](https://sct.ftqq.com/) | [provider/serverchan](https://github.com/moonD4rk/notifier/tree/main/provider/serverchan) |## Install
`go get -u github.com/moond4rk/notifier`
## Usage
```go
package mainimport (
"os""github.com/moond4rk/notifier"
)func main() {
var (
dingtalkToken = os.Getenv("dingtalk_token")
dingtalkSecret = os.Getenv("dingtalk_secret")
barkKey = os.Getenv("bark_key")
barkServer = notifier.DefaultBarkServer
feishuToken = os.Getenv("feishu_token")
feishuSecret = os.Getenv("feishu_secret")
larkToken = os.Getenv("lark_token")
larkSecret = os.Getenv("lark_secret")
serverChanUserID = "" // server chan's userID could be empty
serverChanSendKey = os.Getenv("server_chan_send_key")
)
notifier := notifier.New(
notifier.WithDingTalk(dingtalkToken, dingtalkSecret),
notifier.WithBark(barkKey, barkServer),
notifier.WithFeishu(feishuToken, feishuSecret),
notifier.WithLark(larkToken, larkSecret),
notifier.WithServerChan(serverChanUserID, serverChanSendKey),
)var (
subject = "this is subject"
content = "this is content"
)
if err := notifier.Send(subject, content); err != nil {
panic(err)
}
}
```