Articles on: Apps

How to Integrate AfterShip Returns with Klaviyo

Plans: Premium, EnterprisePlatforms: All platforms


Overview


Integrate AfterShip Returns with Klaviyo to personalize and target emails based on the return order status tracked by AfterShip Returns. AfterShip Returns does have its own built-in notifications that can be found in the main admin portal. However, merchants that have Klaviyo integrated with AfterShip Returns can use Klaviyo to set up, schedule, and send these emails instead, provided Klaviyo's advanced features and branding capabilities.


This article will show you how to recreate AfterShip Returns native notifications in Klaviyo and how those flows would look in emails.


Merchants are welcome to use some AfterShip Returns native notifications while using Klaviyo for others. Remember to never enable the same event flow in both places to avoid double-emailing customers.


If you plan to use only Klaviyo flows, deactivate AfterShip Returns native notifications that will be coming from Klaviyo to avoid sending the same email twice.


What you’ll learn


In this tutorial, we will show you:





Install Klaviyo in AfterShip Returns


  1. Go to ** Apps ** in AfterShip Returns admin.
  2. Click View more apps, and you will be redirected to the AfterShip Returns integration page.
  3. Find Klaviyo and install the app.
  4. Choose a eCommerce platform store under your AfterShip account for which you want to install the Klaviyo app.
  5. Click Install app.
  6. Click Allow to grant AfterShip access to your Klaviyo account’s information.



Create returns email notifications in Klaviyo


Backed by AfterShip Return's supported triggers, you can set up, customize, and send/schedule email notifications in Klaviyo to keep your customers informed of the recent updates to their return requests.


1. Create return flow


  1. Go to Flows in Klaviyo admin
  2. Click Create Flow > Build your own.
  3. Label the flow as per AfterShip Returns native notifications for easy reference (e.g, Return approved flow).
  4. Click Create flow.
  5. On the Select trigger panel, Click Your metrics and select the AfterShip Returns.


  • All the available list of AfterShip Returns metrics will be listed there which can be used as triggers in Klaviyo. Select the trigger that will activate this flow.
  • Select trigger filters to further narrow down the customers to whom this notification will be sent. All the AfterShip Return synced data fields will be listed under the Dimension and Dimension value fields to be used as trigger fields. Select the dimension, logic, and, value.


  1. Click Save, then Confirm and save to finalize the return flow.



For example: For Return request - Approved, the flow will be triggered when the return is automatically or manually approved by the merchant in AfterShip Returns.


Available flows and trigger filters


Metrics


Metrics

Condition

Status

AfterShip: Return request - Submitted

Webhook event: return.submitted. Occurs when a return request is successfully submitted.

New

AfterShip: Return request - Approved

Webhook event: return.approved. Occurs when a return request is approved.

New

AfterShip: Return request - Expired

Webhook event: return.expired. Occurs when a return request is expired.

New

AfterShip: Return request - Rejected

Webhook event: return.rejected. Occurs when a return request is rejected.

New

AfterShip: Return request - Resolved

Webhook event: return.resolved. Occurs when a return request is resolved.

New

AfterShip: Return dropoff - Created

Webhook event: return.dropoff.created. Occurs when a drop-off parcel QR code is generated.

New

AfterShip: Return dropoff - Shipment Updated

Webhook event: return.dropoff.shipment.updated. Occurs when a shipment of drop-off is updated.

New

AfterShip: Return dropoff - Updated

Webhook event: return.dropoff.updated. Occurs when a drop-off parcel is updated, e.g., when it is handed over to parcel collection location.

New

AfterShip: Return item - Restocked

Webhook event: return.restock.created. Occurs when a restock operation is executed via AfterShip.

New

AfterShip: Return shipment - Provided

Webhook event: return.shipment.provided. Occurs when the merchant provides a shipment.

New

AfterShip: Return shipment - Recorded

Webhook event: return.shipment.recorded. Occurs when the shopper provides shipment information.

