Ruby

Python

PHP

Java

Node.js

Go

.NET

Klaviyo

Crossing Minds is pleased to provide a best-in-class solution to email and SMS recommendations through its integration with Klaviyo. If you already have a Klaviyo account, you can leverage the advanced AI technology and machine learning science backing the Crossing Minds API and platform to deliver true 1:1 personalization direct to your users’ inboxes.

There are a few steps you will take to get started with sending out highly personalized recommendations built by Crossing Minds through your Klaviyo account. First, you’ll have to provide credential access to Crossing Minds, create a new Klaviyo workflow integration, then allow Crossing Minds to build out recommendations based on your users’ behavior as well as the unique attributes of your products or items. The final step involves taking the code generated by the Crossing Minds AI and pasting it into your Klaviyo content builder to create unique recommendations. Read on for detailed instructions on how to take advantage of this powerful integration.

API Key Credentials

To obtain the credentials needed to connect Klaviyo and Crossing Minds, you must go to  Account → Settings → API Keys.

You can create a new private key by pressing the Create Private API Key button, or you can use a previously created private key.

Personalized Campaign

Introduction

Crossing Minds can deploy recommendations sent to users via email, providing User-to-Item recommendations while ensuring the removal of low-value items. These recommendations are more effective at converting than basic “popular items” or “new items” recommendations.

In the case of sending personalized emails, each user will receive a slightly different email populated with content unique to that user. That content which differs per user is referred to as user properties. Crossing Minds’ API is able to create this level of personalization by evaluating the unique behaviors and tastes of each individual user, as well as by analyzing the granular elements that make a product or item unique.

To link the recommendations and the products to be deployed in Klaviyo, there are two methods:

  • Using the Klaviyo Catalog Lookup: In this scenario, only the IDs of the product are exported.
  • Exporting item properties: In this scenario, all information about the product recommended is exported except for the IDs. For instance, it will export title, price or image URL and store them in a custom property on Klaviyo. These parameters depend on the item properties available in the Crossing Minds platform.

Campaign & A/B Tests

There are three use cases for retrieving and deploying the recommendations. The first is a typical campaign deployment, while the second and third serve as A/B tests for the customer to determine the value add of Crossing Minds:

  • A normal campaign: Crossing Minds creates a list of users, and for each user, a set of recommended items.
  • An internal A/B test: Crossing Minds creates two lists of users. We create a set of recommended items for each user in list A. Then we create a set of items generated by some control mechanism, such as “most popular items,” for each user in list B.
  • A Klaviyo A/B test: Crossing Minds creates one list of users, and two sets of items, A and B, for each user. Klaviyo then randomly splits the list into groups A and B, and sends items from A to users in A, and items from B to users in B.

It might be the case that a customer would want Crossing Minds to send only our recommendations to group A, and subsequently send their own content to group B. This falls under the “normal campaign” use case. 

Because Klaviyo has no concept of an item catalog, just a list of users and some content to sent to each user, Crossing Minds ensures the upload of all the item properties (title, description, price, image URL, etc.) which will be displayed to the users.

Create Personalized Campaign

Create or select an existing campaign in the Campaigns view in Klaviyo dashboard.

Recipients → send to add the list created during the export recommendation process (the list has the same name as the output table used in Crossing Minds platform). Finally, press the button Continue to Content.

Press Edit Email to open the email template.


Drag and drop a text block where the carousel with the recommendations will be inserted.


Edit the Text block and select the source mode.

Depending on whether you used the Klaviyo Catalog method or Exported Item Properties method, you will paste one or the other of these HTML codes into the Source box.

Catalog Lookup Method

Insert the plain script below and save. For more information on catalog properties and their uses, click here. Note that the name 'item_id' of the custom property depends on how the recommendations and the products are linked.

Klaviyo Block
Copied to clipboard!

      {% for item_id in person|lookup:'item_id' %}
			{% catalog item_id %}
			  <img src="{{ catalog_item.featured_image.full.src }}"/>
				{{ catalog_item.title }}
				{{ catalog_item.description }}
				{% endcatalog %}
			{% endfor %}
      
      

It is also possible to use this other recommendation carousel design with basic styles or customize it.

Klaviyo Block
Copied to clipboard!

