Articles on: Apps

How to Integrate AfterShip Returns with Klaviyo


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

Note: 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
Generate an API key in Klaviyo
Enable Klaviyo integration in AfterShip Returns
Recreate AfterShip Returns notifications in Klaviyo

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.
To install the Klaviyo app, you need to fill in a few details to authenticate the connection including

Store URL
Private API key
Public API key

In the Store URL field, input the URL of your store. Private and Public API keys, you have to generate in the Klaviyo settings.

Let’s find out how.

Generate an API key in Klaviyo

Migrate to Settings in Klaviyo admin
Locate API Keys on the sub-navigation bar and click Create Private API Key
Select Full Access Key to grant applications full access for every API scope
Once API key configuration is done, click Create
Copy the Private API key for AfterShip Returns you just created
Copy the Public API Key already generated for your store under Public API Key / Site ID

Enable Klaviyo integration in AfterShip Returns

Move back to Klaviyo and AfterShip Returns connection authentication page and paste the Private and Public API keys in their respective fields.

Click Install app

Recreate AfterShip Returns notifications in Klaviyo

There are 8 standard AfterShip Returns native notifications that can be replicated via the AfterShip Returns and Klaviyo integration.

Go to Flows in Klaviyo admin
Click Create Flow > Create From Scratch
Label the flow as per AfterShip Returns native notifications for easy reference
Click Metric and select the flow trigger
Select Action from the dropdown menu that will trigger the flow and click Done

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

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
Click the {...} icon to edit the email content
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
Based on the editor selected, edit the email message based on what information you want to show
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 email in the upper right hand corner.

For e.g., Under {{ customer }} field, {{name: DEMO}} field represents the RMA ID of the return request submitted by the customer. When you click on it, you will get the exact merge tag {{ }} which when inserted in the email will auto-import RMA ID from the Klaviyo database.

Find the list of flows and their triggers:

Find the breakdown of these flows as follows. Please note the variables used when building these emails from scratch in the second screenshot. You are welcome to change the variables or add more as per your requirements from the payload example given with each email flow.

Received return

Submitted return

Return approved

Rejected return

Resolved (refunded to store credit)

Resolved (refunded to original payment)

Resolved (exchange for other items)

Resolved (replace with the same item)


By default, each event contains the following fields in its payload:

Payload example

"name": "43Z0B696", // RMA id in Returns Center
"order": {
"external_id": "4890124781",
"name": "#1001",
"number": "TEST KRAKEN #1086"
"merchant_notes": [
"approval_status": "approved",
"shipping_status": "received",
"resolution": "store_credit",
"return_method": "Ship with a returns label",
"customer": {
"email": "",
"phone": {
"country_region_code": "852",
"number": "12345678"
"first_name": "Joe",
"last_name": "John"
"items": [
"external_order_line_id": "213896014643",
"title": "Another product",
"sku": "product-sku",
"quantity": 2,
"customer_notes": [],
"reason": "Incorrect item received",
"unit_price_set": {
"presentment_money": {
"currency": "USD",
"amount": 11.5
"discount_set": {
"presentment_money": {
"amount": null
"shipments": [
"label": {
"url": "",
"created_at": "2021-12-28T09:31:00.572287Z",
"updated_at": "2021-12-28T09:31:00.572287Z"
"trackings": [
"tracking_number": "111111",
"slug": "xdp-uk"
"refund": {
"refunded_total_set": {
"presentment_money": {
"currency": "USD",
"amount": 12.3
"metrics": {
"created_at": "2021-12-28T09:31:00.572287Z",
"updated_at": "2021-12-28T09:31:00.572287Z"

You can view the full payload for each event in the Preview Trigger Setup popup.

For any questions or help, please contact our chat support team

Updated on: 24/02/2023

Was this article helpful?

Share your feedback


Thank you!