golang Interface to Prowl: Send Push Notifications to iOS Devices From Your go Application
-
Make sure you've got go 1.4 installed, then install the prowlgo package
go get github.com/tweithoener/prowlgo
-
Visit Prowl and create yourself an API key and a provider key.
-
Get the minimal example going. Grab the code from below, put it into a file (say
prowling.go
), replace the dummy API key with a real one, and run the program usinggo run prowling.go
package main import ( "fmt" prowl "github.com/tweithoener/prowlgo" ) func main() { //Create the client. client, err := prowl.NewClient(prowl.Config{ APIKeys: []string{"abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde"}, //Replace with something valid! Application: "prowlgo Demo", }) if err != nil { fmt.Println("Can't create prowl client: " + err.Error()) return } //And send the message. remaining, err := client.Add(prowl.PrioNormal, "Hello World", "Your first message via prowlgo") if err != nil { fmt.Println("can't send message: " + err.Error()) return } fmt.Printf("remaining api calls: %s\n", remaining) }
-
Congratulations your first prowl message was just delivered to your device.
-
Make sure everything is working by running the tests.
go test
prowlgo is documented using godoc. Thre resulting documentation can be found here. Check it out it is full of code examples. Start at type Client and browse through it. It's easy to understand.
See the issues tracker.