diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2025-01-05 16:36:51 -0800 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2025-01-11 11:58:34 -0800 |
commit | 040994898b109b3f344b37d1d449eb3b8f58ec53 (patch) | |
tree | 04758f61df0034a398ba133a3b29e7feecf23b85 /template/ntfy/publisher.go | |
parent | 687caaa787f9114e390ef34cd06b0c0658cdeae2 (diff) | |
download | oldinfra-040994898b109b3f344b37d1d449eb3b8f58ec53.tar.gz oldinfra-040994898b109b3f344b37d1d449eb3b8f58ec53.zip |
add ntfy integration
Diffstat (limited to 'template/ntfy/publisher.go')
-rw-r--r-- | template/ntfy/publisher.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/template/ntfy/publisher.go b/template/ntfy/publisher.go new file mode 100644 index 0000000..68f8e49 --- /dev/null +++ b/template/ntfy/publisher.go @@ -0,0 +1,16 @@ +package ntfy + +import ( + "net/http" + "strings" +) + +func SendMessage(message string, endpoint string, topics []string) error { + for _, topic := range topics { + _, err := http.Post(endpoint+"/"+topic, "text/plain", strings.NewReader(message)) + if err != nil { + return err + } + } + return nil +} |