# Klaviyo

> This page is about FlutterFlow (the app builder you use by describing your app), not FlutterFlow Studio.

URL: https://docs.flutterflow.io/ffx/klaviyo

Connect a Klaviyo private API key, and then ask the agent to add sign-ups from your app to your Klaviyo lists, keep profiles up to date, and send events that start your flows.

Use Klaviyo for your app's email and SMS marketing: your app adds the people who agree to marketing to your Klaviyo lists, keeps their profiles up to date, and sends events that your Klaviyo flows start on. To connect, you need a Klaviyo private API key.

## Connect Klaviyo {#connect-klaviyo}

To connect Klaviyo, first create a private API key in Klaviyo under **Settings › API keys › Create Private API Key**. Give it **Full Access**, or make a **Custom Key** with Read access to Accounts and Segments, and Read/Write access to Lists, Profiles, Subscriptions, and Events. The key starts with `pk_`, and Klaviyo shows it only once.

Only a project owner can connect Klaviyo. If you're a project owner, connect it:

1. Open **Project Settings › Connections**, and then turn on the switch for **Klaviyo**.
2. In the **Connect Klaviyo** dialog, paste the key into **Private API key**. To open Klaviyo's help on private API keys, click **Find it** beside the label.
3. Click **Connect**.

For more about connecting, see [Connect a service](https://docs.flutterflow.io/ffx/connect-a-service).

## What to ask {#what-to-ask}

Ask the agent for the sign-up form, profile update, or event that you want, and name the Klaviyo list or event it uses. For example, your app can read your lists and segments, find a person's profile (including whether they can get marketing email and SMS), update profiles, subscribe people to a list, and record events. It can also call other Klaviyo API endpoints that your key's access allows.

> Example request: "Add a newsletter checkbox to the sign-up screen. When a person selects it, subscribe their email address to my Newsletter list in Klaviyo, with App sign-up screen as the source."

> Example request: "When someone changes their name or city in their profile, update their Klaviyo profile to match."

> Example request: "When a person finishes checkout, send a Placed Order event to Klaviyo with the order's items and total, using the order number as its unique ID."

Subscribe only people who agreed to marketing. Subscribing an email address signs it up for email marketing, and subscribing a phone number signs it up for SMS marketing, which needs SMS set up in Klaviyo. On a list with double opt-in, Klaviyo emails the person to confirm, and subscribes them after they confirm. Updating a profile or sending an event doesn't change anyone's consent.

## Agent questions {#agent-questions}

If Klaviyo isn't connected, the agent asks you to connect it in a card above the message box. See [Answer the agent](https://docs.flutterflow.io/ffx/answer-the-agent).

## Review {#review}

After the agent finishes, read the turn's [**Summary**](https://docs.flutterflow.io/ffx/what-changed#summary) and review its [**Changes**](https://docs.flutterflow.io/ffx/what-changed#changes-tab). Check the affected screens in **Screens**, and try the change in **Preview**. If the change uses records or sign-in, test it with [the thread's own data in **Data**](https://docs.flutterflow.io/ffx/thread-data).

After you push a backend change, check the result in **Backend**.

Test with an email address that you own, and then find its profile in Klaviyo. Klaviyo processes subscriptions and events shortly after your app sends them, so a new one can take a moment to show. Klaviyo drops events for example.com and test.com addresses, so don't test events with them.

## Push {#push}

After you test the feature, [push the changes to your app](https://docs.flutterflow.io/ffx/push).

## Next steps {#next-steps}

- To replace the key or disconnect Klaviyo, see [Manage connections](https://docs.flutterflow.io/ffx/manage-connections).
- For other services your app can use, see [Available services](https://docs.flutterflow.io/ffx/services).

## Troubleshooting {#troubleshooting}

- **The dialog says that you pasted the public key:** Klaviyo's six-character public key (site ID) doesn't connect. Paste a private API key, which starts with `pk_`.
- **Klaviyo refuses a call for missing access:** a key's access can't be changed after you create it. Create a private API key with the access listed in [Connect Klaviyo](#connect-klaviyo), and then [replace the key](https://docs.flutterflow.io/ffx/manage-connections).
- For a key that's refused or a connection that needs attention, see [Troubleshoot connections](https://docs.flutterflow.io/ffx/troubleshoot-connections).
