From d25ec27fb1c3df175e1b98af1fdc26881d68a1ab Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Sun, 5 Jan 2025 16:39:13 -0800 Subject: initial commit by simponic-infra --- 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