Documentation
Sign inGet started

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_01krdgeqcxet5s7t44vh8rt9mg

Options

Request

NameDescription
--body-fileRead the JSON request body from this file; "-" reads stdin
--examplePrint a complete example request body, then exit
--dry-runPrint the resolved request without sending it, then exit
--idempotency-keyDeduplication key; a retry with the same key won't act twice

Options

NameDescription
--parametersSample values for the template's variables, as a JSON object (e.g. {"first_name":"Ada"})
--languageWhich 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
--versionPreview a published version by its ID (emv_…) instead of the current draft
--contactRender the template as this contact (con_…) would receive it, filling every bird.contact.… token from their record
--response-schemaPrint the fields this command returns, then exit
NameDescription
bird email templates createCreate an email template and its first editable draft
bird email templates deleteDelete an email template
bird email templates duplicateDuplicate an email template
bird email templates getGet an email template
bird email templates listList email templates
bird email templates updateUpdate an email template