New

AfterShip: Return shipment - Updated

Webhook event: return.shipment.updated. Occurs when the tracking status of a shipment changes.

New

AfterShip: Return shipments - Provided

Webhook event: return.shipments.provided. Occurs when the merchant has provided all the necessary shipment information.

New

AfterShip: Return exchange order - Created

Webhook event: return.exchange.order.created. Occurs when the exchange order has been created.

New

resolved (replace with the same item)

Return is resolved AND resolution is replace with the same item

Legacy

resolved (exchange for other items)

Return is resolved AND resolution is exchange for other items

Legacy

resolved (refunded to original payment)

Return is resolved AND resolution is refund to original payment method

Legacy

resolved (refunded to store credit)

Return is resolved AND resolution is refund to store credit

Legacy

received return

All items are marked as received

Legacy

approved return

Return is (auto/manually) approved by merchant

Legacy

submitted return

Return created from shopper site

Legacy

rejected return

Return is rejected by merchant

Legacy

expired return

Return is expired since no shipment status update

Legacy


Legacy metrics will only be visible for legacy users who enabled Klaviyo integration before March 27th 2025.


Trigger filters


Trigger filter

Desciption

Example

Status

Filed by

The source of the return request

shopper,merchant,customer_support

New

Is Gift Return

Whether the return request is a gift return request

ture,flase

New

Approval status

The status of the RMA

return.submited, return.approved,return.done,return.rejcted,return.expired

New

Item Return Reason

A list of the return reason included in the RMA

New

Reject Reason

The reject reason input by merchant when rejecting the RMA in admin

New

Merchant Note

The note input by merchant on the return request details page in admin

New

Outcome

The outcome after the return request being processed

refund,store credit,upsell,exchange

New

Return method

The return method of the return request selected by shopper - including the return zone,routing rule name, return method

Rest of World/Default/customer_courier

New

Shipping status

The shipping status of the return shipment

in_transit, delivered,partially_received,received, no_label, void

New

Dropoff Service Provider

If the return method is dropoff, this field will show the name of the service provider

happyreturns

New

resolution

Resolution of the RMA selected by shoppers when the return request is created

Refund to original payment method Refund to store credit, Replace with the same item, Exchange for other items

Legacy

returns method

Return method of the RMA selected by shoppers when the return request is created.

Ship with the carrier customer choose, Ship with a return label, Return to a retail store, Green returns

Legacy

shipping status

The tracking status of the return shipment.

Shipped, no_label, Delivered

Legacy

type

The type of the return request

gift_return, normal

Legacy

approval status

The approval status of the RMA

approved, submitted, expired, rejected,

Legacy

name

The RMA number of the return request

ABCDEFGH

Legacy


Legacy trigger filters will only be visible for legacy users who enabled Klaviyo integration before March 27th 2025.


2. Set up email notification in Klaviyo


Once your flow is set up, you can proceed with configuring and customizing your email notifications in Klaviyo:


  • Create an email from scratch: Use Klaviyo's drag-and-drop editor, text-only option, or HTML editor with an easy step-by-step guide (outlined in the next section).
  • Customize pre-built templates: Choose from Klaviyo’s ready-made templates and tailor them to meet your specific needs.
  • Recreate AfterShip Returns notifications: Design return notifications supported by AfterShip directly in Klaviyo.


