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.jsonOptions
Identity
| Name | Description |
|---|---|
| --name | Display name shown wherever the template is listed. You can change it any time; defaults to the slug |
| --description | What the template is for, in your own words |
| --category | Content classification: transactional or marketing. Fixed at creation |
| --source | Authoring format the template is written in: html. Fixed at creation |
Languages
| Name | Description |
|---|---|
| --default-language | The 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-language | How a send behaves when it asks for a language the template does not have: fallback (default) or fail |
| --language-source-required | Reject 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
| 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 |
|---|---|
| --response-schema | Print the fields this command returns, then exit |
Related
| Name | Description |
|---|---|
| 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 preview | Preview a template with sample values |
| bird email templates update | Update an email template |