Preview: the PushFleet API isn't live yet. Join the waitlist
Templates
Template IDs are slugs you choose, such as order_shipped. A template takes the same fields as a send, and {{name}} placeholders in any field are filled from vars. Templates explains why they keep requests small.
Create or replace
Section titled “Create or replace”PUT /v1/templates/{id}
Needs templates: write. Saving an existing ID replaces it.
await fleet.templates.put("order_shipped", {
title: "Your order shipped",
body: "Arriving {{eta}}",
});fleet.templates.put(
"order_shipped",
title="Your order shipped",
body="Arriving {{eta}}",
)fleet.Templates.Put(ctx, "order_shipped", pushfleet.TemplatesPutParams{
Title: "Your order shipped",
Body: "Arriving {{eta}}",
})fleet
.templates()
.put("order_shipped")
.title("Your order shipped")
.body("Arriving {{eta}}")
.await?;fleet.templates.put(
"order_shipped",
title: "Your order shipped",
body: "Arriving {{eta}}"
)curl -X PUT https://api.pushfleet.com/v1/templates/order_shipped \
-H "Authorization: Bearer $PUSHFLEET_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"Your order shipped","body":"Arriving {{eta}}"}'GET /v1/templates/{id}
await fleet.templates.get("order_shipped");fleet.templates.get("order_shipped")fleet.Templates.Get(ctx, "order_shipped")fleet.templates().get("order_shipped").await?;fleet.templates.get("order_shipped")curl https://api.pushfleet.com/v1/templates/order_shipped \
-H "Authorization: Bearer $PUSHFLEET_SECRET_KEY"Delete
Section titled “Delete”DELETE /v1/templates/{id}
Sends that still name the template get 404 not_found.
await fleet.templates.delete("order_shipped");fleet.templates.delete("order_shipped")fleet.Templates.Delete(ctx, "order_shipped")fleet.templates().delete("order_shipped").await?;fleet.templates.delete("order_shipped")curl -X DELETE https://api.pushfleet.com/v1/templates/order_shipped \
-H "Authorization: Bearer $PUSHFLEET_SECRET_KEY"