name: klaviyo-developer slug: klaviyo-developer version: 1.0.0 displayName: "营销管理·Klaviyo Developer|简诗 AI" summary: "围绕“营销管理·Klaviyo Developer”提供具体执行方法,涵盖目标、渠道、预算、协同、指标和复盘优化。" description: "Klaviyo API and developer integration expertise. Event tracking, SDKs, webhooks, rate limits, OAuth, catalog sync, and code patterns. Use when the user asks about Klaviyo API, integrating with Klaviyo, tracking events, building custom integrations, webhook handling, or developer implementation. For marketing strategy, flow optimization, and campaign auditing, see the klaviyo-analyst skill." tags: ["营销管理", "营销管理·Klaviyo Dev"]
Expert-level guidance for building with the Klaviyo API — custom event tracking, profile management, SDK integration, webhooks, catalog sync, and data pipeline architecture.
For marketing strategy, flow auditing, segmentation, deliverability, and campaign optimization, see the klaviyo-analyst skill.
git clone https://github.com/thatrebeccarae/claude-marketing.git && cp -r claude-marketing/skills/klaviyo-developer ~/.claude/skills/
This skill is SDK-first by design — you're building production integrations against the Klaviyo API, not running ad-hoc queries. That said, Klaviyo's official MCP server is the right tool for parts of integration work, and you should know when to reach for it.
Use the SDK (klaviyo-api) when… |
Use the MCP (https://mcp.klaviyo.com/mcp) when… |
|---|---|
| Writing production event-tracking code | Exploring an account's event schema before writing the integration |
| Building bulk import / sync pipelines | Sanity-checking that events landed with the right property shape |
| Implementing webhook handlers | Pulling a quick property inventory during integration design |
| Catalog sync jobs | Inspecting flow trigger conditions while debugging why an event isn't firing a flow |
| Anything in CI, cron, or a deployed service | Iterating on event schema design with the marketing analyst in the room |
The MCP wraps the same API this skill targets, so the schema rules, rate limits, and nesting constraints below apply equally to MCP-driven calls. The MCP is currently pinned to API revision 2026-04-15 — keep that in mind if you're versioning your own SDK code against an older revision.
For the full MCP tool inventory, OAuth setup, and read-only mode flag, see REFERENCE.md. For audit/analyst work, see the klaviyo-analyst skill — it's built around the MCP.
| Language | Package | Install |
|---|---|---|
| Python | klaviyo-api |
pip install klaviyo-api |
| Node.js | klaviyo-api |
npm install klaviyo-api |
| Ruby | klaviyo-api-sdk |
gem install klaviyo-api-sdk |
| PHP | klaviyo/api |
composer require klaviyo/api |
| Endpoint Category | Limit | Window |
|---|---|---|
| Most endpoints | 75 requests | per second |
| Bulk imports | 10 requests | per second |
| Profile/Event create | 350 requests | per second |
| Campaign send | 10 requests | per second |
Headers returned: RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset
| Revision | Key Changes |
|---|---|
| 2026-01-15 | Latest. Custom Objects Ingestion, Geofencing API (beta). |
| 2025-10-15 | Forms API, Flow Actions API, SMS ROI reporting. |
| 2025-07-15 | Mapped Metrics API, Custom Objects API (GA). |
| 2025-04-15 | Web Feeds API, Custom Metrics, Push Token registration. |
| 2025-01-15 | Reviews APIs, Flows Create API, Campaign image management. |
| 2024-10-15 | Universal Content API, Form/Segment Reporting, Reviews API. |
| 2024-07-15 | Forms API (retrieval), Webhooks API. |
| 2024-02-15 | Reporting API, Create or Update Profile (upsert). |
Always include the revision header in API requests.
revision: YYYY-MM-DD header. Pin to a specific version.unique_id property to prevent duplicate event tracking.POST /profiles/ with existing identifier for upsert behavior (creates or updates).When building a custom Klaviyo integration:
When auditing an existing Klaviyo integration for health and data quality:
$value, ItemNames, line items)ProductName, ItemPrice, OrderIdbusiness_type, account_id, reorder_count| Event | Required Properties | Revenue Property |
|---|---|---|
| Placed Order | $value, OrderId, Items[] (line items) |
$value |
| Started Checkout | $value, CheckoutURL, Items[] |
$value |
| Viewed Product | ProductName, ProductID, URL, ImageURL |
— |
| Added to Cart | $value, AddedItemProductName, AddedItemProductID, Items[] |
$value |
| Fulfilled Order | $value, OrderId |
— |
Klaviyo handles nested objects differently depending on where you access them:
| Context | Access Level | Example |
|---|---|---|
| Email/SMS templates | Full access via Jinja — can loop over arrays, access nested properties | {% for item in event.Items %}{{ item.ProductName }}{% endfor %} |
| Flow conditional splits | Top-level properties ONLY — cannot access nested object fields | Can split on event.OrderId, cannot split on event.Items[0].ProductName |
| Segments | Top-level properties ONLY — cannot filter by nested object fields | Can segment on "has done Placed Order where $value > 100", cannot segment on "where Items contains ProductName = X" |
| Flow triggers | Top-level properties for trigger filters | Same as conditional splits |
Workaround for nested data: If you need to segment or split on nested data, flatten it to top-level properties:
# Instead of relying on Items[] array for segmentation:
properties = {
"$value": 149.99,
"OrderId": "ORD-123",
"Items": [{"ProductName": "Wireless Headphones", "Category": "Electronics"}],
# Flatten for segmentation:
"ItemCategories": "Electronics,Accessories", # Comma-joined for "contains" filter
"HasElectronics": True, # Boolean flag for split
"TopItemCategory": "Electronics" # Top category for split
}
Additional events beyond the standard Shopify/e-commerce schema:
| Event Name | Trigger | Key Properties |
|---|---|---|
Account Created |
New account registered | account_type, referral_source, signup_channel |
Subscription Started |
Recurring order activated | $value, frequency, product_ids, plan_name |
Subscription Cancelled |
Recurring order stopped | reason, plan_name, lifetime_charges |
Reorder Placed |
Repeat purchase of consumable | $value, OrderId, days_since_last_order, reorder_items |
Wishlist Added |
Item saved for later | ProductName, ProductID, Categories, Price |
Catalog Browsed |
Category/search activity | category, search_term, results_count |
Sync key customer properties to profiles for segmentation:
profile_properties = {
"customer_type": "Subscriber",
"interests": ["Skincare", "Wellness"],
"subscription_plan": "Monthly Box",
"account_tier": "VIP",
"first_order_date": "2024-03-15",
"lifetime_order_count": 8,
"avg_order_value": 72.50,
"preferred_categories": ["Skincare", "Supplements"]
}
When data exists in Klaviyo but isn't usable where expected:
| Symptom | Root Cause | Solution |
|---|---|---|
| Can't segment on event property | Property is nested inside an array/object | Flatten to top-level property on the event |
| Can't split flow on event property | Property is nested | Flatten, or use profile property instead |
| Segment doesn't match profiles | Property is on events, not profiles | Sync property to profile via API or "Update Profile Property" flow action |
| Profile property exists but segment empty | Property value format mismatch (string "true" vs boolean true) |
Standardize data types in API sync |
| Event tracked but no flow triggers | Metric name mismatch (case-sensitive) | Verify exact metric name in Klaviyo matches API call |
| Flow triggers but filter excludes everyone | Segment used as flow filter evaluates incorrectly | Check segment conditions — may reference stale or incorrectly-typed properties |
/metrics/ to verify the event name appears/events/?filter=... to pull recent events and inspect property structure/profiles/{id}/ to verify expected properties are on the profile来源于7w4.net。
Ask me questions like: - "How do I track a custom event from my Node.js backend?" - "Help me set up a bulk profile import script" - "What are Klaviyo's rate limits and how should I handle them?" - "How do I verify Klaviyo webhook signatures?" - "Set up catalog sync for my custom e-commerce platform" - "How do I implement OAuth for a Klaviyo app?" - "Design a data pipeline to export Klaviyo data to BigQuery" - "Help me migrate from Klaviyo v1/v2 API to the current API" - "Audit my integration — are events structured correctly?" - "Why can't I segment on a property I'm tracking in events?"
For complete integration patterns, worked examples with sample output, and code snippets, see EXAMPLES.md.
The skill includes utility scripts for API interaction and integration management:
# Track a custom event
python scripts/klaviyo_client.py --action track-event \
--email user@example.com --event "Placed Order" \
--properties '{"value": 99.99, "OrderId": "ORD-123"}'
# Upsert a profile
python scripts/klaviyo_client.py --action upsert-profile \
--email user@example.com \
--properties '{"first_name": "Jane", "loyalty_tier": "Gold"}'
# List catalog items
python scripts/klaviyo_client.py --action catalog-items --format table
# Export profiles to CSV
python scripts/klaviyo_client.py --action export-profiles \
--max-pages 10 --format csv --output profiles.csv
# Integration health check
python scripts/dev_tools.py --tool health-check
# Validate event tracking
python scripts/dev_tools.py --tool validate-events \
--events "Placed Order,Started Checkout,Viewed Product"
# Test webhook endpoint
python scripts/dev_tools.py --tool test-webhook \
--webhook-url https://example.com/webhooks/klaviyo
# Import profiles from CSV
python scripts/dev_tools.py --tool import-csv \
--file contacts.csv --list-id LIST_ID
# Export data with pagination
python scripts/dev_tools.py --tool export-data \
--resource profiles --max-records 5000 --output profiles.csv
The scripts handle API authentication, rate limiting, and JSON:API formatting. I'll help interpret results and provide implementation guidance.
Authentication Error: Verify that:
- KLAVIYO_API_KEY is set as an environment variable or in a .env file
- The key starts with pk_ (private API key, not public)
- The key has the required scopes for your operation (e.g., events:write for tracking, profiles:write for imports)
Rate Limit Errors (429): The SDK handles retries automatically (up to 3 retries with 60s max delay). If you still hit limits:
- Queue and throttle bulk operations (max 10 req/s for imports)
- Check RateLimit-Remaining header proactively
- Implement exponential backoff with jitter for raw HTTP
Bulk Import Errors: Check that: - Batch size does not exceed 10,000 profiles per job - Email or phone is provided for each profile (at least one identifier) - CSV column names match expected field names
Import Errors: Install required packages:
pip install klaviyo-api python-dotenv pandas
.env files.env to .gitignoreThis skill interacts with the Klaviyo API for integration development. When using write operations: - Validate data before sending to avoid corrupting profile records - Never log or store API keys, webhook secrets, or PII in plain text - Use idempotency keys to prevent duplicate events - Implement webhook signature verification to prevent spoofing - Follow GDPR/CCPA requirements when handling profile data - Use the Data Privacy Deletion endpoint for right-to-erasure requests
All operations are performed via the official Klaviyo API with proper authentication.
For detailed API endpoint reference, code patterns, authentication, and architecture diagrams, see REFERENCE.md.
For marketing strategy, flow optimization, and campaign auditing, use the klaviyo-analyst skill.
获取使用帮助和更多实用 Skill,请关注公众号「简诗 AI」,或在 SkillHub 搜索「简诗 AI」这是一个面向开发者的 Klaviyo 集成技能包,文档覆盖全面,提供了实用的代码示例和工作流程指导。中文适配做得较好,界面显示名和描述清晰易懂。不足之处在于文档存在部分内容截断,影响了使用体验。整体质量中上,对于需要构建 Klaviyo 定制集成的开发者有一定帮助,但入手前需注意文档的完整性问题。