bird email templates preview
Usage
Code example
bird email templates preview <template-ref> [flags]Description
Preview a template with sample values
Returns the subject and the HTML and plain-text bodies a send would deliver, so
you can check a draft before submitting it. Renders the draft by default; pass
--version to render a published version instead, or --contact to see the email the
way one of your contacts would receive it. Works for your own templates and our
built-in templates. Nothing is sent and nothing is changed.
Build the request from the <template_ref> argument and flags, a JSON EmailTemplatePreviewRequest body via
--body-file ("-" reads stdin), or both — an inline value overrides the matching
body field. Run --example to print a ready-to-edit body, or --dry-run to print
the resolved request without sending it.
Examples
Code example
# print the body shape (no credentials needed)
bird email templates preview --example
# the body it prints:Code example
{
"contact": "con_01krdgeqcxet5s7t44vh8rt9mg",
"content": {
"html": "<h1>Hi {{ bird.contact.first_name }}</h1>",
"preview_text": "{{ bird.contact.first_name }}, your order is on its way",
"subject": "Welcome to Acme, {{ bird.contact.first_name }}!"
},
"language": "pt-BR",
"parameters": {
"animal": "otter",
"bird": {
"contact": {
"first_name": "Ada"
}
}
},
"version": "emv_01krdgeqcxet5s7t44vh8rt9mg"
}Code example
# render the draft with one variable filled in
bird email templates preview welcome-email --parameters '{"first_name":"Ada"}'
# render a published version in Brazilian Portuguese
bird email templates preview welcome-email --version emv_01krdgeqcxet5s7t44vh8rt9mh --language pt-BR
# render it the way one contact will receive it
bird email templates preview welcome-email --contact con_01krdgeqcxet5s7t44vh8rt9mgOptions
Request
| Name | Description |
|---|---|
| --body-file | Read the JSON request body from this file; "-" reads stdin |
| --example | Print a complete example request body, then exit |
| --dry-run | Print the resolved request without sending it, then exit |
| --idempotency-key | Deduplication key; a retry with the same key won't act twice |
Options
| Name | Description |
|---|---|
| --parameters | Sample values for the template's variables, as a JSON object (e.g. {"first_name":"Ada"}) |
| --language | Which of the template's languages to render. Omit it to render the default; the template's on_missing_language decides what an absent language does, exactly as it would on a send |
| --version | Preview a published version by its ID (emv_…) instead of the current draft |
| --contact | Render the template as this contact (con_…) would receive it, filling every bird.contact.… token from their record |
| --response-schema | Print the fields this command returns, then exit |
Related
| Name | Description |
|---|---|
| bird email templates create | Create an email template and its first editable draft |
| bird email templates delete | Delete an email template |
| bird email templates duplicate | Duplicate an email template |
| bird email templates get | Get an email template |
| bird email templates list | List email templates |
| bird email templates update | Update an email template |
Related resources
Continue with the documentation, guides and examples for this topic. Resources are in English.
Watch the guideHow to build an email templateExplore the capabilityEmail templatesFollow the learning pathBuild your first integrationImplementation guideEmail templates
Try the practice and get an implementation brief