Back to Arky

Email Templates

Create reusable email bodies for workflows and campaigns

Email templates are reusable full email body templates. They render with Handlebars variables and can be used by workflows, campaigns, or both.

Delivery sender identity comes from the selected mailbox for tenant email. Platform/auth email may use the platform sender.

Create Email Template

POST /v1/stores/{storeId}/email-templates
SDK: sdk.emailTemplate.createEmailTemplate()
const template = await sdk.emailTemplate.createEmailTemplate({
key: 'newsletter-feature-update',
  subject: { en: '{{subject}}' },
  preheader: '{{preheader}}',
  body: '<h1>{{title}}</h1><div>{{body}}</div>',
  variables: [
    { key: 'subject' },
    { key: 'preheader' },
    { key: 'title' },
    { key: 'body' }
  ],
sample_data: {
  subject: 'June update',
  preheader: 'A few updates from the team.',
  title: 'June update',
  body: '<p>Here is what changed this month.</p>'
},
from_name: 'My Store',
from_email: 'sender-default@example.com'
});

Parameters

Name Type Description
key required string Unique template identifier
subject optional Record<string, string> Localized subject template
body optional string HTML body with Handlebars variables
preheader optional string Inbox preview text template
variables optional EmailTemplateVariable[] Declared variables used by the template
sample_data optional Record<string, unknown> Preview data and example values
from_name required string Sender default metadata. Tenant delivery uses the selected mailbox.
from_email required string Sender default metadata. Tenant delivery uses the selected mailbox.
reply_to optional string Reply-to default metadata

Template Variables

Templates use Handlebars syntax:

  • {{subject}} escapes text values

  • {{body}} renders escaped body text

  • nested variables can be referenced with paths such as {{store.name}}

    Declare variables so the UI, previews, workflows, and campaigns know which values can be filled before sending.

	variables: [
	  { key: 'subject' },
	  { key: 'body' },
	  { key: 'cta_url' }
		]

Preview Email Template

POST /v1/stores/{storeId}/email-templates/{id}/preview
SDK: sdk.emailTemplate.previewEmailTemplate()
const preview = await sdk.emailTemplate.previewEmailTemplate({
  id: 'tmpl_abc123',
  vars: {
    subject: 'June update',
    title: 'June update',
    body: '<p>Here is what changed this month.</p>'
  }
});

console.log(preview.subject, preview.html, preview.warnings);

List Email Templates

GET /v1/stores/{storeId}/email-templates
SDK: sdk.emailTemplate.getEmailTemplates()
const { items, cursor } = await sdk.emailTemplate.getEmailTemplates({
  query: 'newsletter',
  status: 'active',
  limit: 20,
});

Update Email Template

PUT /v1/stores/{storeId}/email-templates/{id}
SDK: sdk.emailTemplate.updateEmailTemplate()
await sdk.emailTemplate.updateEmailTemplate({
  id: 'tmpl_abc123',
  subject: { en: '{{subject}}' },
  body: '<h1>{{title}}</h1><div>{{body}}</div>',
  status: 'active',
});

Parameters

Name Type Description
id required string Template ID
key optional string New key
subject optional Record<string, string> Updated localized subject templates
body optional string Updated HTML body
preheader optional string Updated preheader
variables optional EmailTemplateVariable[] Updated variable declarations
sample_data optional Record<string, unknown> Updated sample data
status optional active | archived Template status

Default Templates

Every new store includes shared email templates:

KeyPurpose
order-notification-storeOrder notification to store admin
order-notification-profileOrder confirmation to profile
order-reminder-profileScheduled order item reminder to profile
contact-notification-storeContact form submission to store admin
subscription-confirmProfile list double opt-in confirmation
campaign-simple-emailSimple subject/body template for campaigns
newsletter-basicNewsletter or broadcast email layout
Note

Campaign sent messages keep their rendered subject, HTML, and text output, so editing a template later does not rewrite conversation history.