Skip to main content
Dynamic templates let you store a Handlebars .hbs template on Paubox once and reference it by name when sending. Variable substitution, conditionals, and loops are resolved server-side before delivery, keeping your send requests small and consistent.

Handlebars syntax

Templates use Handlebars syntax. The most common constructs:

Example template

Save the following as welcome.hbs:

Workflow

1. Upload the template

Upload your .hbs file via POST /dynamic_templates. The data[name] value becomes the identifier you use when sending.

2. Send a templated message

Reference the template by name in POST /templated_messages. Pass variable values as a JSON string in template_values.
template_values must be a JSON-encoded string, not a JSON object. Stringify it before including it in the request body.

Managing templates