inou/lib/notify.go

22 lines
483 B
Go

package lib
import (
"net/http"
"strings"
"time"
)
const ntfyURL = "https://ntfy.inou.com/inou-alerts"
const ntfyToken = "tk_k120jegay3lugeqbr9fmpuxdqmzx5"
func SendSignal(message string) {
go func() {
req, _ := http.NewRequest("POST", ntfyURL, strings.NewReader(message))
req.Header.Set("Authorization", "Bearer "+ntfyToken)
req.Header.Set("Title", "inou")
req.Header.Set("Markdown", "yes")
client := &http.Client{Timeout: 10 * time.Second}
client.Do(req)
}()
}