Documentation
Sign inGet started

bird email templates create

Usage

Code example
bird email templates create <slug> [flags]

Description

Create an email template and its first editable draft
"slug" is the name you send the template by, for example "welcome-email". You set it when you create the template and it cannot be changed afterwards. A draft cannot be sent. Submit it first with "bird email templates versions submit", and sends then use the version that submit creates.
This creates an empty draft. Add content one language at a time with "bird email templates versions languages set", which is also how you edit it later. To seed content at creation instead, pass the whole JSON body with --body-file: the "languages" object maps a BCP-47 tag to that language's {subject, html, text}, a shape no flag can express.
Build the request from the <slug> argument and flags, a JSON EmailTemplateCreate 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.

Procedure

Step 1 of 3 of "Author a template and make it sendable". Next: bird email templates versions languages set.

Examples

Code example
# print the body shape (no credentials needed)
bird email templates create --example

# the body it prints:
Code example
{
  "category": "transactional",
  "default_language": "en",
  "description": "Sent to new customers after signup.",
  "languages": {
    "en": {
      "html": "<h1>Hi {{ bird.contact.first_name }}</h1>",
      "subject": "Welcome to Acme, {{ bird.contact.first_name }}!"
    }
  },
  "name": "Welcome email",
  "on_missing_language": "fallback",
  "slug": "welcome-email",
  "source": "html"
}
Code example
# create an empty draft, then author its English content
bird email templates create welcome-email --category marketing --source html

# seed the draft's content at creation
bird email templates create welcome-email --category marketing --source html --body-file body.json

Options

Identity

NameDescription
--nameDisplay name shown wherever the template is listed. You can change it any time; defaults to the slug
--descriptionWhat the template is for, in your own words
--categoryContent classification: transactional or marketing. Fixed at creation
--sourceAuthoring format the template is written in: html. Fixed at creation

Languages

NameDescription
--default-languageThe language to use when a send does not ask for one, and the fallback when a send asks for a language this template does not have. It has to be one of the languages in the draft
--on-missing-languageHow a send behaves when it asks for a language the template does not have: fallback (default) or fail
--language-source-requiredReject a send that does not name a language, instead of sending the default language. A broadcast cannot use a template with this turned on, because a broadcast never names a language

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
--response-schemaPrint the fields this command returns, then exit
NameDescription
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 previewPreview a template with sample values
bird email templates updateUpdate an email template