<table align="left" border="0" cellpadding="0" cellspacing="0" width="100%">
  <tbody>
    {% for item_id in person|lookup:'item_id' %}
    <td>
      {% catalog item_id %}    
      <table align="left" border="0" cellpadding="30" cellspacing="0" width="100%">
        <tbody align="center" style="">
          <tr>
            <td align="center" valign="top">
              <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
                <tbody>
                  <tr>
                    <td align="center">
                      <img src="{{ catalog_item.featured_image.full.src }}" style="display:block;max-width:100%;max-height:125px;" width="100%">
                    </td>
                  </tr>
                </tbody>
              </table>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <table border="0" cellpadding="0" cellspacing="0" class="kmTextBlock" width="100%">
                <tbody>
                  <tr>
                    <td align="center" style="padding-top:5px;font-weight:bold;text-align:center;padding-bottom:0px; ">
                      <p style="padding-bottom:0">{{ catalog_item.title }}</p>
                    </td>
                  </tr>
                  <tr>
                    <td align="center" style="padding-top:5px;font-weight:normal;text-align:center;padding-bottom:0px;">
                      <p style="padding-bottom:0">${% currency_format catalog_item.metadata|lookup:"price" %}</p>
                    </td>
                  </tr>
                  <tr>
                    <td align="center" style="font-weight:normal;text-align:center;">
                      <p style="padding-bottom:0">{{ catalog_item.description }}</p>
                    </td>
                  </tr>
                </tbody>
              </table>
            </td>
          </tr>
        </tbody>
      </table>
      {% endcatalog %}
    </td>
    {% endfor %}
  </tbody>
</table>
      

Workflow Integration

This solution uses a webhook to update the custom properties of the user/profile in Klaviyo with the recommendations. Adding the webhook before using the recommendations in any email or SMS is essential.

The webhook must call the URL with a POST request:

Must use a Basic Authentication with the service account's name, db_id and password. (More info here)

Body Parameters

  • type (string): type of recommendation. The values allowed are profile_based, session_based, similar_items, precomputed_profile_based, precomputed_similar_items, profile_based_w_ctx_items and session_based_w_ctx_items.
  • klaviyo_profile (string): email of user/profile in Klaviyo where the recommendations will be uploaded as a custom property.  
  • params (object) - optional: the recommendation parameters depend on the type.
  • amt, scenario, filters, reranking, etc are all available, please refer to the endpoint documentation. More info in profile_based, session_based, similar_items, precomputed_profile_based, precomputed_similar_items profile_based_w_ctx_items and session_based_w_ctx_items.
  • property_mapper (object) (optional): dictionary that maps the recommendation Crossing Minds items properties (key) to Klaviyo custom properties (value). If the parameter does not exist, it only exports the item_id recommendation as cm.wf.item_id by default.

Setup

From the Crossing Minds dashboard, follow these steps: 

1 - Go to Settings → Service Accounts → Add Service Accounts and select Klaviyo. (Note: Save the password in your preferred place because once the service account is created, the password cannot be recovered.)

2 - The db_id must be obtained using the Crossing Minds dashboard. Go to For Developers and copy the Database ID.

3 - Add the Klaviyo credentials in Crossing Mind (Connections → Destination → Emails → Klaviyo → Connection) as shown below.

4 - From the Klaviyo dashboard, follow these steps:

  1. Create or open a flow.
  2. Insert a webhook in the flow before where you plan to use the recommendations.
  3. Configure the webhook as follows:
Klaviyo Block
Copied to clipboard!

    "type":"profile_based",    
    "klaviyo_profile": "{{ person.email }}",    
    "params":{        
    	"user_id": "{{ person.email }}",        
      "amt": 3,        
      "property_mapper": {            
      	"title": "cm.wf.title",            
        "poster_url": "cm.wf.image"        
        }    
     }
  }
      

5 - Test the webhook using the button Preview Webhook, select a profile and then send the test request. After that, the profile must have the recommendation in the section Custom Properties.

6 -  Add any other actions after the webhook to use the recommendations, like email or SMS.

Get started with Crossing Minds recommendation API

Crossing Minds Recommendation API is the easiest way to integrate personalized recommendation to your website & mobile apps

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
We use cookies (and other similar technologies) to collect data in order to improve our site. You have the option to opt-in or opt-out of certain cookie tracking technologies.To do so, click here.

Beam

API Documentation Center,
please wait a bit...