Send a Transactional Message
Transactional messages are messages triggered from code in response to an action taken by a user in your app.
Common use cases for transactional messages include:
- Purchase receipts
- Order confirmations
- Registration confirmations
- Password resets
- Trial expiration reminders
- Comment notifications
- Event reminders
- Shipping updates
- Support and feedback requests
- Referrals and invitations
In Customer.io, transactional messages are triggered when a user performs a specific event, like purchasing an item. This recipe shows you how to send a person a purchase receipt when they place an order.
There are two ways to send a transactional message. Option 1: Transactional API Use the Transactional API to send a message directly from your app after a customer performs an action. The Transactional API currently only supports email messages. For other messaging channels, use Option 2. Learn more about the Transactional API.
Option 2: Send an event and trigger a campaign When a customer performs an action in your app (like purchasing an item), you send a corresponding event to Customer.io. We use this event to trigger a campaign containing the transactional message(s) you want to send.
For this example, we’ll demonstrate Option 2 by setting up a Campaign that is triggered when a customer makes a purchase. We’ll include additional workflow actions to keep count of customer purchases, and send a follow-up discount a day later to thank them for their loyalty.
For this recipe, we’ll send this
purchase event into our workspace.
curl -i https://track.customer.io/api/v1/customers/:id/events \ -X POST \ -u YOUR-SITE-ID-HERE:YOUR-SECRET-API-KEY-HERE \ -d name=purchase \ -d data[price]=13.45 \ -d data[product]=socks
We can confirm that this event appears in our workspace by going to the Activity Log and filtering for events. A
purchase event should appear for the customer corresponding to the
id in the request.
After you verify that your event appears in your workspace, go to Campaigns > Create Campaign. Give your campaign a name that makes its purpose clear so you can track it later (in this case, we used Order Confirmation).
Choose the An event is performed option for your campaign and search for the event name
purchase into the Trigger Event text field.
A trigger is evaluated at the start of a campaign—if a user performs the
purchase event, they’re added to the campaign. You can refine the trigger by adding an event data filter or add other Filters and Frequency limits. You can find more details about campaign options here.
Click Save to continue to the next step. In the Workflow Builder, you have full control over the content and schedule of your messages. A campaign can be simple and include one message—a receipt for the purchase.
For our example, we’ve added additional actions to showcase a few of our most popular features:
- An attribute update to keep an internal order count for the customer
- A transactional email receipt, framed as a thank you message
- A T/F branch to determine if this purchase is the customer’s first purchase
- A one-day delay, so the customer isn’t bombarded with emails
- A follow-up email offering a discount on their next order.
These options can turn simple transactional messages into powerful campaigns that build customer loyalty through automated, yet personalized, messages.
After you create a workflow you can choose a goal and set exit conditions. This optional step powers conversion metrics, helping you track the success of your campaign. You can choose an event or relevant segment (like a person making a second purchase); if a person performs the event or enters/exits that segment after they receive, open, or click a tracked link in a message, we’ll attribute a conversion to your message. Learn more about goals and exit conditions here.
It’s time to review your setup. Check it out and see if there are any errors or any missing workflow pieces. Make sure that youre campaign’s timing, email names, and sending behaviours are to your liking. When you’re satisfied with the campaign, click Start, and that’s it! Go to the campaign’s overview page after the emails start sending to see how your campaign performs.
If you set your emails’ sending behavior to draft so that you can make sure that your messages perform normally, remember you’ll have to change to Send Automatically to reach your customers.
Transactional messages are an essential part of any business and are often underutilized by product and marketing teams.
Good transactional emails are timely, personalized, and provide value to your audience (and company). In our example, the first email is a receipt, but also thanks the customer for their business. The last email rewards customers for their first order and sets them on a path to becoming loyal, repeat customers.
We hope this guide provides both instruction and inspiration for your transactional messages! If you have any questions about the process or how to apply it to your business, please send us a message!