SmsAddTrigger¶
POST sms/trigger
Subscribes a platform event to templates: when the event fires on the bus, the module renders every enabled template of this trigger and queues the messages.
merge renames event fields into placeholder names. Without it every event schema change
would require editing the templates instead of one trigger.
Access Control¶
Allowed role: admin. The trigger belongs to the brand of the caller unless global is set.
Request¶
POST https://{broker_domain}/sms/trigger
{
"event": "crm.customer.deposit",
"merge": {
"client.msisdn": "phone",
"payment.sum": "amount"
},
"type": "PRIVATE",
"status": "ENABLED"
}
{
"command": "SmsAddTrigger",
"extID": "1",
"data": {
"event": "crm.customer.deposit",
"merge": {
"client.msisdn": "phone",
"payment.sum": "amount"
},
"type": "PRIVATE",
"status": "ENABLED"
}
}
const res = await platform.SmsAddTrigger({
event: "crm.customer.deposit",
merge: {
"client.msisdn": "phone",
"payment.sum": "amount"
},
type: "PRIVATE",
status: "ENABLED"
});
Request Data¶
| Field | Type | Required | Description |
|---|---|---|---|
event |
string | Yes | Bus event name to subscribe to, for example crm.customer.deposit |
description |
string | No | Free-form note |
merge |
object | No | Rename event fields for templates, { "client.msisdn": "phone" } |
arguments |
object | No | Extra static values passed to templates |
type |
enum | No | PRIVATE (default) or PUBLIC |
status |
enum | No | ENABLED (default) or DISABLED |
global |
bool | No | true — the trigger works for every brand |
Behavior¶
- Subscriptions are refreshed from the database by a cron, so a new trigger starts working without restarting the module. SmsGetTriggerSubscriptions shows what is live right now.
- The event payload must resolve to a phone number after
merge; an event without one is counted as an error rather than sent to a blank recipient. - A
globaltrigger fires for every brand — use it for platform-wide notifications, not for brand campaigns.
Response Data¶
{
"id": 2,
"brand": "default",
"event": "crm.customer.deposit",
"description": null,
"merge": { "client.msisdn": "phone", "payment.sum": "amount" },
"arguments": null,
"type": "PRIVATE",
"global": false,
"status": "ENABLED",
"createdAt": "2026-08-24 13:18:02"
}
Errors¶
| Code | Error | Description |
|---|---|---|
400 |
VALIDATION_ERROR |
Missing event name, or a reserved service prefix was used |
500 |
INTERNAL_ERROR |
Storage error |