Preview: the PushFleet API isn't live yet. Join the waitlist
Go
The Go SDK calls the API from your server with your secret key. Supports Go 1.22 and later. Every call takes a context.Context.
Install
Section titled “Install”go get github.com/pushfleet/pushfleet-gofleet := pushfleet.New(os.Getenv("PUSHFLEET_SECRET_KEY"))
fleet.Send(ctx, pushfleet.SendParams{
To: "user_8f3k",
Title: "Your order shipped",
Body: "Arriving Thursday",
})Send with a template
Section titled “Send with a template”fleet.Send(ctx, pushfleet.SendParams{
To: "user_8f3k",
Template: "order_shipped",
Vars: map[string]any{"eta": "Thu"},
})Sign user tokens
Section titled “Sign user tokens”In live mode your app registers devices with a user token your server signs. The SDK signs it locally, without a request. See identity verification.
userToken := fleet.Users.Token("user_8f3k")Errors and retries
Section titled “Errors and retries”Failed requests return a *pushfleet.Error with the API’s Code, Status and Doc link; check it with errors.As. The SDK retries 429 and 5xx responses with backoff, and sends an idempotency key with every retry so nothing goes out twice.
Every endpoint in the API reference has a Go sample.