From 040994898b109b3f344b37d1d449eb3b8f58ec53 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sun, 5 Jan 2025 16:36:51 -0800 Subject: add ntfy integration --- template/ntfy/publisher.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 template/ntfy/publisher.go (limited to 'template/ntfy/publisher.go') 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 +} -- cgit v1.2.3-70-g09d2