Skip to main content

Triggers API

Triggers define what event fires the email sequence, who receives it, and optional targeting rules. All endpoints require authentication.

Trigger object

FieldTypeDescription
idIntUnique identifier (read-only)
titleStringTrigger name
descriptionStringOptional description
campaign_idStringParent campaign ID
eventStringEvent identifier — see Available Events
cancellation_eventString[]Array of event identifiers that cancel this trigger
eventsString[]Event identifiers for event (read-only, same as event wrapped in an array)
triggering_eventsString[]Alias for events (read-only)
cancellation_eventsString[]Identifiers for cancellation_event items (read-only)
is_activeBooleanWhether the trigger is active
sender_emailStringSender email address (leave empty to use store default)
sender_nameStringSender display name (leave empty to use store default)
active_fromStringStart date for trigger activity (YYYY-MM-DD HH:MM:SS), or "" for no limit — do not pass null, use ""
active_toStringEnd date for trigger activity (YYYY-MM-DD HH:MM:SS), or "" for no limit — do not pass null, use ""
store_idsInt[]Restrict to specific store views; empty array = all stores
is_adminInt1 sends a copy to the admin email, 0 does not
admin_emailStringAdmin copy recipient
event_paramsStringJSON-encoded event parameters (see Available Events)
rule_serializedStringJSON-encoded audience condition tree (flat path-key format — see Notes); "" = no filter
trigger_typeStringAlways "" — reserved field
scheduleStringAlways "" — reserved field
ga_sourceStringGoogle Analytics utm_source
ga_mediumStringGoogle Analytics utm_medium
ga_nameStringGoogle Analytics utm_campaign
ga_termStringGoogle Analytics utm_term (paid keyword or audience segment)
ga_contentStringGoogle Analytics utm_content (link variant for A/B testing)
copy_emailStringBCC this address on every email sent by this trigger; "" to disable
created_atStringCreation timestamp (read-only)
updated_atStringLast update timestamp (read-only)

cancellation_event, events, triggering_events, and cancellation_events are read-only arrays returned on GET. Use the cancellation_event field on POST/PUT to set cancellation events.

List triggers

GET /rest/V1/mst-email/triggers

Supports filtering and pagination.

Get trigger

GET /rest/V1/mst-email/triggers/:id

Response:

{
"id": 5,
"title": "Abandoned Cart - Day 1",
"description": "",
"campaign_id": "2",
"event": "quote_abandoned",
"cancellation_event": ["order_new"],
"events": ["quote_abandoned"],
"triggering_events": ["quote_abandoned"],
"cancellation_events": ["order_new"],
"is_active": true,
"sender_email": "",
"sender_name": "",
"active_from": "",
"active_to": "",
"store_ids": [],
"is_admin": 0,
"admin_email": "",
"event_params": "{\"abandoned_after_minutes\":60}",
"rule_serialized": "{}",
"trigger_type": "",
"schedule": "",
"ga_source": "email",
"ga_medium": "follow-up",
"ga_name": "abandoned-cart",
"ga_term": "",
"ga_content": "",
"created_at": "2026-02-01 10:00:00",
"updated_at": "2026-05-15 08:45:00"
}

Errors: 404 trigger not found.

Create trigger

POST /rest/V1/mst-email/triggers

Request body:

{
"trigger": {
"title": "Post-Purchase Review Request",
"description": "",
"campaign_id": 1,
"event": "order_new",
"cancellation_event": [],
"is_active": true,
"sender_email": "",
"sender_name": "",
"active_from": "",
"active_to": "",
"store_ids": [],
"is_admin": false,
"admin_email": "",
"event_params": "{}",
"rule_serialized": "{}",
"trigger_type": "",
"schedule": ""
}
}

Response: the created trigger object with id assigned.

Update trigger

PUT /rest/V1/mst-email/triggers/:id

PUT is a partial update — send only the fields you want to change; omitted fields retain their current values. Note: store_ids is not accepted on PUT; set it only during creation.

Request body: same structure as Create trigger.

Response: the updated trigger object.

Errors: 404 trigger not found.

Delete trigger

DELETE /rest/V1/mst-email/triggers/:id

Response:

true

Errors: 404 trigger not found.

Duplicate trigger

Copies the trigger along with all its chains.

POST /rest/V1/mst-email/triggers/:id/duplicate

No request body required.

Response: the newly created trigger object.

Errors: 404 source trigger not found.

Copy trigger to campaign

Copies the trigger (and its chains) into a different campaign.

POST /rest/V1/mst-email/triggers/:id/copy

Request body:

{
"campaignId": 3
}

Pass "move": true to move the trigger instead of copying it (the original is deleted).

Response: the newly created trigger object in the target campaign.

Errors: 404 source trigger or target campaign not found.

Send test email

Sends a test email for this trigger to the specified address.

POST /rest/V1/mst-email/triggers/:id/send-test

Request body:

{
"email": "[email protected]"
}

Response:

true

Errors: 404 trigger not found, 400 invalid email address.

Notes

Cron-based events (quote_abandoned, customer_birthday, customer_no_activity, etc.) require Magento cron to be configured and running. See Available Events for the full list.

rule_serialized is a JSON-encoded Magento rule condition tree using a flat path-key structure. The easiest way to get a valid value is to configure conditions in the admin UI and then GET /rest/V1/mst-email/triggers/:id — copy the rule_serialized field and adapt it.

Expanded example — customer group is one of General or Wholesale AND order placed on or after 2026-06-01:

{
"conditions": {
"1": {
"type": "Mirasvit\\EmailEvent\\Model\\Rule\\Condition\\Combine",
"aggregator": "all",
"value": "1",
"new_child": ""
},
"1--1": {
"type": "Mirasvit\\EmailEvent\\EventData\\Condition\\CustomerCondition",
"attribute": "group_id",
"operator": "()",
"value": ["1", "3"]
},
"1--2": {
"type": "Mirasvit\\EmailEvent\\EventData\\Condition\\OrderCondition",
"attribute": "created_at",
"operator": ">=",
"value": "2026-06-01"
}
}
}

Key rules:

  • Path keys: "1" = root Combine, "1--1" = first child, "1--2" = second child, "1--1--1" = nested grandchild.
  • Root "1" is always a Combine node. aggregator: "all" = AND, "any" = OR.
  • value format depends on the operator: () and !() (is one of / is not one of) take a JSON array of string IDs — ["1","3"]. All other operators (==, !=, >=, <=, {}, !{}) take a plain string.
  • Condition type class names: Mirasvit\EmailEvent\Model\Rule\Condition\Combine for group nodes; Mirasvit\EmailEvent\EventData\Condition\CustomerCondition, OrderCondition, QuoteCondition, etc. for leaves.
  • Pass "" for no conditions (trigger fires for all recipients).

event_params is a JSON-encoded string, not an object. Always serialize it:

{
"event_params": "{\"expire_after\": 3600}"
}

Retrieve the valid parameter names for each event from Available Events.