Articles on: Apps

How to Integrate AfterShip Returns with Klaviyo

Plans: Premium, Enterprise Platforms: 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
Create returns email notifications in Klaviyo
Create return flow
List of flows and triggers
Set up email notification in Klaviyo

- Create email from scratch
- Recreate AfterShip email notifications in Klaviyo

Payload
Create email workflow with Happy Returns® QR code
Use cases

Install Klaviyo in AfterShip Returns



Go to Apps in AfterShip Returns admin.
Click View more apps, and you will be redirected to the AfterShip Returns integration page.
Find Klaviyo and install the app.
Choose a eCommerce platform store under your AfterShip account for which you want to install the Klaviyo app.
Click Install app.
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



Go to Flows in Klaviyo admin
Click Create Flow > Build your own.
Label the flow as per AfterShip Returns native notifications for easy reference (e.g, Return approved flow).
Click Create flow.
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.

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



MetricsConditionStatus
AfterShip: Return request - SubmittedWebhook event: return.submitted. Occurs when a return request is successfully submitted.New
AfterShip: Return request - ApprovedWebhook event: return.approved. Occurs when a return request is approved.New
AfterShip: Return request - ExpiredWebhook event: return.expired. Occurs when a return request is expired.New
AfterShip: Return request - RejectedWebhook event: return.rejected. Occurs when a return request is rejected.New
AfterShip: Return request - ResolvedWebhook event: return.resolved. Occurs when a return request is resolved.New
AfterShip: Return dropoff - CreatedWebhook event: return.dropoff.created. Occurs when a drop-off parcel QR code is generated.New
AfterShip: Return dropoff - Shipment UpdatedWebhook event: return.dropoff.shipment.updated. Occurs when a shipment of drop-off is updated.New
AfterShip: Return dropoff - UpdatedWebhook 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 - RestockedWebhook event: return.restock.created. Occurs when a restock operation is executed via AfterShip.New
AfterShip: Return shipment - ProvidedWebhook event: return.shipment.provided. Occurs when the merchant provides a shipment.New
AfterShip: Return shipment - RecordedWebhook event: return.shipment.recorded. Occurs when the shopper provides shipment information.New
AfterShip: Return shipment - UpdatedWebhook event: return.shipment.updated. Occurs when the tracking status of a shipment changes.New
AfterShip: Return shipments - ProvidedWebhook event: return.shipments.provided. Occurs when the merchant has provided all the necessary shipment information.New
AfterShip: Return exchange order - CreatedWebhook 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 itemLegacy
resolved (exchange for other items)Return is resolved AND resolution is exchange for other itemsLegacy
resolved (refunded to original payment)Return is resolved AND resolution is refund to original payment methodLegacy
resolved (refunded to store credit)Return is resolved AND resolution is refund to store creditLegacy
received returnAll items are marked as receivedLegacy
approved returnReturn is (auto/manually) approved by merchantLegacy
submitted returnReturn created from shopper siteLegacy
rejected returnReturn is rejected by merchantLegacy
expired returnReturn is expired since no shipment status updateLegacy


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

Trigger filters



Trigger filterDesciptionExampleStatus
Filed byThe source of the return requestshopper,merchant,customer_supportNew
Is Gift ReturnWhether the return request is a gift return requestture,flaseNew
Approval statusThe status of the RMAreturn.submited, return.approved,return.done,return.rejcted,return.expiredNew
Item Return ReasonA list of the return reason included in the RMA-New
Reject ReasonThe reject reason input by merchant when rejecting the RMA in adminNew
Merchant NoteThe note input by merchant on the return request details page in adminNew
OutcomeThe outcome after the return request being processedrefund,store credit,upsell,exchangeNew
Return methodThe return method of the return request selected by shopper - including the return zone,routing rule name, return methodRest of World/Default/customer_courierNew
Shipping statusThe shipping status of the return shipmentShipped, Delivered, No_labelNew
Dropoff Service ProviderIf the return method is dropoff, this field will show the name of the service providerhappyreturnsNew
resolutionResolution of the RMA selected by shoppers when the return request is createdRefund to original payment method Refund to store credit, Replace with the same item, Exchange for other itemsLegacy
returns methodReturn 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 returnsLegacy
shipping statusThe tracking status of the return shipment.Shipped, no_label, DeliveredLegacy
typeThe type of the return requestgift_return, normalLegacy
approval statusThe approval status of the RMAapproved, submitted, expired, rejected,Legacy
nameThe RMA number of the return requestABCDEFGHLegacy


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


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.
Drag-and-drop the Email component from the left-hand side to the right-hand side
Click Set up email on the email block to start setting up the email on the side panel.
On the side panel, edit the email Name, Subject Line, Preview Text, Sender name, and Sender email address.
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.

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.



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:

Copy the content: Start by copying the email content from your AfterShip Returns notifications.
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 .
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® locations to 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_code merge



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:

Configure an email template to include the list of exchange items.
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 recipient


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:

Configure an email template that includes gift return details and the recipient’s information.
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 notification email to customer 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:

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.).
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

Updated on: 08/04/2025

Was this article helpful?

Share your feedback

Cancel

Thank you!