Articles on: Integrations

Advanced Klaviyo Integration: Set Up Klaviyo Flow Metrics and Triggers

Plans: Enterprise Standard, Enterprise Advanced, API users Platforms: All platforms

Overview



The AfterShip & Klaviyo Integration empowers users to trigger personalized notifications based on their order or shipment status.

What you’ll learn



In this tutorial, we’ll discuss

Create a flow metric
Set up trigger filters
Add a trigger split
AfterShip flow metric
Required API resources for metrics
Skip Historical events
Understanding Stalled metrics
Understanding trigger frequency
AfterShip flow trigger filters and splits

Create a flow metric



Here’s how you can set up a basic post-purchase flow:

Navigate to the Flows tab
Click Create Flow


Choose Create from Scratch
Select a metric to trigger the flow


If you see duplicate metrics, it's because you have both Basic and Advanced integrations. Learn more about the differences here.

Set up trigger filters



You can use trigger filters to narrow the scope and target only a subset of the shipments. Refer to the steps below for setting up the trigger filter:

On the flow editor, navigate to the Trigger tab
Click Trigger Filters
Choose the event that you need to narrow down the scope


Add a trigger split



A trigger split, part of the Visual Flow Builder, divides a flow into two paths based on the filter applied to the flow trigger. Follow these steps to add a trigger split:

On the flow editor, navigate to the Trigger tab
Drag the Trigger Split from the left-hand side panel


Select the event that you want to split the flow

AfterShip flow metric



With an active AfterShip integration in your Klaviyo account, you can unlock these event metrics for Flows:

