Templates

Store an email once and send it by id. Templates hold a subject, html, and an optional plain-text alternative; {{TOKEN}} merge tags are replaced by the variables you pass at send time. Unknown tokens are left visible instead of silently sending blanks. Mistakes should be seen, not delivered. Every new workspace starts with three editable starters (welcome, password reset, receipt).

For the product overview, read the email templates guide.

Create a template

POST/api/v1/templates

const { template } = await notice.templates.create({
  name: "Welcome",
  subject: "Welcome to {{PRODUCT_NAME}}, {{FIRST_NAME}}",
  html: "<p>Hi {{FIRST_NAME}}, your account is live.</p>",
});
FieldTypeDescription
namerequiredstringUnique per workspace. Used in the dashboard.
subjectrequiredstringMay contain {{TOKEN}} merge tags.
htmlrequiredstringHTML body, up to 1MB.
textstring | nullOptional plain-text alternative.

Send with a template

POST/api/v1/email/send

Pass templateId instead of content. Anything you do provide (subject, html, text) overrides that part of the template. Works in batch sends too; a batch that reuses one template only loads it once.

await notice.emails.send({
  from: "Acme <[email protected]>",
  to: "[email protected]",
  templateId: template.id,
  variables: { PRODUCT_NAME: "Acme", FIRST_NAME: "Sam" },
});
FieldTypeDescription
templateIdstringId of a stored template.
variablesobjectUp to 50 string values for {{TOKEN}} tags. Also works on direct sends without a template.

Manage templates

GET/api/v1/templates

PATCH/api/v1/templates/:id

DELETE/api/v1/templates/:id

The dashboard's template editor includes a live preview with sample variables; edit on the left, see the rendered email on the right.