Send a Transactional Message
- 4 Minutes To Read
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 purchases an item. This recipe will show you how to set up a purchase receipt in Customer.io that sends after a user places an order.
There are two methods for triggering transactional messages.
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 that is then used to trigger a Campaign
When a customer performs an action in your app (ie purchases an item), a corresponding event is sent into Customer.io. This event is used to trigger a Campaign, which contains the transactional messages to send.
For this example, we’ll demonstrated 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.
Let’s get started!
Prep for the campaign
For this recipe, we'll send the following
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 is successfully shown in our workspace by navigating to the Activity Log and filtering for Events. A
purchase event should be logged for the customer corresponding to the
id sent in the request.
Create an event-triggered campaign
Once the event is present in the workspace, click Campaigns, followed by Create Campaign. Give your campaign a name that makes its purpose clear so you can track it later (in this case, I’ve 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 further configure the campaign with Filters and Frequency limits. More about all the available campaign options can be found here.
Build your workflow
Click Save to continue to the next step of building your workflow. 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
- Our 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 delay of one day so the customer isn't bombarded with emails, and
- 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.
Set a Goal and Exit Conditions (optional)
After creating the workflow, the next step allows you to choose a Goal and set Exit Conditions. This optional step powers the conversion tracking metric in Customer.io campaigns. It allows you to track the success of your campaign, so you'll want to choose a relevant segment (ie a person making a second purchase). If a person enters/exits that segment after being sent a message, they'll be tracked as a conversion. Learn more about goals and exit conditions here.
Review and Activate your campaign
Once you're done with the campaign setup, it’s time to review your setup. Check it out at a glance and see if there are any errors or anything missing. Check timing, email names, and sending behaviours until they’re exactly what you need. Once you're satisfied with the campaign, click start, and that’s it! You can head over to the campaign’s overview page after the emails start sending, to get an insight into its performance.
If you've set your emails' sending behavior to draft to check how your campaign will run, remember you'll have to set to "Send Automatically" to reach your customers.
Transactional messages are an essential part of any business and can often be under utilized by product and marketing teams.
Good transactional emails are timely, personalized, and can be used with different techniques and framings to give value to the customers (and the 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 gets them on their way to becoming loyal, repeat customers.
Hopefully this guide provides both instruction and inspiration for your transactional messages! If you have any questions about the process or are wondering how to apply it to your service, please send us a message!