CategoryMetricsDescription
Pre-shipAfterShip: Pre-ship - Order confirmationNotifies when an order is confirmed.
Pre-shipAfterShip: Pre-ship - Fulfillment stalledAlerts about an order that has been created and remained unfulfilled for X days.
Pre-shipAfterShip: Pre-ship - Fulfilled partial orderIndicates partial order fulfillment (There will be separate notifications for each partial fulfillment.
Delivery summaryAfterShip: Delivery summary - All Items fulfilledNotifies when all items in an order have been shipped.
Delivery summaryAfterShip: Delivery summary - All Items DeliveredNotifies when all shipments in an order have been delivered.
Delivery updatesAfterShip: Delivery updates - Info receivedNotifies when a package has been shipped and is ready for courier pickup
Delivery updatesAfterShip: Delivery updates - In transitNotifies when a package is in transit to the customer.
Delivery updatesAfterShip: Delivery updates - Out for deliveryNotifies about a shipment that's out for delivery.
Delivery updatesAfterShip: Delivery updates - Available for pick upNotifies about a shipment available for pick up at a designated point.
Delivery updatesAfterShip: Delivery updates - DeliveredNotifies when a shipment is delivered to the destination.
Delivery exceptionsAfterShip: Delivery exceptions - General exceptionNotifies about a package in an exception status (lost, custom delay, general delay, damaged, etc., excluding returning to sender or returned to sender).
Delivery exceptionsAfterShip: Delivery exceptions - Returning to senderNotifies when a package is returning to sender.
Delivery exceptionsAfterShip: Delivery exceptions - Returned to senderNotifies when a package has been returned to sender.
Delivery exceptionsAfterShip: Delivery exceptions - Failed attemptIndicates a courier's unsuccessful delivery attempt.
Delivery exceptionsAfterShip: Delivery exceptions - Shipments stalledNotifies about a shipment with no updates for X days, regardless of its current status.
EDD relatedAfterShip: EDD - Delivery anticipationNotifies about a shipment scheduled to arrive the next day.
EDD relatedAfterShip: EDD - EDD revisedNotifies when a shipment’s latest estimated delivery date changes.
EDD relatedAfterShip: EDD - EDD missedNotifies when a shipment’s latest estimated delivery date is missed.


Required API resources for metrics



MetricsTrigger logicRequired resourcesResource location
AfterShip: Pre-ship - Order confirmationAfterShip sends the event info to Klaviyo when an order is imported.orders.source_created_at is not null.Commerce API
orders.status is “open”
AfterShip: Pre-ship - Fulfillment stalledAfterShip sends the event info to Klaviyo if an order remains unfulfilled for X days.orders.fulfillment_status is “unfulfilled”Commerce API
AfterShip: Pre-ship - Fulfilled partial orderAfterShip sends the event info to Klaviyo upon creation of a new fulfillment under an order.shipments.source_created_at is not null.Commerce API
orders.fulfillment_status is “partially_fulfilled”
AfterShip: Delivery summary - All Items fulfilledAfterShip sends the event info to Klaviyo when the order’s fulfillment status turns “Fulfilled”.shipments.source_created_at is not null.Commerce API
orders.fulfillment_status is “fulfilled”Commerce API
AfterShip: Delivery summary - All Items DeliveredAfterShip notifies Klaviyo when all items in an order are delivered.orders.fulfillment_status is “fulfilled”Commerce API
tracking.shipment_delivery_date is not nullCourier
AfterShip: Delivery updates - "Info received," "In transit," "Out for delivery," "Available for pick up," "Delivered"AfterShip sends the event info to Klaviyo immediately upon receiving shipment status updates, triggered by events received from couriers.tracking.checkpoints.date_time is not nullCourier
AfterShip: Delivery exceptions - "General exception," "Returning to sender," "Returned to sender," "Failed attempt"AfterShip sends the event info to Klaviyo immediately upon receiving shipment status updates, triggered by events received from couriers.tracking.checkpoints.date_time is not nullCourier
AfterShip: Delivery exceptions - Shipments stalledAfterShip alerts Klaviyo if a shipment remains stagnant for X days.-Courier
AfterShip: EDD - Delivery anticipationAfterShip notifies Klaviyo 24 hours before Estimated Delivery Date (EDD).tracking.latest_estimated_delivery is not nullCourier
AfterShip: EDD - EDD revisedAfterShip sends the event info to Klaviyo when the latest_estimated_delivery date updates.tracking.latest_estimated_delivery is not nullCourier
tracking.tag is not “pending”, “expired”, “delivered”
AfterShip: EDD - EDD missedAfterShip notifies Klaviyo when the latest_estimated_delivery is missed, meaning the Estimated time of arrival has expired. (If the latest estimated delivery is a range, AfterShip compares using the maximum value.)tracking.latest_estimated_delivery is not nullCourier
tracking.tag is not “pending”, “expired”, “delivered”


Skip Historical events



To ensure timely and relevant messaging, AfterShip refrains from sending historical events to Klaviyo for certain occurrences. Historical events, defined as those transpiring 36-72 hours ago, are excluded to prevent shoppers from receiving outdated notifications.

For instance, if a delivery event is passed to AfterShip by the carrier and it occurred more than 72 hours ago from the moment AfterShip receives it, the event will not be forwarded to Klaviyo, ensuring notifications are current and accurate.

The table below outlines the logic governing the historical window for each event.

MetricsSkip logic
AfterShip: Pre-ship - Order confirmationAfterShip sends the event info to Klaviyo upon Order import with the condition that the order has been placed within the last 72 hours.
AfterShip: Pre-ship - Fulfilled partial orderAfterShip sends the event info to Klaviyo when there is a new fulfillment created under an order. Notifications are excluded if shipment import occurs more than 72 hours after order fulfillment.
AfterShip: Delivery summary - All Items fulfilledAfterShip sends the event info to Klaviyo when an order’s fulfillment status turns “Fulfilled”. Notifications are excluded if shipment import occurs more than 72 hours after order fulfillment.
AfterShip: Delivery summary - All Items DeliveredAfterShip sends the event info to Klaviyo when an order’s all shipments get delivered. Notifications are excluded if shipment import occurs more than 72 hours after order fulfillment.
AfterShip: Delivery updates - "Info received," "AfterShip: Delivery updates - In transit," "AfterShip: Delivery updates - Delivered," "AfterShip: Delivery exceptions - Returning to sender," "AfterShip: Delivery exceptions - Returned to sender"AfterShip sends the event info to Klaviyo when the courier passes events to AfterShip, provided the event occurred within the last 72 hours. Notifications are excluded if shipment import exceeds 72 hours after the event.
AfterShip: Delivery updates - "Out for delivery," "AfterShip: Delivery updates - Available for pick up," "AfterShip: Delivery exceptions - General exception," "AfterShip: Delivery exceptions - Failed attempt"AfterShip sends the event info to Klaviyo when the courier passes events to AfterShip, provided the event occurred within the last 36 hours. Notifications are excluded if shipment import exceeds 36 hours after the event


Understanding Stalled metrics



For FulfillmentStalled and ShipmentStalled, the default stalled timeframe is set to 72 hours. You can adjust this in the configuration panel at any time. It's essential to note that changes are not retroactive and apply only to new orders placed after updating settings.

The "Stalled" flag is not a real-time status. It gets added to an order once the stalled criteria are met and is not removed thereafter.

ShipmentStalled triggers notifications for a shipment without updates within the specified timeframe, regardless of its current status. To restrict this trigger to a specific status, choose the relevant status during configuration.

Step to configure stalled timeframe

Navigate to Apps
Locate your Klaviyo integration
Click Settings
Here you can customize your Stalled timeframe.


Understanding trigger frequency



Notifications are generally triggered once for most metrics. However, specific metrics have exceptions, resulting in multiple notifications sent out at a frequency of 24 hours. Here's a breakdown:

Metrics with 24-Hour Trigger Frequency:

AfterShip: Delivery updates - Out for delivery
AfterShip: Delivery exceptions - General exception
AfterShip: Delivery exceptions - Failed attempt
AfterShip: EDD - Delivery anticipation
AfterShip: EDD - EDD revised
AfterShip: EDD - EDD missed

AfterShip flow trigger filters and splits



1. General fields


CategoryTrigger Filters & SplitsDescription
STOREStoreNameThe name of your store.
STOREStoreURLThe URL of your store that is sourced from the AfterShip organization setting.
COURIERCourierNameThe name of the courier.
COURIERCourierSlugThe name of the courier slug.
COURIERCourierContactContact information of the courier.
COURIERCourierWebURLThe courier’s website.
COURIERCourierRedirectURLURL where the customer can redirect their parcel.
COURIERCourierTrackingURLThe courier's tracking page URL.
SHIPMENTTrackingNumberThe shipment's tracking number.
SHIPMENTShipmentTrackingURLURL to your AfterShip branded tracking page with “tracking number” as a pre-set parameter.
SHIPMENTShipmentCurrentStatusCurrent delivery status of the AfterShip shipment.
SHIPMENTShipmentCurrentSubStatusCurrent sub-status of the AfterShip shipment.
SHIPMENTShipmentDeliveryAddressDestination address of the shipment
SHIPMENTLatestLocationLatest location of the shipment.
SHIPMENTLatestUpdateTimeLatest update time on the shipment from the courier.
SHIPMENTLatestCourierMessageLatest checkpoint message from the courier.
SHIPMENTCourierEstimatedDeliveryDateThe estimated delivery date is provided by the courier and sourced directly through AfterShip’s integration with courier tracking services. This represents the courier’s most accurate estimate of when the shipment is expected to be delivered.
SHIPMENTAfterShipAIEstimatedDeliveryDateAfterShip leverages AI and proprietary tracking data to provide the AfterShip AI Predicted Estimated Delivery Date (AIEDD). AIEDD proactively engages with your customers and provides EDDs with higher than industry-level accuracy.
SHIPMENTAfterShipCustomSettingEstimatedDeliveryDateThe Custom estimated delivery date is a configurable setting within AfterShip Tracking’s admin dashboard. It is used in cases where merchants already have a mechanism to calculate the estimated delivery date based on the shipping type, courier, and destination.
SHIPMENTPromisedDeliveryDateThe Promised delivery date is a date that is passed to AfterShip Tracking via Tracking API. It is used in cases where the merchants have their own projections of when their shipments will arrive.
SHIPMENTLatestEstimatedDeliveryDateThe Latest Estimated Delivery Date is determined based on the following priority order: Courier estimated delivery date > AfterShip AI predicted estimated delivery date > Promised delivery date > Custom estimated delivery date.
SHIPMENTPickupLocationThe location from where the customer can pick up their package.
SHIPMENTSignedByThe package receiver's information.
SHIPMENTCourierServiceTypeDisplays shipment's courier service type (e.g., UPS Express Saver®).
SHIPMENTNoteDisplays additional notes configured in AfterShip.
SHIPMENTShipmentPackageCountThe number of packages under this shipment.
SHIPMENTShipDateThe ship date of the shipment.
SHIPMENTPickupDateThe pickup date of the shipment.
SHIPMENTDeliveryDateThe delivery date of the shipment.
SHIPMENTDestinationCityThe destination city of the shipment.
SHIPMENTDestinationStateThe destination state of the shipment.
SHIPMENTDestinationCountrylso3The destination country of the shipment in Iso3 format.
SHIPMENTDestinationCountryNameThe destination country name of the shipment.
SHIPMENTDestinationPostalCodeThe destination postal code of the shipment.
SHIPMENTTransitTimeThe total time spent on this shipment so far.
SHIPMENTOriginCityThe origin city of the shipment.
SHIPMENTOriginStateThe origin state of the shipment.
SHIPMENTOriginCountrylso3The origin country of the shipment in Iso3 format.
SHIPMENTOriginCountryNameThe origin country name of the shipment.
SHIPMENTOriginPostalCodeThe origin postal code of the shipment.
SHIPMENTShipmentWeightThe weight value of the shipment.
SHIPMENTShipmentWeightUnitThe unit of weight value of the shipment.
SHIPMENTShipmentTitleDisplays the title of the shipment from AfterShip.
SHIPMENTImportSourceThe Import source of AfterShip tracking.
ORDEROrderNumberThe customer-faced number identifying a purchase or order placed by a customer.
ORDEROrderIDThe merchant internal-faced number identifying a purchase or order placed by a customer.
ORDEROrderTagsThe tag of the order from your eCommerce store.
ORDEROrderPathURLThe URL that customers can click to view their order on your eCommerce store.
ORDEROrderTrackingURLThe URL to your AfterShip branded tracking page with “order number” and “customer email address/phone number” as pre-set parameters.


CategoryTrigger Filters & SplitsDescription
ORDEROrderStatusPageURLThe order status page of an eCommerce platform.
ORDEROrderDateThe date when the order is placed.
ORDERCustomerNameThe customer's name to the delivery notification.
ORDERCustomerFirstNameThe customer's first name to the delivery notification.
ORDERCustomerEmailAddressThe customer's email address to the delivery notification.
ORDERTotalShipmentsThe number of shipments under the order.
ORDEROrderTagsThe order tag of the order.


2. Custom fields


CategoryTrigger Filters & SplitsDescription
Customcustom_fields_{your custom field key}User-described fields created via AfterShip Tracking API, CSV, or in the Admin. For example, if you created “store_name” as a custom field, use it to set up your flow triggers.

If you have any queries, feel free to connect with our support team for quick assistance.

Updated on: 28/02/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!