Reminders for multiple upcoming trips

Updated

Introduction

This recipe is useful for multiple upcoming trips but you can also adapt it for these use cases:

  • Encourage a shopper to purchase their abandoned cart even when it’s possible for the user to have multiple carts.
  • Let a customer know that one of their many saved coupons is expiring soon.
  • Notify users when one job of many they’ve applied for is closed.

The idea is that sometimes people can have multiples of one thing - trips, carts, coupons, and job applications - and you may want to target a specific trip, cart, etc during a campaign. This recipe helps you do that!

We’ll create a campaign that reminds people to book a hotel for their upcoming trip. Since a customer can have multiple upcoming trips, we’ll make sure the reminder is about the correct trip and sent at the correct time.

Ingredients

  • Basic knowledge of liquid
  • Ability to send events to Customer.io

Method

This recipe will create two campaigns, one triggered by a trip_booked event and another by a hotel_booked event. You’ll store an attribute on people’s profiles, trips_with_hotel_booked, to track which trips already have a hotel booked. This way, you can ensure you only send the reminder to book a hotel for any trips not in that list.

Campaign 1: Hotel is booked

Since we want to send a reminder if a hotel has not been booked, we need to track which trips include hotels. This campaign will do nothing more than add the trip’s trip_id to a comma separated list of ids in an attribute on the person’s profile indicating that they’ve booked the hotel— trips_with_hotel_booked. This is the attribute that is checked prior to sending the reminder in the campaign we’ll build next.

Send the event

You’ll want to send an event into Customer.io for the user when they complete booking a hotel. In this example, we’re calling it hotel_booked. The event can contain any information about the hotel that you wish to include for use in other messages (maybe a confirmation email) that are triggered by the same event instance, but for the purposes of this capability, the only necessary attribute is the trip_id.

{
    "trip_id": "123"
}

For more details on sending events into Customer.io see our API documentation.

Create the campaign

Now that the event is sending to Customer.io, you can use it to trigger a campaign.

  1. Go to Campaigns.
  2. Click Create Campaign.
  3. Click Choose trigger.
  4. Select Event and choose hotel_booked.
multiple_reminders__hotel-booked-event
multiple_reminders__hotel-booked-event

The workflow

The only item necessary in this workflow is an attribute update to add the trip_id to the comma separated list of ids named, trips_with_hotel_booked.

Drag a Create or update person action into your workflow. Click it then choose Add details.

multiple_reminders__attribute-update-hotel-booked
multiple_reminders__attribute-update-hotel-booked

The liquid for this update:

{% if customer.trips_with_hotel_booked != blank %}
  {{customer.trips_with_hotel_booked}},{{event.trip_id}}
{% else %}
  {{event.trip_id}}
{% endif %}

If the attribute doesn’t exist on the profile already, the Create or update person action will add it.

This is the only workflow item required to make this use-case work, but adding a confirmation email to this workflow would be an excellent way to manage the entire hotel booking process in one campaign.

multiple_reminders__campaign1-workflow
multiple_reminders__campaign1-workflow

Campaign 2: Trip is initially booked

You’ll create a campaign triggered by the initial booking event. This will be the campaign that sends the reminder message a specified amount of time after the initial booking.

Send the event

Just like the first campaign, you’ll want to send an event into Customer.io for the user when they complete booking their trip. In this example, we’re calling it trip_booked. This event should contain any information about the trip that you care to include in the email reminding them to book their hotel. We’ve included destination, confirmation number, and trip_date. It also needs to include a unique identifier for the event. We’ve used trip_id in this example:

{
    "trip_id": "123",
    "destination": "Melbourne, Australia",
    "confirmation": "N35RTX",
    "trip_date": "28-OCT-2020"
}

For more details on sending events into Customer.io see our API documentation.

Create the campaign

Now that the event is sending to Customer.io, you can use it to trigger a campaign.

  1. Go to Campaigns.
  2. Click Create Campaign.
  3. Click Choose trigger.
  4. Select Event.
multiple_reminders__trip-booked-event
multiple_reminders__trip-booked-event

The workflow

The first item your workflow needs to contain is a delay set to the amount of time you’d like to wait before sending the reminder. In this case, we’ll remind them after 10 days.

multiple_reminders__delay
multiple_reminders__delay

Once someone waits 10 days and exits the delay, we want to check whether they’ve booked the hotel for this trip yet. If not, we’ll send them a reminder to do so. To create this logic, add a True/False Branch to the workflow. In this case, you want to check whether the trips_with_hotel_booked attribute for this person contains the trip_id for this event. To do this, use the ‘attribute condition’ in the True/False Branch.

multiple_reminders__add-attribute-condition
multiple_reminders__add-attribute-condition

Enter the attribute trips_with_hotel_booked and then select the option to compare it to an event attribute. And finally, enter trip_id as the event attribute to check.

multiple_reminders__event-attribute
multiple_reminders__event-attribute

If the hotel has been booked for this trip, we don’t need to send them a reminder, but we do want to clear the trip_id from the trips_with_hotel_booked to clean things up and make sure the attribute doesn’t hit length limits. To do this, add a Create or update person action to the True branch.

multiple_reminders__campaign2-workflow
multiple_reminders__campaign2-workflow

This should update the trips_with_hotel_booked attribute by removing it from the list. Here’s the liquid for this update:

{% assign trips = trips_with_hotel_booked | split: "," %}
{% assign updated_trips = "" %}
{% for trip in trips %}
  {% if trip != "" and trip != event.trip_id %}
    {% if updated_trips != blank %}
      {% assign updated_trips = updated_trips | append: "," %} 
    {% endif %}
    {% assign updated_trips = updated_trips | append: trip %}
  {% endif %}
{% endfor %}
{{updated_trips}}

The reminder email

Now the fun part! With the data in the original trip_booked event, you can craft a personalized email reminding and encouraging them to book their hotel for the trip.

multiple_reminders__email
multiple_reminders__email

The final workflow

To recap, this campaign will hold the person in a delay for 10 days after booking the trip. After 10 days have passed, it will check whether they’ve booked a hotel for the trip. If so, it will simply clean up the attribute tracking that hotel booking, but if not, it will send a reminder to book a hotel for that particular trip. The workflow should look something like this:

multiple_reminders__campaign2-final-workflow
multiple_reminders__campaign2-final-workflow

Wrap Up

Using profile attributes to store status of multiple active trips on the customer account is a great way to customize your messaging for each of those trips. If this approach doesn’t work for you, though, or you need help getting it set up, send us a message!

Copied to clipboard!
  Contents
Is this page helpful?