How to Integrate with AfterShip

Last updated at:


You can use AfterShip to automatically track shipments for your ecommerce store. Klaviyo offers a native AfterShip integration which, when enabled, will send AfterShip tracking information into Klaviyo so you can incorporate shipping data into automated flows.

AfterShip's integration with Klaviyo is only available for AfterShip customers with paid plans.

AfterShip data is sent to Klaviyo via webhook, which means that data is sent in near real-time.

You can sync data from AfterShip such as:

  • Tracking Code and Order ID for shipments
  • When a shipment is marked as shipped
  • When a shipment has been marked as delivered

This article will walk you through integrating AfterShip with Klaviyo. After completing the steps in this guide, you'll be able to personalize and target emails based on the shipping events and status of orders AfterShip tracks.

Enable Klaviyo's AfterShip Integration

To begin integration setup, generate an API key within AfterShip. First, log into your AfterShip account. Locate Settings at the bottom of the lefthand navigation, then click on API Keys.
Click Generate API Key, and label the API Key for clarity. Click Generate API Key again to prompt AfterShip to create the newly-named key. Copy the API key generated by AfterShip, then head over to Klaviyo.

Log in to your Klaviyo account. Navigate to the Integrations tab, and search for AfterShip on the All Integrations tab. Click Add Integration.
AfterShip1.pngTo install the integration, you will be prompted to fill in one field. In the API Key field, paste the AfterShip API key you created. Then select Connect to AfterShip.
Your Klaviyo account is now connected with AfterShip. Next, you need to set up the webhook which allows the integration to sync data from AfterShip to Klaviyo.

After you select Connect to AfterShip, your page will reload. In the Setting Up the AfterShip Webhook section, copy the webhook URL. You will need to paste this URL into AfterShip in the next step. Without the webhook set up, AfterShip cannot sync data to Klaviyo.
Head back over to AfterShip to finish setting up the webhook. 

Update the AfterShip Webhook URL

From your AfterShip account, navigate to Notifications. If you have not yet set up notifications, click Setup Notifications. If you've already set up notifications, you'll be sent directly to the Notifications page. 
Scroll down to the Webhooks section, and click Add webhook URL.
AfterShip6.pngPaste the webhook URL you copied from your Klaviyo account, and click Save.
In the Events section, make sure the All events checkbox is enabled. This will ensure that all events will be sent to Klaviyo from AfterShip.
AfterShip will now sync all tracking events over to Klaviyo. 

Monitor the Klaviyo Sync 

To check on your integration, navigate to Analytics > Metrics. Select the Received Delivery metric and click on the activity feed icon. 

If your integration has begun syncing data, you'll start to see Received Delivery events being added to this Activity Feed. When your AfterShip integration has a green border in your account's Enabled Integrations list, your historic data sync is complete.

If you aren't seeing data, make sure the All events setting is enabled in the Notifications > Events section of your AfterShip account. 

What Data Syncs to Klaviyo

Shipping events synced from AfterShip can be viewed under Metrics within the Analytics tab. From Klaviyo, navigate to Analytics > Metrics and select AfterShip from the filter dropdown on the upper-right. AfterShip metrics are notated by an AfterShip icon. 


Delivery Exception

This metric records every time a delivery has one of the following statuses: custom hold, undelivered, returned shipment to sender, or any shipping exceptions.

Failed Delivery Attempt

This metric records when a carrier attempted to deliver but failed. It usually leaves a notice and will try to deliver again.

In Transit

This metric records when a carrier has accepted or picked up a shipment from a shipper. The shipment is on the way to its destination.

Out for Delivery

This metric records when a carrier is about to deliver the shipment or the shipment is ready to pick up.

Received Delivery 

This metric records an event every time a delivery is marked as received inside of AfterShip. With this metric, you can filter Product Review flows to send only to people who have received a delivery. You can also trigger a flow when a delivery is received, letting customers know when their packages arrive. Each event includes information about an order's tracking number and order ID. 

Shipped Package

This metric records an event every time an order is marked as shipped in AfterShip. With this metric, you can trigger flows to send emails confirming that a package has been shipped to a customer, and provide them the tracking number to track their shipment. Each event includes information about an order's tracking number and order ID.

Each of these metrics are associated with additional data (aka metadata). For example, the Out For Delivery metric is associated with CurrentStatus which includes: AttemptFail, Delivered, Exception, InfoReceived InTransit, OutForDelivery.

Each piece of AfterShip data can be used in Klaviyo. For example, the OutForDelivery metric can trigger a flow based on CurrentStatus. See the following section for an example of using AfterShip data in a flow.

How to Use the AfterShip Integration

You can use AfterShip data to trigger flows that let your customers know about the status of their shipments. 

Out for Delivery Flow

Let your customers know that their order is out for delivery by using AfterShip metrics and metadata, and populate your flow email with dynamic order information. 

Trigger: People enter this flow when they Out for Delivery 
Trigger Filter: CurrentStatus contains OutForDelivery
Flow Filter: Out for Delivery zero times since starting this flow.


Notice that the flow email references dynamic customer order data i.e. {{ event.extra.Title }}.

To learn more about adding dynamic customer data to your flow emails, see: Building Dynamic Blocks in a Flow Email  

Was this article helpful?
198 out of 273 found this helpful