Personalize Automations and Journeys Using Custom Events

When you trigger automated messages and journeys from custom events, you can personalize your messages with values from the custom event trigger.

Custom events help you track user activities and conversions from your app, website, etc. You can use HandlebarsAirship’s message personalization syntax using double curly braces, more commonly known as {{handlebars}}. Use handlebars to insert variables and conditional logic in messages and templates. to populate automated messages with values from custom events, so that your automated messages are relevant to each individual in your audience.

Custom events are associated with a channel or a named user and carry properties that you can use to trigger and personalize your messages.

Start by creating an automation or a journey using the Custom Event trigger, and select one or more custom eventsEvents that indicate that a user performed a predefined action, such as adding an item to a shopping cart, viewing a screen, or clicking an Unsubscribe button. Custom events can trigger automation and journeys. You can code them into your app or website, or send them to Airship from an external source using the custom event API. Custom events contain properties that you can use to personalize messages. (or event properties) to trigger the automation or journey.

When writing your message, you can reference properties from the custom event trigger in your message or template. For example, you could iterate over the items a user purchased by referencing an “items_purchased” property.

{{#each items_purchased}}
{{qty}} x {{item_name}} = {{item_total}}

If you reference a property that is not in an event, is null, or empty, the reference will be empty in your message, and your message may not make sense. Use $def set default values, so that your message still makes sense if variables are empty or absent. For example, {{$def name "you"}} would insert you in the message if the name property in your custom event is empty or missing.

Custom Event Personalization Example

For example, if you have a custom event representing a purchase, you can send an automated message confirming the purchase and providing information about what the user bought.

Custom Event

   "occurred": "{{event_time}}",
   "user": {
      "named_user_id": "user"
   "body": {
        "name": "purchase",
        "subscribe": true,
        "properties": {
            "customer_name": "user",
            "total": 48,
            "cost_units": "USD",
            "purchase": [
                    "qty": 4,
                    "item": "MLB regulation baseball",
                    "per": "$12",
                    "total": "$48"

Message Content

Hi {{$def customer_name "valued customer"}}!

Thanks for your purchase of:
{{#each purchased}}
{{qty}}x  {{per}}  {{item}} = {{}}
total: ${{total}}

Is being processed. We'll message you again when it ships!