How to Create a Custom Event API Call

Sendlane’s API allows you to create custom events that can be used to trigger Automations.

In this guide, we’ll set up an event and Automation that sends emails containing password reset links to Contacts who have requested to reset their password.

🚦 Before Getting Started

  1. Set up a Sendlane Custom Integration
  2. Review Sendlane's custom event API documentation

 Create a Custom Event

Go to your completed Sendlane Custom Integration and click the Events icon. On the Events page, click Create Event > Enter a descriptive name > Create.

We’ll name our example event password-reset.


 Create an API Call

Use a JSON snippet like the following to build a password reset request API call:

   "token": "CUSTOM_EVENT_TOKEN",
   "email": ""
   "custom_event": "CUSTOM_EVENT_NAME",
   "data": {
     "password_reset_url": ""
  • custom_event - Your custom event’s name (our example event’s name is password-reset)


 Create an Automation Triggered by Custom Event

Create an Automation and select the Custom Event trigger from the Custom integration tab.

Trigger Options

Store - Select your store

Event - Select the password-reset event

Limit Per Contact - Select a limit for how and when Contacts are sent through the Automation. For our password reset example, select No Limit so Contacts can reset their password as many times as needed.

  • No Limit - The Contact will be sent through the Automation whenever the trigger conditions are met
  • Do not trigger when already in Automation - If the trigger conditions are met but the Contact is already being sent through the Automation, the Contact will not trigger the Automation again
  • Once Per Day - If the trigger conditions are met but the Contact has already triggered the Automation on the same day, the Contact will not trigger the Automation again
  • One Time Only - Contacts will only trigger the Automation one time

Add a Wait Node

Add a wait node of as the first step of the Automation. For our password reset example, we’ll use 1 minute. Wait nodes default to a 1 hour wait.

Add an Email Node

Create an email node and use Twig templating syntax to pull in data from the payload. Sendlane supports a subset of the Twig language.


Creating variables allows you to populate data in your email using templating syntax.

For our password reset example, we’ll want to be able to populate the name of our event and data from the payload in our API call. We’ll need two variables; name to access the event’s name and data to access data from the payload, including a URL to the password reset page.

To create variables, add a text box element to your email, then copy and paste the following snippets into the text box. The snippets will not be visible to Contacts who receive your email, they are only visible to you inside the Sendlane email builder.

{% set name = trigger.getCustomEventName() %}
{% set data = trigger.getCustomEventData() %}

Once these variables are in place, they can be used to populate data!

Populating Data in an Email

In step 2, we made the API call with the following JSON payload

   "token": "1234abcd5678edfg",
   "email": "",
   "custom_event": "password-reset",
   "data": {
     "password_reset_url": ""

Now that we’ve set up our data variable, we can access the password_reset_url via Twig


Pasting this snippet directly into the email will display a raw password reset link. Use the hyperlink function in the email builder or a custom HTML block to hyperlink the URL.

In the email below, our password_reset_url is made into a hyperlink, and our variable scripts disappear when the email is previewed.

Additional Resources

Did this answer your question? Thanks for your feedback! There was a problem submitting your feedback. Please try again!