> For the complete documentation index, see [llms.txt](https://docs-shpf.bsscommerce.com/b2b-wholesale-solution/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-shpf.bsscommerce.com/b2b-wholesale-solution/integration/klaviyo.md).

# Klaviyo

<figure><img src="https://1478990334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGolQYRPH9iUGYatlTXwl%2Fuploads%2Fh4yXy6GssDjM8cj62F6y%2Fimage.png?alt=media&amp;token=b540486c-2b1d-49fa-ba39-298b87eb16ba" alt=""><figcaption></figcaption></figure>

Klaviyo is an email marketing tool for Shopify merchants: personalized campaigns, segmentation and automated flows. You can check it out here: <https://apps.shopify.com/klaviyo-email-marketing>

Connect Klaviyo with a private API key and B2B Solution sends **Registration Form** events (pending, approved, rejected, invite) to Klaviyo with the wholesaler's form data. You then build Klaviyo segments and flows on those events.

* **Profile synchronization:** wholesaler profiles from the registration form reach Klaviyo with their form fields.
* **Personalized communication:** send branded notifications through Klaviyo flows.

{% hint style="info" %}
The integration is designed for the **Registration Forms** module. B2B Solution keeps sending its own registration emails; turn off the matching templates in **Email templates** if Klaviyo sends yours.
{% endhint %}

## 1. Enable the integration

**Step 1:** In Klaviyo, click your organization name (bottom left) › **Settings › API keys › Create Private API Key**. Name it and choose **Full access**, or **Custom** with **Events** and **Metrics** access. Click **Create**. Copy the key right away: Klaviyo shows it only once. Help: <https://help.klaviyo.com/hc/en-us/articles/7423954176283>

**Step 2:** In the app, go to **Integrations** and open the **Email marketing** tab. Click **Integrate** on the **Klaviyo** card. In the dialog, paste the key in **API key** and click **Check**. You should see "Your key is valid."

<figure><img src="https://1478990334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGolQYRPH9iUGYatlTXwl%2Fuploads%2Fgit-blob-56c8008df6ea06bb2472873af50838b6e4488d51%2Fcms-klaviyo-01.png?alt=media" alt="Klaviyo configuration dialog"><figcaption><p>Klaviyo configuration dialog</p></figcaption></figure>

**Step 3:** Under **Integration control**, tick **Turn on integration** and click **Save**. The card badge changes to **Integrated**.

<figure><img src="https://1478990334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGolQYRPH9iUGYatlTXwl%2Fuploads%2Fgit-blob-3d9870c6b39f5b9fd732c72669eb85844a7464f4%2Fcms-klaviyo-02.png?alt=media" alt="Turn on the Klaviyo integration"><figcaption><p>Turn on the Klaviyo integration</p></figcaption></figure>

{% hint style="info" %}
**Save** and **Turn on integration** stay disabled until the key passes **Check**. After you turn the integration on, allow up to 5 minutes before new events start. Events are sent when you approve or reject an application, and only while the integration is on; earlier applications are not sent later.
{% endhint %}

<figure><img src="https://1478990334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGolQYRPH9iUGYatlTXwl%2Fuploads%2FwfNlg2ecWB3JC1T5PSCO%2Fimage.png?alt=media&amp;token=128056a9-359f-4ff9-8636-0c2c2b86ced7" alt=""><figcaption></figcaption></figure>

## 2. Segmenting wholesalers in Klaviyo

Go to **Audience › Lists & segments** and create a new segment.

<figure><img src="https://1478990334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGolQYRPH9iUGYatlTXwl%2Fuploads%2FpWDoN5NOnTdfJ2bog0uP%2Fimage.png?alt=media&amp;token=0b52e2a7-c80f-4a4c-900a-0fac473cb9f4" alt=""><figcaption></figcaption></figure>

In **Definition**, choose **What someone has done (or not done)** or **Properties about someone**.

**Metrics:**

* *RF - Account Approved*: the account is approved or created.
* *RF - Account Rejected*: you reject the application.
* *RF - Pending Approval*: a registration is saved for review.
* *RF - Account Invite*: an activation email is sent to an existing customer who still has to activate the account.

{% hint style="info" %}
For a wholesaler segment, include profiles that had *RF - Account Approved* **at least once over all time**.
{% endhint %}

<figure><img src="https://1478990334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGolQYRPH9iUGYatlTXwl%2Fuploads%2F5V931RQBK3FHRyDAvwg0%2Fimage.png?alt=media&amp;token=cc465b50-b7e2-4454-9b18-315dff9f7360" alt=""><figcaption></figcaption></figure>

**Properties:** custom form fields are saved as properties named "RF - "; company and phone are saved as *RF - Company* and *RF - Phone*. Email, first name, last name and other form fields are sent; passwords never are.

<figure><img src="https://1478990334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGolQYRPH9iUGYatlTXwl%2Fuploads%2F72EaUgaCJ3RpBMnFsIqO%2Fimage.png?alt=media&amp;token=df5a057b-c242-4203-87e1-45f16322b93c" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://1478990334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGolQYRPH9iUGYatlTXwl%2Fuploads%2FwuxoXagKT3sBpgEDFXzY%2Fimage.png?alt=media&amp;token=accbb01e-c6cd-4d44-b4d9-b974b36f784b" alt=""><figcaption></figcaption></figure>

## 3. Personalized notifications with Klaviyo

Go to **Flows › Create flow**, select **Build your own** and name the flow.

<figure><img src="https://1478990334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGolQYRPH9iUGYatlTXwl%2Fuploads%2Fnq95ERi72huCMCFttq3I%2Fimage.png?alt=media&amp;token=7d3f2e56-bdc6-4428-9037-895f5b2b92d6" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1478990334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGolQYRPH9iUGYatlTXwl%2Fuploads%2FNlk9ypJmgMBwlgKYj405%2Fimage.png?alt=media&amp;token=c32db80e-9069-4648-b2ef-e0e5303939b0" alt="" width="375"><figcaption></figcaption></figure>

In **Trigger**, choose **Metric** and pick one of the four RF events, then add your email or SMS content.

<figure><img src="https://1478990334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGolQYRPH9iUGYatlTXwl%2Fuploads%2F082J3HuXpG1cNbCqzC2h%2Fimage.png?alt=media&amp;token=2da8bd9f-a4ea-44d2-bf9a-51a56851284b" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1478990334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGolQYRPH9iUGYatlTXwl%2Fuploads%2FYoQiIpb2QjQpZ31ZbVZh%2Fimage.png?alt=media&amp;token=f3e09591-ea61-4e78-937d-8ac8d7b7a4e4" alt="" width="410"><figcaption></figcaption></figure>

## 4. Disable data synchronization to Shopify

If your form uses **After registration, the customer will need to be manually approved**, go to Klaviyo › **Integrations › Shopify** and turn off **Sync profiles, profile data, and custom properties from Klaviyo to Shopify**. Otherwise unapproved profiles appear in Shopify admin, which conflicts with the approval logic.

<figure><img src="https://1478990334-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGolQYRPH9iUGYatlTXwl%2Fuploads%2FvzT2atoZhm7rgjwEwFOj%2Fimage.png?alt=media&amp;token=2e034def-f2ad-4b84-aa6e-2150efea5317" alt=""><figcaption></figcaption></figure>

## 5. Insert customer data into Klaviyo emails

Use `{{ person|lookup:'field_key' }}` in a Klaviyo template, for example:

| Form field | Data variable                       |
| ---------- | ----------------------------------- |
| Email      | `{{ person\|lookup:'email' }}`      |
| First name | `{{ person\|lookup:'first_name' }}` |
| Last name  | `{{ person\|lookup:'last_name' }}`  |

For **RF - Account Invite**, the property *RF - Activation URL* holds the account activation link.

## Change the key or disconnect

* **Change the key:** click **Manage** on the Klaviyo card, paste the new key, click **Check**, then **Save**.
* **Disconnect:** click **Manage**, untick **Turn on integration** and click **Save**. You do not need **Check** to turn it off, even if the key was revoked. Events stop right away and the key stays stored.

{% hint style="info" %}
When your key passes **Check**, B2B Solution creates any missing RF metrics by sending one setup event each for a placeholder profile (`no-reply-shopify@bsscommerce.com`). You can ignore or exclude it.
{% endhint %}

{% hint style="info" %}
If you need further assistance, please feel free to reach us at [**support@bss-b2b.solutions**](mailto:support@bss-b2b.solutions) or [**Live Chat**](https://go.crisp.chat/chat/embed/?website_id=9f64b5a9-1a02-4190-93b8-8ef56b19f740).
{% endhint %}
