Skip to main content

Best practices for using the Rule.io x yayloh integration

Learn how to create segments and set up automated return flows in Rule.io using yayloh event data

Vineeta Pendse avatar
Written by Vineeta Pendse
Updated over a week ago

Now it’s time to make the most of it by creating smart segments and flows that match your return strategy.

Thanks to the data shared from yayloh, you can personalize transactional flows and automate messages based on return types, shipping countries, label generation status, and more. You can even combine yayloh return data with your external system data for more advanced logic.


Where to find yayloh event data?

yayloh creates two tags in 'yayloh return request event' and 'yayloh store credit event'. You can look for the specific events under custom fields > order.

Sample data for yayloh return request event

[
{ "key": "Order.Number", "value": "36508", "type": "text" },
{ "key": "Order.yayloh_return-returnTypeSummary", "value": "claim", "type": "text" },
{ "key": "Order.yayloh_return-labelUrl", "value": "https://prod-shipping-label-yayloh.s3.amazonaws.com/2025-03-13/Return_shipping_label_eb08d50a-919b-424b-ad0c-ed98befdd819.GIF", "type": "text" },
{ "key": "Order.yayloh_return-commercialInvoiceUrl", "value": "", "type": "text" },
{ "key": "Order.yayloh_return-trackingUrl", "value": null, "type": "text" },
{ "key": "Order.yayloh_return-trackingNumber", "value": "1Z6892EF9127717404", "type": "text" },
{ "key": "Order.yayloh_return-shippingCompany", "value": "UPS", "type": "text" },
{ "key": "Order.yayloh_return-includesReturn", "value": false, "type": "text" },
{ "key": "Order.yayloh_return-includesExchange", "value": false, "type": "text" },
{ "key": "Order.yayloh_return-includesClaim", "value": true, "type": "text" },

{
"key": "Order.yayloh_return-returnedItems-id",
"value": [12095126],
"type": "multiple"
},
{
"key": "Order.yayloh_return-returnedItems-productSku",
"value": ["002431100301090"],
"type": "multiple"
},
{
"key": "Order.yayloh_return-returnedItems-sizeColorSku",
"value": [null],
"type": "multiple"
},
{
"key": "Order.yayloh_return-returnedItems-imageUrl",
"value": [
"https://cdn.shopify.com/s/files/1/0549/4338/3683/files/StenhammarIIBCC02.png?v=1740412086"
],
"type": "multiple"
},
{
"key": "Order.yayloh_return-returnedItems-name",
"value": ["Stenhammar II – Black Country Calf"],
"type": "multiple"
},
{
"key": "Order.yayloh_return-returnedItems-quantity",
"value": [1],
"type": "multiple"
},
{
"key": "Order.yayloh_return-returnedItems-size",
"value": ["UK 9 / EU 43 / US 9.5"],
"type": "multiple"
},
{
"key": "Order.yayloh_return-returnedItems-color",
"value": [null],
"type": "multiple"
},
{
"key": "Order.yayloh_return-returnedItems-sellingPrice",
"value": [0.0],
"type": "multiple"
},
{
"key": "Order.yayloh_return-returnedItems-currencyCode",
"value": ["DKK"],
"type": "multiple"
},
{
"key": "Order.yayloh_return-returnedItems-returnType",
"value": ["claim"],
"type": "multiple"
},
{
"key": "Order.yayloh_return-returnedItems-reasonText",
"value": ["No reason"],
"type": "multiple"
}
]

Sample data for store-credit event

[
{
"key": "Order.yayloh_store_credit-storeCreditAmount",
"value": "100.00",
"type": "text"
},
{
"key": "Order.yayloh_store_credit-discountCode",
"value": "123456HELLO",
"type": "text"
},
{
"key": "Order.yayloh_store_credit-currencyCode",
"value": "SEK",
"type": "text


Step 1: Create segments in Rule.io

Before building flows, we recommend starting with segments based on return-related triggers. You can read about how to create segments here.

Here are a few tried-and-tested ideas to get you going:

1. Default error-checking segment

(To trigger to customers with label generation errors or to customers in countries outside your label generation set up)

  • Tag: yayloh return request event

  • Rule: Order.yayloh_return-labelUrldoes not contain a value

  • Name: labelerror

2. Segment based on shipping country + label presence

  • Order.ShippingCountryCodecontains or does not contain (e.g. "SE")

  • Order.yayloh_return-labelUrlcontains a value

3. Segment by return type + label presence

  • Order.yayloh_return-returnTypeSummarycontains return, exchange, claim, etc.

  • Order.yayloh_return-labelUrlcontains a value

4. Combine country + return type filters

  • Combine 2 & 3 for more specific flows (e.g., “Exchange - Germany”)

5. Store-credit created


Step 2: Create automations using the segments

Once your segments are ready, you can start building 'transactional' automations to send emails based on return events.

You can read more about creating automations in rule here.

In Rule.io:

  1. Go to Automations

  2. Choose TriggerWhen a customer enters a segment

  3. Select the segment you just created

  4. Add an ActionSend email

  5. Choose or create the right email template (see below!)


Step 3: Create the email templates

To make sure customers receive the correct information in your return-related emails. You can read about adding custom fields in rule.io here.

Here’s what to include in your templates using yayloh's custom fields :

1. Default template:

This email template should be configured for customers within the ' Default error-checking segment'. The email could state 'There was an error in generating your return label please reach out our customer support.'

2. Return label + tracking link

If your flow involves sending a return label, add a clear call-to-action with these fields:

  • Order.yayloh_return-labelUrl → Use as the download return label button

  • Order.yayloh_return-trackingUrl → Use as a track return button or link

3. International returns with commercial invoice

For international carriers like UPS or FedEx, you may need to send a commercial invoice along with the label.

In addition to the two above, also include:

  • Order.yayloh_return-commercialInvoiceUrl → Add a button or link labeled Download Commercial Invoice

4. Product-level return details

Want to show your customers exactly what they’re returning?

You can display a list of returned items using fields like:

  • Order.yayloh_return-returnedItems-name

  • Order.yayloh_return-returnedItems-quantity

  • Order.yayloh_return-returnedItems-sku

  • Order.yayloh_return-returnedItems-reason

  • Order.yayloh_return-returnedItems-sellingPrice

This adds clarity and avoids confusion on the customer’s side.


Bonus tips

  • Combine yayloh fields with your own internal customer or order data to enrich the content.

  • Test each flow using mock return events before going live.

  • Consider language-specific segments if you operate in multiple countries.


Need help? Not sure which fields to use or how to structure your flow?
We’re here for you—reach out via chat or drop us a line at support@yayloh.com.

Did this answer your question?