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 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
List of flows and triggers
Payload
Create email workflow with Happy Returns® QR code

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 {{ event.name }} 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.

Expired return



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)




All available metrics


MetricsCondition
resolved (replace with the same item)The return is resolved AND the resolution is replace with the same item
resolved (exchange for other items)The return is resolved AND the resolution is exchange for other items
resolved (refunded to original payment)The return is resolved AND the resolution is refund to original payment method
resolved (refunded to store credit)The return is resolved AND resolution is refund to store credit
received returnAll items are marked as received
approved returnThe return is (auto/manually) approved by the merchant
submitted returnThe return is created by the shopper
rejected returnThe return is rejected by the merchant
expired returnThe return is expired since no shipment status update


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



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

Payload example

{
    "name": "H0U2YQL6",
    "order": {
        "external_id": "4881235902712",
        "name": "#1119",
        "number": "1119"
    },
    "merchant_notes": null,
    "approval_status": "approved",
    "shipping_status": null,
    "resolution": "original_payment",
    "return_method": "Ship with any carrier of your choice",
    "customer": {
        "email": "jj.ye@aftership.com",
        "phone": {
            "country_region_code": "",
            "number": ""
        },
        "first_name": "Rick",
        "last_name": "Johnston"
    },
    "items": [
        {
            "title": "Example T-Shirt - Lithograph - Height: 9\" x Width: 12\"",
            "sku": "",
            "customer_notes": [
                ""
            ],
            "reason": "Arrived too late",
            "subreason": "",
            "unit_price_set": {
                "presentment_money": {
                    "currency": "USD",
                    "amount": 25
                },
                "shop_money": {
                    "currency": "USD",
                    "amount": 25
                }
            },
            "discount_set": {
                "presentment_money": {},
                "shop_money": {}
            }
        }
    ],
    "shipments": [
        {
            "label": {
                "url": null,
                "updated_at": "2022-08-30T07:22:26Z"
            },
            "trackings": [
                {
                    "tracking_number": null,
                    "slug": "",
                    "original_courier_name": null
                }
            ]
        }
    ],
    "refund": {
        "refunded_total_set": {
            "presentment_money": {},
            "shop_money": {}
        }
    },
    "metrics": {
        "created_at": "2022-08-29T07:58:44Z",
        "updated_at": "2022-08-30T07:22:26Z"
    },

		"reject_reason": "xxx",  
		"dropoffs": [
        {
            "dropoff_slug": "happy-returns",
            "dropoff_number": "HRZY92KC",
            "status": "dropped",
            "label_qr_code": "https://partner.happyreturns.com/barcode/qr?code=HRZY92KC",
        }
    ]
}


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: 02/11/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!