Skip to content

Rule.io SDK


Rule.io SDK / client/src / CreateEmailTemplatePayload

Interface: CreateEmailTemplatePayload

Defined in: client/src/resources/templates/templates.types.ts:122

Payload for TemplatesClient.createEmailTemplate.

The message type is fixed to 'email' by the method — do not include it here. The name defaults to "Template - <timestamp>" server-side if omitted, but providing a meaningful name is strongly recommended to avoid collisions when multiple templates are created in the same second.

Example

typescript
import { buildRcmlDocument } from '@rule/rcml';

const template = await client.templates.createEmailTemplate({
  name: 'Welcome email — v1',
  content: buildRcmlDocument({ ... }),
});

Properties

content

content: RcmlDocument

Defined in: client/src/resources/templates/templates.types.ts:132

The RCML document defining the email template body.


name

name: string

Defined in: client/src/resources/templates/templates.types.ts:130

Human-readable name for the template.

Must be unique within the account. Append a timestamp (e.g. ${name} - ${Date.now()}) when creating programmatically to avoid conflicts.