1
0
mirror of https://github.com/nikoksr/notify.git synced 2024-11-30 08:46:43 +02:00
A dead simple Go library for sending notifications to various messaging services.
Go to file
Niko Köser 20ec590e87
feat(notify): add notifier options
Introducing Option functions. Options are meant to provide an extendable
way of instanciating a Notifier with a set of options. Currently, only
Enable()/Disable() are supported.

WithOptions() alters an already instanciated Notifier and
NewWithOptions() returns a new Notifier instance that was initialized
with the given options.

Options are passed in as a variadic list, thus, they're "optional".. no
pun intended. Calling New() results in an internal call to
NewWithOptions() without options passed, which again results in a
default Notifier being returned.
2022-04-22 20:29:22 +02:00
.github chore(deps): update actions/cache action to v3 (#235) 2022-03-25 07:48:28 +01:00
assets [ImgBot] Optimize images 2021-04-27 05:47:17 +00:00
service fix(deps): update module github.com/bwmarrin/discordgo to v0.24.0 (#225) 2022-03-25 08:48:24 +01:00
.cliff.toml build(cliff): apply latest breaking changes to git-cliff config 2022-02-13 18:25:51 +01:00
.codacy.yml ci(codacy): reintroduce config for readme badge 2021-11-18 19:26:19 +01:00
.editorconfig feat: init project 2021-01-25 00:14:21 +01:00
.gitignore feat: init project 2021-01-25 00:14:21 +01:00
.golangci.yml feat(lib): add package-level functions (#208) 2022-02-09 14:10:08 +01:00
.kodiak.toml build(kodiak): remove deprecated config option 2021-01-31 15:03:56 +01:00
CHANGELOG.md chore(release): prepare for release v0.23.0 2022-03-25 08:53:48 +01:00
CODE_OF_CONDUCT.md docs: add readme, coc, and contrib guidelines 2021-01-25 05:05:59 +01:00
CONTRIBUTING.md docs(contrib): simplify contribution guide 2022-02-07 09:21:21 +01:00
go.mod fix(deps): update module github.com/bwmarrin/discordgo to v0.25.0 (#251) 2022-04-19 02:21:26 +00:00
go.sum fix(deps): update module github.com/bwmarrin/discordgo to v0.25.0 (#251) 2022-04-19 02:21:26 +00:00
LICENSE feat: init project 2021-01-25 00:14:21 +01:00
Makefile chore(release): prepare for v0.22.0 2022-02-13 18:20:37 +01:00
notifier.go chore(typo): fix minor typo 2022-02-07 10:24:43 +01:00
notify.go feat(notify): add notifier options 2022-04-22 20:29:22 +02:00
README.md feat(service): add syslog (#211) 2022-02-13 18:18:03 +01:00
renovate.json ci(deps): remove dependabot and extend renovate config 2021-08-14 00:42:14 +02:00
SECURITY.md feat(service): add syslog (#211) 2022-02-13 18:18:03 +01:00
send.go feat(lib): add package-level functions (#208) 2022-02-09 14:10:08 +01:00
use.go feat(lib): add package-level functions (#208) 2022-02-09 14:10:08 +01:00

notify logo

GitHub tag (latest SemVer) Go Report Card Codacy Badge Maintainability go.dev reference

A dead simple Go library for sending notifications to various messaging services.

About

Notify was born out of my own need to have my API servers running in production be able to notify me when critical errors occur. Of course, Notify can be used for any other purpose as well. The library is kept as simple as possible for quick integration and ease of use.

Disclaimer

Any misuse of this library is your own liability and responsibility and cannot be attributed to the authors of this library. See license for more.

Spamming through the use of this library may get you permanently banned on most supported platforms.

Since Notify is highly dependent on the consistency of the supported external services and the corresponding latest client libraries, we cannot guarantee its reliability nor its consistency, and therefore you should probably not use or rely on Notify in critical scenarios.

Install

go get -u github.com/nikoksr/notify

Example usage

// Create a telegram service. Ignoring error for demo simplicity.
telegramService, _ := telegram.New("your_telegram_api_token")

// Passing a telegram chat id as receiver for our messages.
// Basically where should our message be sent?
telegramService.AddReceivers(-1234567890)

// Tell our notifier to use the telegram service. You can repeat the above process
// for as many services as you like and just tell the notifier to use them.
// Inspired by http middlewares used in higher level libraries.
notify.UseServices(telegramService)

// Send a test message.
_ = notify.Send(
	context.Background(),
	"Subject/Title",
	"The actual message - Hello, you awesome gophers! :)",
)

Supported services

Please create feature requests for missing services (see #3 for example)

Service Path Credits
Amazon SES service/amazonses aws/aws-sdk-go-v2
Amazon SNS service/amazonsns aws/aws-sdk-go-v2
DingTalk service/dinding blinkbean/dingtalk
Discord service/discord bwmarrin/discordgo
Email service/mail jordan-wright/email
Line service/line line/line-bot-sdk-go
Line Notify service/line utahta/go-linenotify
Mailgun service/mailgun mailgun/mailgun-go
Microsoft Teams service/msteams atc0005/go-teams-notify
Plivo service/plivo plivo/plivo-go
Pushbullet service/pushbullet cschomburg/go-pushbullet
RocketChat service/rocketchat RocketChat/Rocket.Chat.Go.SDK
SendGrid service/sendgrid sendgrid/sendgrid-go
Slack service/slack slack-go/slack
Syslog service/syslog log/syslog
Telegram service/telegram go-telegram-bot-api/telegram-bot-api
TextMagic service/textmagic textmagic/textmagic-rest-go-v2
Twitter service/twitter dghubble/go-twitter
WeChat service/wechat silenceper/wechat
WhatsApp service/whatsapp Rhymen/go-whatsapp

Logo

The logo was made by the amazing MariaLetta.

Contributing

Contributions, issues and feature requests are very welcome! Feel free to check issues page. Please also take a look at the contribution guidelines.

Show your support

Give a ️ if you like this project!