The library provides a Microsoft Azure Notification Hub Client for backend applications.
Using go get
$ go get github.com/onefootball/gozure/notihub
The package will be available under the following path:
$GOPATH/src/github.com/onefootball/gozure/notihub
package main
import (
"fmt"
"github.com/onefootball/gozure/notihub"
)
func main() {
payload := []byte(`{"title": "Hello Hub!"}`)
n, err := notihub.NewNotification(notihub.Template, payload)
if err != nil {
panic(err)
}
hub := notihub.NewNotificationHub("YOUR_DefaultFullSharedAccessSignature", "YOUR_HubPath")
// broadcast push
b, err := hub.Send(n, nil)
if err != nil {
panic(err)
}
fmt.Println("message successfully created:", string(b))
// tag category push
b, err = hub.Send(n, []string{"tag1", "tag2"})
if err != nil {
panic(err)
}
fmt.Println("message successfully created:", string(b))
}
See the LICENSE file for license rights and limitations (MIT).