Integrations

Klaviyo

Connect Klaviyo with a private API key so the bot can subscribe and unsubscribe customers, and your Python actions can call the Klaviyo API.

Connect Klaviyo to let the bot handle newsletter requests in conversations: it subscribes customers who ask to join your emails and unsubscribes customers who ask to stop them. Your custom actions and other Python automations can also call the Klaviyo API with the same key, for example to send an event that starts a flow.

Create a private API key in Klaviyo

Use a Custom Key so the key can only do what you allow.

  1. In Klaviyo, click your account name in the bottom left and open Settings -> API keys.
  2. Select Create Private API Key and name it, for example Octocom.
  3. Choose Custom Key. Give it the base permissions below, plus any extra permissions for what you want the bot to do. Leave everything else at No Access.
  4. Select Create and copy the key. It starts with pk_.

Don't use the public API key (your six-character site ID): it can't change subscriptions.

Base permissions

These cover the bot's built-in newsletter actions. Unsubscribing a customer needs Profiles and Subscriptions; subscribing also needs Lists. Octocom checks the key by reading your lists.

ScopeAccess
ListsRead/Write
ProfilesRead/Write
SubscriptionsRead/Write

Extra permissions for what the bot should do

Add only what your automations need:

What the bot should doAccess
Send events, for example to trigger a flow after a support chatEvents: Read/Write
Look up a customer's orders and email activity tracked in KlaviyoEvents: Read, Metrics: Read
Check segment membership, for example to treat VIPs differentlySegments: Read

For anything else, give the key the scopes that Klaviyo's API reference lists for the endpoint you call. If the key is missing a scope, Klaviyo returns HTTP 403. To add permissions, create a new key with the extra access and paste it into the same window in Octocom.

Connect it in Octocom

  1. Open Settings -> Integrations -> Klaviyo.
  2. Paste the key and select Connect.
  3. Octocom checks the key with Klaviyo before saving it. If the check fails, nothing is saved and the message says what to fix: usually a key copied incompletely or missing Lists access. A key you replace keeps working until the new one passes the check.

The check reads your lists, so it can't confirm the write access subscribing and unsubscribing need. Select Test connection at any time to check the saved key again.

The key is never shown again after saving; Octocom only shows its first characters and last four, so you can recognise it in Klaviyo's key list. To replace it, paste a new key into the same window.

What the bot does

Connecting turns on two bot actions. The bot asks the customer for their email before using either one.

  • Subscribe: gives the email marketing consent in Klaviyo. Your account's default opt-in setting decides whether Klaviyo sends a confirmation email first (double opt-in).
  • Unsubscribe: suppresses the profile, so it stops receiving your marketing emails.

Older connections may also have a mailing list saved. Subscribers from those connections are added to that list as well; the window shows the list ID.

To add subscribers to a specific list, call klaviyo_subscribe_to_list from a Python action instead.

Use it from Python

Python actions can call these helpers directly. Each one uses the business from the conversation and raises an error if Klaviyo isn't connected.

HelperWhat it doesScopes it needs
klaviyo_subscribe_to_list(context, email, list_id)Subscribes the email and adds it to the listLists, Profiles, Subscriptions: Write
klaviyo_suppress_profile(context, email)Unsubscribes the email from all marketing emailProfiles, Subscriptions: Write
klaviyo_create_event(context, email, event_name, properties)Records a custom event on the profileEvents: Write
klaviyo_get_lists(context)Returns your lists as {"lists": [{"id", "name"}]}Lists: Read

For other endpoints, read the key with get_integration_credentials. The klaviyo entry contains apiKey and mailingListId (only set for older connections). Send the key as Authorization: Klaviyo-API-Key {apiKey} to https://a.klaviyo.com/api, with a revision header such as 2026-10-15. Never log the key or request headers.

Disconnect

Open Settings -> Integrations -> Klaviyo and select Disconnect. The bot stops subscribing and unsubscribing customers, and automations that use the connection stop working. Your newsletter settings, such as a sign-up discount code, are kept for when you reconnect. The key stays in Klaviyo; delete it there if you no longer need it.

On this page