Nilovon Connect
Guides

Templates

Reusable message content with dynamic variables.

Templates let you define message content once and reuse it across sends. Use {{variable}} placeholders for dynamic content that gets substituted at send time.

How templates work

  1. Create a template with placeholder variables
  2. Reference the template by ID when sending a message
  3. Connect renders the final content by substituting variables
// 1. Create the template
const tpl = await connect.template.create({
  name: "order-confirmation",
  channelType: "email",
  subject: "Order {{orderId}} confirmed",
  body: "<p>Hi {{name}}, your order {{orderId}} is confirmed.</p>",
  variables: ["name", "orderId"],
});

// 2. Use it when sending
await connect.message.send({
  channelType: "email",
  emailDomainId: "dom_...",
  to: "customer@example.com",
  subject: "Order #1234 confirmed",
  body: "<p>Fallback content</p>",
  templateId: tpl.id,
});

Email vs SMS templates

Templates are channel-specific. Email templates can include a subject field; SMS templates only use body:

// SMS template
await connect.template.create({
  name: "otp-code",
  channelType: "sms",
  body: "Your verification code is {{code}}",
  variables: ["code"],
});

Variable syntax

Use double curly braces: {{variableName}}. Variable names should be alphanumeric (letters, numbers, underscores).

Hello {{firstName}}, your order {{order_id}} ships on {{ship_date}}.

Versioning

When you update a template, the previous version is preserved. This means messages already sent with an older version aren't affected.

Soft deletion

Deleting a template sets it to inactive rather than removing it. This keeps existing message references intact:

await connect.template.delete({ id: "tpl_..." });

On this page