A. Create email from scratch


  1. To set up an email action in your flow, select Email from the list of available actions. This email notification will be sent to customers whose Return Merchandise Authorization (RMA) meets the trigger criteria you've defined for that particular flow.
  2. Drag-and-drop the Email component from the left-hand side to the right-hand side
  3. Click Set up email on the email block to start setting up the email on the side panel.
  4. On the side panel, edit the email Name, Subject Line, Preview Text, Sender name, and Sender email address.
  5. Select email template: Drag-and-drop, Text only, or HTML editor.
  • Click the {...} icon to select the text only or HTML editor.
  • Click Select template to open the template library from where you can choose one of the pre-built templates. You create your own template by selecting Create from the top-right corner.


  1. Based on the editor selected, edit the email message based on what information you want to show. Insert sections and blocks and play with the style customizations to achieve the kind of aesthetics you are looking for.



  1. Insert merge tags to auto-populate customer and order information AfterShip Returns sends to Klaviyo in places where required. You can view the list of merge tags available for each email notification in the payload by clicking **Preview and test **in the upper right hand corner.


  • Once the Preview and test window is opened, you can see the list of events sent by AfterShip Returns to Klaviyo under Event properties section.
  • Search for the event you are looking for and click on it to copy its exact merge tag to clipboard.
  • Paste the copied merge tag in the email body where you want data to auto-populate.

For e.g., For Customer first name, click on first_name event under order category to get the exact merge tag {{ event.extra.data.order.customer.first_name|default:'' }} which when inserted in the email will auto-import customer first name from the Klaviyo database.


Similarly, For Product name and **Order number, **click on product_title event and order_number event respectively to get the exact merges tags {{ event.extra.data.return_items.0.product_title|default:'' }} and {{ event.extra.data.order.order_number|default:'' }} and insert them in your email to auto-import the real values from these events from the Klaviyo database.


For more details on **how to use event data to personalize email and SMS flows, ** refer to this help article.



B. Recreate AfterShip email notifications in Klaviyo


To replicate your AfterShip Returns email notifications in Klaviyo, follow these steps:


  1. Copy the content: Start by copying the email content from your AfterShip Returns notifications.
  2. Replace merge tags: Review the merge tags used in AfterShip Returns, then replace them with their corresponding Klaviyo merge tags. You can find the appropriate tags by checking the events AfterShip Returns sends to Klaviyo .
  3. Handle missing merge tags: If you come across any merge tags or events that are not available in Klaviyo, replace them with the static values you wish to include in your emails sent via Klaviyo.


Example: Here we are taking the example of AfterShip Return's Return request received email notification and replicating it in Klaviyo.


For the |CONTACT_US| and |STORE_NAME| merge tags, we replaced them with static values, as AfterShip Returns does not send these events to Klaviyo, meaning they cannot be used as variables in Klaviyo emails.


For the |CUSTOMER_NAME|, |RMA_ID|, and |ORDER_NUMBER| merge tags, we replaced them with Klaviyo-generated merge tags, utilizing the events synced by AfterShip Returns in their payload.



This is how the replicated email notification will appear in Klaviyo. It will be triggered once the return request is submitted and received by the customer.



Create email workflow with Happy Returns® QR code in Klaviyo


  • Step 1: Add a trigger filter to the Approved return email workflow where return_method, doesn’t equal, Drop off at Happy Returns® locationsto avoid sending an email notification to customers when their request to drop off their returned items at any accessible Happy Returns® Bars in the U.S. is approved. This is because, at this stage of the return process, a Happy Returns® QR code is not yet generated that is required to show at the Bar location when customers drop off their return items.



  • Step 2: Create a new email workflow ( ** check here ) by selecting **dropoff created from the list of triggers indicating that a Happy Returns® QR code is now generated based on the Bar location the customer selects where they wish to drop off their return item. This trigger will set off a series of actions (email) to notify customers of the development.



  • Step 3: Select Email from the list of actions that will be sent when the trigger criteria is met. Drag-and-drop the Email component from the left-hand side to the right-hand side to make a flow. Configure the email body and insert dropoff merge tags to auto-populate information such as drop off number, slug, QR code, and current request status, AfterShip Returns sends to Klaviyo in places where required.


The QR code will be auto-populated when you insert the label_qr_codemerge



Payload


Merchants can use the fields provided in the following payload to customize email templates for different use cases. These fields are available as variables in Klaviyo, allowing for dynamic and personalized communication with customers.


