Email Templates
BIAB's email template system manages the transactional emails your site sends — welcome messages, order confirmations, quote notifications, and more.
// List all templates
const templates = await client.emailTemplates.list()
// → [{ id, name, slug, subject, updatedAt }, ...]
// Get a single template with body content
const template = await client.emailTemplates.get('welcome-email')
// → { id, name, slug, subject, bodyHtml, bodyText, variables }
// Create a new template
const created = await client.emailTemplates.create({
name: 'Order Confirmation',
slug: 'order-confirmation',
subject: 'Your order #{{orderNumber}} is confirmed',
bodyHtml: '<h1>Thanks for your order!</h1>…',
})
// Create a new version (draft)
await client.emailTemplates.createVersion('order-confirmation', {
subject: 'New subject line',
bodyHtml: '<h1>Updated content</h1>…',
})
Each template supports variable interpolation ({{variableName}}) using
the values provided by BIAB's trigger system. Versions allow A/B testing
before promoting a draft to active.