summaryrefslogtreecommitdiff
path: root/template/ntfy/publisher.go
blob: 68f8e49cead9b2404d0869da3a54b19b8e60a806 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
}