{
"Filed By": "shopper",
"Is Gift Return": true,
"Approval Status": "return.expired",
"Item Return Reasons": [
"Doesn’t suit me"
],
"Reject Reason": null,
"Merchant Note": "this is merchant note",
"Outcomes": ["store_credit"],
"Return Method": "Rest of World/Default/customer_courier",
"Shipping Status": "",
"Dropoff Service Providers": [],
"extra": {
"event": "return.expired",
"created_at": "2025-03-13T10:47:31.353Z",
"modified": {
"approval_status": "expired",
"expired_at": "2025-03-13T10:49:18.842Z"
},
"data": {
"id": "597b1c6e72f444f88db1b8a60ad57ad1",
"rma_number": "JM3KEJ38",
"filed_by": "shopper",
"approval_status": "expired",
"approved_at": null,
"auto_approved": null,
"rejected_at": null,
"auto_rejected": null,
"resolved_at": null,
"auto_resolved": null,
"refunded_at": null,
"auto_refunded": null,
"auto_received": null,
"expired_at": null,
"reject_reason": null,
"merchant_note": null,
"order": {
"id": "7bd74b5b911040fbba603bf9a4a14799",
"external_id": "6399293391144",
"order_number": "#1147",
"order_name": "#1147",
"customer": {
"email": "contact@yourname.com",
"phone_number": "",
"first_name": "example",
"laster_name": ""
},
"country": "HKG",
"country_region": "HKG",
"store": {
"platform": "shopify",
"external_id": "landon-all-in-1"
},
"placed_at": "2025-03-06T04:56:39Z"
},
"organization": {
"id": "e67526dc20414dd3ab34585ed9de407b"
},
"gift_return": {
"recipient": {
"name": "Example",
"email": "contact@yourname.com",
"shipping_address": {
"contact_name": "Example Name",
"company_name": "AfterShip",
"street_1": "street_1",
"street_2": "street_2",
"city": "HongKong",
"state": {
"name": "Kowloon"
},
"postal_code": "999077",
"country_region": {
"code": "HKG"
},
"phone": null,
"email": "contact@yourname.com"
}
}
},
"return_items": [
{
"id": "16089456673064",
"external_order_item_id": "16089456673064",
"external_product_id": "9004406407464",
"external_variant_id": "47984808460584",
"sku": "C4D99C7E5921473B8551E70B6A4B5206",
"product_title": "Example Product Title",
"variant_title": "Sets Pickup / L",
"return_reason": "Doesn’t suit me",
"return_reason_comment": "",
"return_subreason": "",
"shopper_uploaded_image_urls": [],
"intended_return_quantity": 1,
"refund_quantity": 1,
"return_quantity": 1,
"received_quantity": 0,
"restocked_quantity": 0,
"ordered_quantity": 10,
"unit_display_price": {
"amount": "46.56",
"currency": "HKD"
},
"unit_discounted_price_including_tax": {
"amount": "46.56",
"currency": "HKD"
},
"unit_discount": null,
"unit_tax": null,
"properties": [],
"product_image_urls": [
"https://websites.am-static.com/assets/brands/logo_white/aftership.svg"
],
"product_categories": [],
"product_tags": [],
"item_tags": [],
"merchant_uploaded_image_urls": null,
"bundled_items": [],
"exchange_variant": null,
"parent_item_id": null
}
],
"return_method": {
"zone": {
"name": "Rest of World"
},
"rule": {
"name": "Default"
},
"type": "customer_courier",
"name": "Ship with any carrier of your choice"
},
"instant_exchange": null,
"receivings": [],
"return_total_including_tax": {
"amount": "46.56",
"currency": "HKD"
},
"return_tax": null,
"refunded_total": null,
"exchange": {
"order": null,
"items": [
{
"external_product_id": "9004406407464",
"external_variant_id": "47984808919336",
"sku": "3AD3689AF16941199F11E63214D3E223",
"title": "Example Product Title - Only Top / L",
"product_title": "Example Product Title",
"variant_title": "Only Top / L",
"quantity": 1,
"unit_display_price": {
"amount": "25.32",
"currency": "HKD"
},
"variant_to_replace": null
}
],
"tax_total": null,
"bonus_credits": [],
"bonus_credits_used_total": null,
"exchange_total_including_tax": {
"amount": "25.32",
"currency": "HKD"
},
"charge_by": "aftership"
},
"shop_now": true,
"cost_of_return": null,
"checkout_total": {
"amount": "0.00",
"currency": "HKD"
},
"estimated_refund_total": {
"amount": "21.24",
"currency": "HKD"
},
"refunds": [],
"refund_destination": "store_credit",
"restocks": [],
"shipments": [],
"dropoffs": [],
"created_at": "2025-03-13T10:47:31.353Z",
"updated_at": "2025-03-13T10:47:31.353Z",
"exceptions": [],
"outcomes": ["store_credit"],
"shipping_status": ""
}
}
}


