Email templates

Email templates

Email template webhooks are emitted by the Accounts API when email templates are created, updated, or deleted.

Events

Action Event name
create an email template (POST /email-templates) emailtemplates.created
create a sub email template (POST /sub-email-templates) emailtemplates.created
update an email template (PUT /email-templates/:emailTemplateId) emailtemplates.updated
roll back to a version (PUT /email-templates/:emailTemplateId/versions/:versionId) emailtemplates.updated
delete an email template (DELETE /email-templates/:emailTemplateId) emailtemplates.deleted

Payload example (emailtemplates.created / emailtemplates.updated)

The data field contains the full email template object (same shape as the API response body emailTemplate).

{
  "providerId": "5f243d100617680712e78dd7",
  "apiKey": "string",
  "data": {
    "_id": "5f243d100617680712e78dd7",
    "accountId": "5f243d100617680712e78dd7",
    "name": "string",
    "type": "cancellation",
    "subject": "string",
    "lang": "en-us",
    "htmlTemplate": "string",
    "txtTemplate": "string",
    "channel": "any",
    "status": "published",
    "templateCollectionId": "default",
    "mainTemplateId": "string",
    "mainTemplateAccountId": "string",
    "createdBy": "string",
    "updatedBy": "string",
    "createdAt": { "offset": "int", "value": "string" },
    "updatedAt": { "offset": "int", "value": "string" },
    "versions": []
  }
}

Payload fields (emailtemplates.created / emailtemplates.updated)

Field Type Description
providerId string Account ID of the provider that owns the template (24-character hex ObjectId)
apiKey string API key used for the request (X-API-KEY header)
data object The email template document. For structure see GET /email-templates/:emailTemplateId response; may include _id, accountId, name, type, subject, lang, htmlTemplate, txtTemplate, channel, status, templateCollectionId, mainTemplateId, mainTemplateAccountId, createdBy, updatedBy, createdAt, updatedAt, versions

Payload example (emailtemplates.deleted)

{
  "providerId": "5f243d100617680712e78dd7",
  "apiKey": "string",
  "data": {
    "emailTemplateId": "5f243d100617680712e78dd7"
  }
}

Payload fields (emailtemplates.deleted)

Field Type Description
providerId string Account ID of the provider (24-character hex ObjectId)
apiKey string API key used for the request (X-API-KEY header)
data.emailTemplateId string The ID of the deleted email template (24-character hex ObjectId)