Skip to content

Message Templates

Message templates let you define reusable content for both email and SMS channels. Templates support merge fields that are populated with contact and foundation data at send time.

FieldTypeDescription
idUUIDPrimary key
foundation_idUUIDOwning foundation
namestringTemplate name (e.g., “Donation Thank You”)
channelCampaignChannelemail or sms
subjectstring?Email subject line (null for SMS templates)
bodystringMessage body with merge field placeholders
merge_fieldsJSON?Metadata about which merge fields are used

Templates support the same merge placeholders used across campaigns and sequences:

  • first_name — Contact’s first name (Email, SMS)
  • last_name — Contact’s last name (Email, SMS)
  • foundation_name — Foundation’s display name (Email, SMS)

Each placeholder is wrapped in double curly braces in your template content.

Merge field replacement happens at send time in the EmailService and SmsService. The merge_fields JSON column on the template stores metadata about which fields the template uses, for UI display purposes.

Email templates include both a subject and body field. The body contains HTML:

{
"name": "Donation Receipt",
"channel": "email",
"subject": "Thank you for your gift, {{first_name}}!",
"body": "<p>Hi {{first_name}},</p><p>Thank you for your generous donation to <strong>{{foundation_name}}</strong>. Your support makes a real difference.</p><p>With gratitude,<br>{{foundation_name}}</p>",
"merge_fields": ["first_name", "foundation_name"]
}

SMS templates have a body only (no subject):

{
"name": "Event Reminder",
"channel": "sms",
"subject": null,
"body": "Hi {{first_name}}, reminder: our annual gala is this Saturday at 6pm. We'd love to see you there! - {{foundation_name}}",
"merge_fields": ["first_name", "foundation_name"]
}

Templates are reference content that can be copied into campaigns and sequence steps. When creating a campaign or sequence step, you can start from a template and customize the content.

The body content from a template is used as the starting point — it is copied into the campaign or step, not referenced. Changes to a template do not retroactively affect previously sent messages.

MethodPathDescription
GET/api/message-templatesList all templates
POST/api/message-templatesCreate a template
GET/api/message-templates/{id}Show a template
PUT/api/message-templates/{id}Update a template
DELETE/api/message-templates/{id}Delete a template

All endpoints follow Laravel’s apiResource conventions and are scoped to the authenticated user’s foundation.