Skip to main content

Add direct mail to your Klaviyo strategy

Course overview
Lesson
3 min read

Build your first direct mail flow

You have your strategy, and your use cases. Now, time to build this thing! This lesson demonstrates how Klaviyo and your direct mail platform actually communicates, and then we'll build your first flow with PostPilot, together.

First: How does Klaviyo talk to your direct mail tool?

Klaviyo uses webhooks to pass customer data to outside systems (in this case, your direct mail tool). This video walks through what webhooks are and how they work.

Try it yourself: Trigger a postcard send as part of your cart abandonment flow

The abandoned cart flow is a crowd favorite, and hopefully one that you will enjoy building. Let's walk through how to send a postcard to shoppers who left items in their cart. Send this card as a final physical touchpoint, after your digital channels have already run dry.

This use case will be using PostPilot as the direct mail integration partner, but some of these steps are applicable for all direct mail tools. Select each section to follow the steps.

Set up your API connection in PostPilot
  1. Log into PostPilot
  2. Navigate to Integrations → API Connection
  3. Click Manage under the API Connection card
  4. Click New Connection if one doesn't already exist, or select an existing connection to manage it
  5. Inside the connection details page, you'll find the full endpoint URLs and example JSON bodies for three distinct actions:
    1. API Full Contact: when a full mailing address is associated with the contact record
    2. MailMatch™ via API: when only email is available, PostPilot looks up the address
    3. Shopify Customer Events via API: triggering sends to existing Shopify customers based on events
  6. For abandoned cart, with address, copy the Create/Update API Full Contact record URL from your API Connection details page, and configure a webhook block in Klaviyo to POST to it:

POST api.postpilot.com/v1/{connection_id}/api_full_contactSource: PostPilot Help Center, "API-Triggered Segments & MailMatch via API "

Add the webhook to your Klaviyo abandoned cart flow
  1. In Klaviyo, go to Flows and open your abandoned cart flow
  2. In the flow builder sidebar, find Webhooks under Actions and drag it into the flow
  3. Place it after the last email or SMS step in your sequence
  4. Before the webhook, add a Conditional Split. Set the condition to $value is greater than your average order value. The higher cart value branch continues to the webhook and you can exit the lower value branch.
  5. In the Destination URL field, paste your PostPilot API URL
  6. Delete the default content in the JSON body field
  7. Paste the following exactly:
javascript
{

"reference_id": "{{ person.email }}",

"firstname": "{{ person.first_name|default:'' }}",

"lastname": "{{ person.last_name|default:'' }}",

"email": "{{ person.email }}",

"line1": "{{ person|lookup:'$address1'|default:'' }}",

"line2": "{{ person|lookup:'$address2'|default:'' }}",

"city": "{{ person.City|default:'' }}",

"state": "{{ person.Region|default:'' }}",

"postal_code": "{{ person.Zipcode|default:'' }}",

"country": "{{ person.Country|default:'' }}"

}
  1. Leave the Headers section empty
  2. Add a flow filter: Has Placed Order zero times since starting this flow
  3. Set your time delay:PostPilot recommends triggering the webhook 7 to 10 days after abandonment, so the postcard arrives after your email sequence has already run
  4. Save the webhook step
  5. Go back into PostPilot, and go to Segments → New Segment
  6. Select API Contacts with Address
  7. Optionally add a Contact updated date (relative) filter to target only recently triggered contacts
  8. Create a one-off or automated campaign targeting this segment

You did it!

Build your first direct mail flow