AfterShip Tracking Common Scenario

One of the most common usage of the Commerce API is to import shipments to AfterShip Tracking, in order to send out the order/shipment update notification. Also the shopper can also visit AfterShip branded tracking page to view the order/shipment latest status or registering email/sms updates.

This document will describe several common usage scenarios for AfterShip Tracking, provided for your reference.


The first step is to import your order into AfterShip system, you can import the your order with order endpoints. Once you have successfully imported orders, you can view the shipments under the AfterShip Tracking admin portal.

FieldDescriptionSample
source_idThe unique identifier of the order. For most of the case it should be the same as the order ID of your system.CM1011
numberThe order nameCM1011
currencyThe curreny of the orderUSD
statusThe status of the orderopen
order_totalThe total price of the order9.5
itemsItems of order-
items.*.source_idA unique identifier for the line item in your system9716591689898
items.*.titleThe title of the product variantMobile Phone Case
itmes.*.quantityThe number of items that have been purchased1
source_created_atThe date and time (ISO 8601 format) when an order was created2023-02-16T01:00:10Z
source_updated_atThe date and time (ISO 8601 format) when an order was updated.2023-02-16T01:00:10Z
shipmentsOrder shipments-
shipments.*.source_idA unique identifier for the shipment in your system.321324145553321
shipments.*.tracking_numberTracking number.32332131122
shipments.*.slugUnique code of the courier. Get couriers here: https://www.aftership.com/couriers.fedex
preparing...

Depending on the intended usage, you will need to include various auxiliary data along with the common fields outlined in the previous section.

AfterShip Tracking allows you to send email notifications for different delivery statuses. With swift email notifications, you can keep your customers updated about their order status.

FieldDescriptionSample
customerCustomer information object-
customer.emailsThe customer's email array["[email protected]"]

To use the sms notification feature, please add the valid customer phone numbers (customer.phones) to the order payload.

FieldDescriptionSample
customerCustomer information object-
customer.phonesThe customer's phone number array["+12025553750"]

If you want to configure an notification workflow based on the status of an order, you will also have to provide the fulfillment_status.

FieldDescriptionSample
customerCustomer information object-
customer.emailsThe customer's email array["[email protected]"]
customer.phonesThe customer's phone array["+12025553750"]
fulfillment_statusThe status of fulfillment associated with the orderunfulfilled

If you want to set up an email/sms workflow using workflow trigger filters, you can use the corresponding fields in the following reference table:

FieldTrigger Filter NameExample
numberOrder numberCM1011
statusOrder statusCM1011
items[*].product_categoriesProduct type["makeup"]
shipping_address.country_regionDestination country/regionUSA
shipments[*].slugSlug"fedex"
shipments[*].custom_fieldsCustom fields{"customer_tag": "testing"}
sourcePlease select automizely-private-

The custom estimated delivery date (Custom EDD) is used in cases where you already have a mechanism to calculate the estimated delivery date based on the shipping type, carrier, and destination. Please refer to here for more detail about Custom EDD feature.

The general formula for calculating the custom EDD for the selected industry type is as follows: Order date + Order cutoff & processing time + Transit time

Please refer to the table below for instructions on how to input the mentioned variables into the AfterShip system:

VariableDescription
Order dateThe order creation time should be passed via the "source_created_at" field in the order payload.
Order cutoff & processing timeThe processing time for an order is configured on the Tracking's admin page.
Transit timeThe estimated shipping time is configured on the Tracking's admin page.

Please refer to here for more detail about Segmentation feature.

To use the Segmentation feature, you should send the required order information to AfterShip via Order API according to the referencetable below:

Commerce API Field NameSegmentation Condition Field Name
order_totalOrder -> Total billing amount
tagsOrder -> Order tag
numberOrder -> Order number
items[*].skuProduct -> Product SKU
items[*].product_categoriesProduct -> Product type
items[*].product_tagsProduct -> Product tag
shipments[*].slugShipment -> Carrier
nameShipment -> Shipment title
shipping_address.country_regionShipment -> Destination country/region
shipping_address.stateShipment -> Destination state
shipping_address.postal_codeShipment -> Destination postal code
shipments[*].custom_fieldsCustom field

The AfterShip product recommendation feature enables you to display the most suitable products to your shoppers based on various behaviors and criteria. To utilize this feature, you must import order and product resources into AfterShip.

If you want to use the Product documents feature, please import order and product resources according to the following examples:

Key fielddescription
order.shipments[*].custom_fields.package_countThe total number of packages to be unpacked for this shipment should be entered. For example, if the order requires 2 packages to be unpacked for shipment, please enter 2. Tracking will use this information to determine the last package of the shipment. Once Tracking confirms that the last package has been delivered, the product documents will be sent.

To create a custom flow and utilize flow filters related to shopping behavior, you can import order, and product data following the examples provided below:

Key fielddescription
order.customer.source_idA unique identifier for the customer. The ID will be used to calculate values related to SHOPPING BEHAVIOR.
order.financial_statusThe financial_status should not be unpaid. Only when financial_status is not equal to 'unpaid', the order will be used to calculate values related to SHOPPING BEHAVIOR.
order.source_created_atThe creation time of the order used to calculate the number of orders within the relevant time period. Related SHOPPING BEHAVIOR:First order date,Last order date,Number of recent orders.
order.order_totalRelated SHOPPING BEHAVIOR:Total spent,Avg. order value.
order.items[x].source_product_idRelated SHOPPING BEHAVIOR:Purchased products.
order.items[x].source_variant_idRelated SHOPPING BEHAVIOR:Purchased products.