SMS templates
SMS template webhooks are emitted by the Accounts API when SMS templates are created, updated, or deleted.
Events
| Action | Event name |
|---|---|
| create an SMS template (POST /sms-templates) | smstemplates.created |
| create a sub SMS template (POST /sub-sms-templates) | emailtemplates.created |
| update an SMS template (PUT /sms-templates/:smsTemplateId) | smstemplates.updated |
| roll back to a version (PUT /sms-templates/:smsTemplateId/versions/:versionId) | smstemplates.updated |
| delete an SMS template (DELETE /sms-templates/:smsTemplateId) | smstemplates.deleted |
Note: POST /sub-sms-templates currently emits emailtemplates.created (same event name as email template sub-create). Subscribe to emailtemplates.created if you need to be notified when a sub SMS template is created.
Payload example (smstemplates.created / smstemplates.updated)
The data field contains the full SMS template object (same shape as the API response body smsTemplate). SMS templates have txtTemplate (no htmlTemplate or subject).
{
"providerId": "5f243d100617680712e78dd7",
"apiKey": "string",
"data": {
"_id": "5f243d100617680712e78dd7",
"accountId": "5f243d100617680712e78dd7",
"name": "string",
"type": "cancellation",
"lang": "en-us",
"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 (smstemplates.created / smstemplates.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 SMS template document. See GET /sms-templates/:smsTemplateId response; includes _id, accountId, name, type, lang, txtTemplate, channel, status, templateCollectionId, mainTemplateId, mainTemplateAccountId, createdBy, updatedBy, createdAt, updatedAt, versions |
Payload example (smstemplates.deleted)
{
"providerId": "5f243d100617680712e78dd7",
"apiKey": "string",
"data": {
"smsTemplateId": "5f243d100617680712e78dd7"
}
}
Payload fields (smstemplates.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.smsTemplateId | string | The ID of the deleted SMS template (24-character hex ObjectId) |