Use cases


Use Case 1: Sending return request confirmation email with exchange item details


This flow triggers when a customer submits a return request for an exchange. The system will automatically send a confirmation email to the customer, listing the items involved in the exchange.


  • Flow Trigger: AfterShip: Return request - Submitted
  • Flow Trigger Filter: Outcomes contains exchange or upsell


Steps:


  1. Configure an email template to include the list of exchange items.
  2. Use the “exchange” data from the AfterShip payload to populate the exchange item details in the email.


Example Data (Exchange Items):


"exchange": {
"order": null,
"items": [
{
"external_product_id": "9004406407464",
"external_variant_id": "47984808919336",
"sku": "3AD3689AF16941199F11E63214D3E223",
"title": "Example Product Title - Only Top / L",
"product_title": "Example Product Title",
"variant_title": "Only Top / L",
"quantity": 1,
"unit_display_price": {
"amount": "25.32",
"currency": "HKD"
},
"variant_to_replace": null
}
],
"tax_total": null,
"bonus_credits": [],
"bonus_credits_used_total": null,
"exchange_total_including_tax": {
"amount": "25.32",
"currency": "HKD"
},
"charge_by": "aftership"
}


Use Case 2: Sending gift return request update email to gift recipients


This flow triggers when a return request is created as a gift return. Instead of sending the notification to the customer who made the original purchase, the email will be sent to the gift recipient.


  • Flow Trigger: AfterShip: Return request - Approved
  • Flow Trigger Filter: Is Gift Return equals to true


Steps:


  1. Configure an email template that includes gift return details and the recipient’s information.
  2. Send the email to the recipient's email address as provided in the payload.


Example Data (Gift Return):


"gift_return": {
"recipient": {
"name": "Example",
"email": "contact@yourname.com",
"shipping_address": {
"contact_name": "Example Name",
"company_name": "AfterShip",
"street_1": "street_1",
"street_2": "street_2",
"city": "Hong Kong",
"state": {
"name": "Kowloon"
},
"postal_code": "999077",
"country_region": {
"code": "HKG"
},
"phone": null,
"email": "contact@yourname.com"
}
}
}


Use Case 3: Sending email notification to customers receiving store credit


This flow triggers when a return request is resolved by issuing store credit as a refund. The email will notify the customer about the store credit and encourage them to make future purchases by showcasing product recommendations.


  • Flow Trigger: AfterShip: Return request - Resolved
  • Flow Trigger Filter: Outcomes contains store_credit


Steps:


  1. Configure an email template that includes the store credit details and recommendations for other products across different categories (e.g., Best Sellers, New Arrivals, etc.).
  2. Highlight the store credit amount and encourage the customer to explore new products in your store.


Example of recommended categories:


  • Best Selling Items
  • New Arrivals
  • Seasonal Specials


For any further questions or help, please contact our chat support team or reach out to us at support+returns@aftership.com.

Updated on: 29/05/2025