Skip to main content

Triggering an automation using custom events

Start an automation from an event your own systems send, using a spend milestone reward as the example.

Overview

A custom trigger starts an automation from an event your own systems send to SmartrMail, instead of something that happens in your store. Your app or platform sends the event to a webhook URL that SmartrMail gives you, and each event starts the automation for the person it names.

This guide uses one example from start to finish: when a customer reaches a spend milestone, send them a reward email with a coupon code.
​

Starts when someone… → Create custom trigger → name it → copy the webhook URL → paste a sample event → map fields → Save trigger

Key benefits

  • Events from anywhere: a loyalty tier upgrade, an in-store or POS sign-up, a CRM update or a subscription milestone.

  • Personal details from the event: fields such as a coupon code or points total can go straight into the email.

  • Same editor as every automation: add emails, SMS, waits and splits after the trigger.

Before you start

Decide which event should start the automation, and check that the system where it happens can send a webhook. In our example, your store or loyalty app needs to notice when a customer’s spend passes the milestone and send SmartrMail an event at that moment.

Every event must include the customer’s email address. SmartrMail uses it to find the profile the automation runs for.

How to create a custom trigger

  1. Go to Send → Automations.
    ​

    sidebar with Send → Automations selected and the Automations list
  2. Click New automation.
    ​

    Automations page with the New automation button highlighted
  3. Click Start from scratch.
    ​

    New automation page with the Start from scratch card highlighted
  4. Click the first step, Choose what starts this automation. Under Starts when someone…, find Custom triggers and click Create custom trigger.
    ​

    trigger panel
  5. In the Create custom trigger window, step 1 of 3, type a Trigger name that describes when the event happens, for example “hits a spend milestone”. Click Continue.
    ​

    Create custom trigger window, Step 1 of 3: Starts when someone + Trigger name field, Cancel / Continue
  6. In step 2, copy the SmartrMail webhook endpoint with Copy URL. Paste it into your source app’s webhook settings.

  7. Send an event from your app. When it arrives, Status changes from Waiting for an event to Event received. No time to wait? Click Paste a sample event instead and paste an example event, like the one below. Click Continue.
    ​

    Step 2 of 3: SmartrMail webhook endpoint with Copy URL, Status: Event received, and the pasted sample event below Paste a sample event instead
  8. In step 3, map your event fields. Each field in the event is listed under Field in the event. For each one, choose an Automation variable: map your email field to Email, choose a new text, number, date or link value for details you want in your emails, or choose Skip.
    ​

    Step 3 of 3: Map your event fields table
  9. Click Save trigger.

Here is a sample event for our example. each key is in double quotes, and every line but the last ends with a comma:

{
"email": "[email protected]",
"total_spend": "5000",
"coupon_code": "REWARD5K",
"valid_until": "31/12/2026"
}

Good to know: setting up the trigger
​

Email is required: every custom trigger needs a field mapped to Email. Without it the window shows “Every custom trigger needs an email field.”

Required fields: tick Required next to a field in step 3 if your emails need it. An event that arrives without a required field is dropped and doesn’t start the automation.

Valid JSON only: if the sample can’t be read, you’ll see “This isn’t valid JSON.” A missing comma or quote is the usual cause.

Change it later: click the trigger and then Edit custom trigger to rename it or change the mapping.

Add the reward email

  1. Click the + below the trigger. Under Send, click Email.

  2. Enter a Name and Subject line, then click Edit email.

  3. Write your reward email: a thank-you, the coupon code and any loyalty message. To show the coupon code from the event, add it as a personalized field. See Use custom event fields in your emails.
    ​

    custom trigger automation on the canvas with the reward email step selected and its panel open
  4. Click Turn on in the email editor, then go back to the automation.

For more on email steps, see Add an email to an automation.

Turn on and test

  1. Click Turn on at the top right of the editor, check the summary, then click Turn on in the window. The automation can’t turn on until the custom trigger is set up with an email field.

  2. Send a test event from your app with your own email address.

  3. Check that the reward email arrives and that the coupon code shows up in it.

Good to know: how events are handled
​

Only after turning on: events that arrive before the automation is on don’t start it.

Every event counts: each event starts the automation again for that person, so send one event per milestone.

New email addresses: if no profile has the event’s email, SmartrMail creates one that isn’t subscribed to your email marketing.

Who gets the emails: custom trigger emails can reach people who haven’t subscribed to your marketing. Anyone who unsubscribed, bounced or marked your email as spam is skipped. Only send events for people you have permission to email.

Keep the webhook URL private: anyone who has it can send events to this automation. Paste it only into your own app or platform.


FAQs

Click a question to open it.

Where do I find the webhook URL again?

Click the trigger in the automation. The panel shows the SmartrMail webhook endpoint with a Copy button, and the fields it reads under Fields we read.

Can one webhook URL start several automations?

No. Each custom trigger automation has its own URL. Send each kind of event to the URL of the automation it should start.

Can I limit who enters?

Yes. Once the trigger is set up, click it and use Filter who enters to add rules.

The status stays on Waiting for an event.

Check that your app is sending to the exact URL you copied. You can carry on by clicking Paste a sample event instead and pasting an example from your app’s documentation.


Need a hand with custom triggers?

Our team is happy to help. Book a 1:1 call with the SmartrMail team and we’ll set it up with you.

Did this answer your question?