Klaviyo Integration Guide
Flexsee enriches Klaviyo flows with AI-powered recommendations. Use this guide to connect an account and validate that events are flowing.
1. Collect API credentials
- Log into Klaviyo.
- Navigate to Account → Settings → API Keys.
- Create a Private API Key with full access to Metrics and Profiles.
- Note the Public API Key (Site ID) for client-side tracking (if required).
Store both keys securely. Flexsee only needs the private key for server-to-server enrichment, but you can optionally include the public key when wiring Flexsee.js.
2. Connect in the Flexsee dashboard
- Go to Integrations → Email & SMS (
/integrations/marketing/email-sms) and connect Klaviyo. - Paste the private key.
- Click Connect.
- Flexsee validates the key by fetching account information and stores it encrypted in
marketing_integrations.
3. Enable enriched post-purchase flows
Once connected, Flexsee emits a Placed Order metric through the Klaviyo API integration. This metric lives alongside Shopify’s own “Placed Order,” so you’ll see two entries with the same name. Hover in the trigger picker to check the Integration column:
- Flexsee API Placed Order → contains
flexsee_*properties and is what Flexsee sends. - Shopify Placed Order → comes from the Shopify/Klaviyo native app.
New flow vs. existing Shopify flow
| Scenario | What to do |
|---|---|
| You’re fine creating a new flow | Build a new flow and choose the Flexsee API Placed Order metric as the trigger. Leave your existing Shopify flow untouched. |
| You already have a Shopify post-purchase flow and want Flexsee to drive it | Clone the existing flow (Flows → … → Clone), open the clone, click Edit Trigger, and switch the metric to the Flexsee API version. All emails/content stay intact—only the source metric changes. |
| You absolutely must keep the Shopify trigger | Klaviyo doesn’t let a single flow receive both sources, so you’ll need two flows (Shopify + Flexsee). You can keep the old flow for native Shopify, and let Flexsee handle only the AI variant. |
After selecting the Flexsee metric, turn the flow Live and remove any time delays while you test. The Flow Activity panel should now show Flexsee events entering the flow.
Metric properties
Every Flexsee event includes:
flexsee_recommendations– array of{ productId, title, price, currency, imageUrl, url, reason, rank }flexsee_has_recommendations– boolean guard so you can safely render the block- Standard order context:
orderTotal,currency,cartItems,lineItems, etc.
Email template snippet
Email template snippet
Paste into a Klaviyo HTML block. Uses Django syntax (not Shopify limit:). Shows up to 3 products via |slice:"3" — change to |slice:"4" etc. to match products per email.
{% if event.flexsee_recommendations %}
<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="max-width:600px;margin:0 auto;font-family:Helvetica,Arial,sans-serif;">
<tr>
<td style="background:linear-gradient(135deg,#f0f9ff 0%,#e0f2fe 100%);border-left:4px solid #6366f1;border-radius:12px;padding:20px 16px 16px;box-shadow:0 4px 14px rgba(99,102,241,0.12);">
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="padding-bottom:16px;">
<table role="presentation" cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign="middle" style="padding-right:8px;font-size:18px;line-height:1;color:#6366f1;">
★
</td>
<td valign="middle" style="font-size:20px;font-weight:600;color:#1e293b;line-height:1.3;">
Picked Just For You
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
{% for rec in event.flexsee_recommendations|slice:"3" %}
<td width="33%" valign="top" style="padding:0 6px;">
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" border="0" style="background:#ffffff;border-radius:10px;overflow:hidden;box-shadow:0 2px 8px rgba(15,23,42,0.08);">
<tr>
<td style="line-height:0;">
<a href="{{ rec.url }}" style="text-decoration:none;">
<img src="{{ rec.imageUrl }}" alt="{{ rec.title }}" width="168" style="display:block;width:100%;max-width:168px;height:auto;border:0;outline:none;" />
</a>
</td>
</tr>
<tr>
<td style="padding:12px;font-family:Helvetica,Arial,sans-serif;">
<p style="margin:0 0 8px;font-size:15px;line-height:1.35;font-weight:600;color:#111827;">
<a href="{{ rec.url }}" style="color:#111827;text-decoration:none;">{{ rec.title }}</a>
</p>
<p style="margin:0 0 12px;font-size:18px;line-height:1.2;font-weight:700;color:#6366f1;">
{{ rec.currency|default:"" }} {{ rec.price }}
</p>
<a href="{{ rec.url }}" style="display:block;background:#6366f1;color:#ffffff;padding:10px 12px;border-radius:8px;text-decoration:none;font-weight:600;font-size:13px;text-align:center;">
Shop Now
</a>
</td>
</tr>
</table>
</td>
{% endfor %}
</tr>
</table>
</td>
</tr>
<tr>
<td style="padding-top:14px;font-size:12px;line-height:1.45;color:#6366f1;font-style:italic;">
AI-powered recommendations based on your shopping behavior
</td>
</tr>
</table>
</td>
</tr>
</table>
{% endif %}
4. Run an end-to-end test
- Update your Klaviyo flow so it is Live, has no time delays, and uses the Flexsee API Placed Order metric as the trigger.
- Place a test order in Shopify (or mark an order as paid) using your own subscribed email address. When Shopify fires the
orders/createororders/paidwebhook, Flexsee enriches the event and forwards it to Klaviyo. - In Klaviyo, visit Analytics → Metrics and confirm the Flexsee metric shows the new event.
- Open the flow’s Activity Feed to confirm the email was sent (or see why it was skipped).
- Check your inbox to verify the recommendations render correctly.
If you prefer to test via API, call:
curl -X POST https://api.flexsee.ai/marketing/test/post-purchase \
-H "Authorization: Bearer <Flexsee-admin-JWT>" \
-H "Content-Type: application/json" \
-d '{"orderId":"1234","orgId":"..."}'
Troubleshooting
- 401 errors – confirm the private key is still active in Klaviyo and redeploy the backend after rotation.
- Metric not appearing – Klaviyo sometimes takes a few minutes to register a new custom metric after the first event. Trigger a second test if needed.
- Emails missing product data – ensure the product handles passed by Flexsee exist in the Shopify catalog and that the Klaviyo template renders conditionally.