Skip to content

CMS SendGrid Template System

Overview

The CMS email system uses SendGrid Dynamic Templates.

For each email send, we call the SendGrid Tools plugin and pass payload data through dynamic_template_data. That means your SendGrid template can directly use placeholder values such as:

text
{{user.firstname}}
{{siteDomain}}
{{course.name}}

The final payload always includes:

  • user: the user instance passed to the send call
  • siteDomain: process.env.FRONTEND_DOMAIN
  • additional template-specific data (for example course, credit, creditsSender, creditsRecipient, etc.)

Where Templates Are Connected In The CMS

To map each predefined CMS email type to a concrete SendGrid template ID:

  1. Go to Settings.
  2. Open Sendgrid tools plugin.
  3. Open Configuration.
  4. Select a SendGrid dynamic template for each CMS email type.
  5. Save configuration.

Predefined CMS Email Types

These are the predefined email types registered by CMS:

Base dynamic_template_data Shape

All CMS emails include this base:

json
{
  "user": {
    "documentId": "usr_123",
    "firstname": "Jane",
    "lastname": "Doe",
    "email": "[email protected]",
    "dnc": false
  },
  "siteDomain": "calpg.org",
  "cmsUrl": "https://cms.calpg.online"
}

Notes:

  • user can contain additional first-level fields depending on where the send call is made.
  • SendGrid delivery is skipped when user.dnc is true.
  • Only first-level properties should be relied on for template design.

Template Data Per Email Type