17 lines
293 B
Go
17 lines
293 B
Go
|
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
|
||
|
}
|