Skip to content

MailerFireTrigger

POST mailer/trigger/fire

Fires an event by hand, exactly as the platform would. Use it to test a trigger and its templates without waiting for the real event.

The answer says how many emails the event produced and which triggers are subscribed to it — a queued: 0 with a non-empty knownTriggers means the templates or the payload are at fault, not the subscription.

Access Control

Allowed role: admin. The event is processed under the brand of the caller.

Request

POST https://{broker_domain}/mailer/trigger/fire
{
  "event": "crm.customer.deposit",
  "data": {
    "client": {
      "email": "[email protected]"
    },
    "payment": {
      "sum": "250 EUR"
    },
    "sendToParentType": "CUSTOMER",
    "sendToParentId": 140
  }
}
{
  "command": "MailerFireTrigger",
  "extID": "1",
  "data": {
    "event": "crm.customer.deposit",
    "data": {
      "client": {
        "email": "[email protected]"
      },
      "payment": {
        "sum": "250 EUR"
      },
      "sendToParentType": "CUSTOMER",
      "sendToParentId": 140
    }
  }
}
const res = await platform.MailerFireTrigger({
  event: "crm.customer.deposit",
  data: {
    client: {
      email: "[email protected]"
    },
    payment: {
      sum: "250 EUR"
    },
    sendToParentType: "CUSTOMER",
    sendToParentId: 140
  }
});

Request Data

Field Type Required Description
event string Yes Event name to fire
data object Yes Event payload, as the platform would send it

Response Data

{
  "event": "crm.customer.deposit",
  "queued": 1,
  "knownTriggers": [2]
}

Errors

Code Error Description
400 VALIDATION_ERROR Missing event name or payload
403 PERMISSION_DENIED Not an admin session