Documentation
Sign inGet started

bird email templates create

Usage

Contoh kode
bird email templates create <slug> [flags]

Description

Create an email template and its first editable draft
The slug is the permanent, workspace-unique handle a send names the template by; it cannot be changed later. Nothing a draft holds is sendable until it is submitted with "bird email templates versions submit".
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 wire 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

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

# the body it prints:
Contoh kode
{
  "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"
}
Contoh kode
# 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. Free text, changeable any time; defaults to the slug.
--descriptionOptional description of the template's purpose.
--categoryContent classification: transactional or marketing. Fixed at creation.
--sourceAuthoring format the template is written in — currently html. Fixed at creation.

Languages

NameDescription
--default-languageLanguage a send uses when it names none, and the last resort when a requested language is unavailable. Must be one of the languages the draft carries.
--on-missing-languageHow a send behaves when it asks for a language the template does not carry: fallback (default) or fail.
--language-source-requiredReject a send that names no language instead of serving the default. A template with this set cannot be used for a broadcast.

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 previewRender a template with sample values
bird email templates updateUpdate an email template