Skip to content
Preview: the PushFleet API isn't live yet. Join the waitlist

Templates

A template is a message you save once and send by ID. It keeps requests tiny, which matters when you send at volume, and it keeps your copy out of your code.

A plain send is 74 bytes:

{"to":"user_8f3k","title":"Your order shipped","body":"Arriving Thursday"}

The same send through a template is 66 bytes, and the gap grows with longer copy, sounds, images and data:

{"to":"user_8f3k","template":"order_shipped","vars":{"eta":"Thu"}}

Put {{name}} anywhere in a template’s fields and pass the value in vars when you send. A variable with no value is left empty.

You choose the template’s ID as a readable slug. Saving the same ID again replaces it.

await fleet.templates.put("order_shipped", {
  title: "Your order shipped",
  body: "Arriving {{eta}}",
});
await fleet.send({
  to: "user_8f3k",
  template: "order_shipped",
  vars: { eta: "Thu" },
});

Any field you send alongside the template overrides it for that one message.