Skip to content
Skillv1.0.0

klaviyo-core-workflow-a

Execute Klaviyo primary workflow: profiles, lists, and subscriptions. Use when creating/updating profiles, managing lists, subscribing contacts, or syncing customer data to Klaviyo for email/SMS marke

by jeremylongshore(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from jeremylongshore/tons-of-skills-marketplace (skills/.curated/klaviyo-core-workflow-a/SKILL.md). Install upstream with npx skills add jeremylongshore/tons-of-skills-marketplace --skill klaviyo-core-workflow-a. Copyright stays with the author (MIT).

Klaviyo Core Workflow A -- Profiles, Lists & Subscriptions

Overview

Primary money-path workflow: create/update profiles, manage lists, and subscribe contacts for email and SMS marketing via the klaviyo-api SDK. This skill covers the six-step path from a raw customer record to a consented, segmentable subscriber. High-level flow lives here; the full code for every step is in references/implementation.md.

Prerequisites

  • Completed the klaviyo-install-auth setup so KLAVIYO_PRIVATE_KEY is available in the environment.
  • A Klaviyo private API key scoped to profiles:read, profiles:write, lists:read, and lists:write.
  • The klaviyo-api npm package installed in the project (npm install klaviyo-api).
  • Node.js with TypeScript configured, since all examples use the typed SDK.

Instructions

Every call authenticates through a single ApiKeySession built from the private key:

import { ApiKeySession, ProfilesApi, ListsApi } from 'klaviyo-api';

const session = new ApiKeySession(process.env.KLAVIYO_PRIVATE_KEY!);
const profilesApi = new ProfilesApi(session);
const listsApi = new ListsApi(session);

The workflow runs in six steps. Use the linked walkthrough for the complete code of each:

  1. Create or update a profile — prefer createOrUpdateProfile (upsert) over createProfile so re-syncs don't 409 on an existing email.
  2. Create a listlistsApi.createList(...) returns the listId you use downstream; getLists() enumerates existing lists.
  3. Add profiles to a listcreateListRelationships adds membership only; it does NOT grant marketing consent.
  4. Subscribe profilessubscribeProfiles records email/SMS marketing consent with a consentTimestamp. This is the correct way to create real subscribers.
  5. Query profiles with filtersgetProfiles({ filter, sort }) supports equals, greater-than, and contains for segmentation.
  6. Bulk import — batch upserts in groups of 100 to stay within rate limits.

Full code for all six steps: references/implementation.md.

Output

  • Profiles created/updated in Klaviyo
  • Lists created and populated
  • Subscribers opted in with consent timestamps
  • Queryable customer data for segmentation

Error Handling

Error Status Cause Solution
Duplicate profile 409 Email exists Use createOrUpdateProfile (upsert)
Invalid phone 400 Wrong format Use E.164 format: +15551234567
List not found 404 Wrong list ID Verify list ID via getLists()
Missing consent 400 No consent timestamp Always include consentTimestamp
Rate limited 429 >75 req/s burst See klaviyo-rate-limits

Examples

Three end-to-end scenarios that string the six steps into complete flows are in references/examples.md:

  • Sync a new signup into a newsletter list with consent — upsert the profile, ensure the list exists, then subscribe with email + SMS consent in one pass.
  • Segment pro-plan customers — filter by a custom property and export the audience emails for a targeted campaign.
  • Bulk-import a customer CSV — map records to upsert payloads and process in batches of 100.

Minimal upsert-then-subscribe skeleton:

const upserted = await profilesApi.createOrUpdateProfile({
  data: { type: ProfileEnum.Profile, attributes: { email: 'customer@example.com' } },
});
await profilesApi.subscribeProfiles({
  data: {
    type: 'profile-subscription-bulk-create-job',
    attributes: { profiles: { data: [{ type: ProfileEnum.Profile, attributes: {
      email: 'customer@example.com',
      subscriptions: { email: { marketing: { consent: 'SUBSCRIBED', consentTimestamp: new Date().toISOString() } } },
    } }] } },
    relationships: { list: { data: { type: ListEnum.List, id: listId } } },
  },
});

Resources

Next Steps

For event tracking and campaign triggers, see klaviyo-core-workflow-b. To harden against burst limits during bulk imports, see klaviyo-rate-limits.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/jeremylongshore-tons-of-skills-marketplace-klaviyo-core-4e111a/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

jeremylongshore-tons-of-skills-marketplace-klaviyo-core-4e111a.ocm.jsonjson
{
  "ocm": "1",
  "id": "jeremylongshore-tons-of-skills-marketplace-klaviyo-core-4e111a",
  "kind": "skill",
  "name": "klaviyo-core-workflow-a",
  "description": "Execute Klaviyo primary workflow: profiles, lists, and subscriptions. Use when creating/updating profiles, managing lists, subscribing contacts, or syncing customer data to Klaviyo for email/SMS marketing. Trigger with phrases like \"klaviyo profiles\", \"klaviyo lists\", \"klaviyo subscribe\", \"add contacts to klaviyo\", \"klaviyo customer data\".",
  "publisher": "jeremylongshore",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "customer_support"
    ],
    "tags": [
      "skill-md",
      "saas",
      "klaviyo",
      "email-marketing",
      "cdp",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Execute Klaviyo primary workflow: profiles, lists, and subscriptions. Use when creating/updating profiles, managing lists, subscribing contacts, or syncing customer data to Klaviyo for email/SMS marketing. Trigger with phrases like \"klaviyo profiles\", \"klaviyo lists\", \"klaviyo subscribe\", \"add contacts to klaviyo\", \"klaviyo customer data\"."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/jeremylongshore/tons-of-skills-marketplace",
      "path": "skills/.curated/klaviyo-core-workflow-a/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/jeremylongshore/tons-of-skills-marketplace/blob/HEAD/skills/.curated/klaviyo-core-workflow-a/SKILL.md",
      "key": "jeremylongshore/tons-of-skills-marketplace/skills/.curated/klaviyo-core-workflow-a/SKILL.md"
    },
    "compatibility": "Designed for Claude Code",
    "allowed_tools": [
      "Read,",
      "Write,",
      "Edit,",
      "Bash(npm:*),",
      "Grep"
    ],
    "license": "MIT"
  },
  "instructions": "# Klaviyo Core Workflow A -- Profiles, Lists & Subscriptions\n\n## Overview\n\nPrimary money-path workflow: create/update profiles, manage lists, and subscribe contacts for email and SMS marketing via the `klaviyo-api` SDK. This skill covers the six-step path from a raw customer record to a consented, segmentable subscriber. High-level flow lives here; the full code for every step is in [references/implementation.md](references/implementation.md).\n\n## Prerequisites\n\n- Completed the `klaviyo-install-auth` setup so `KLAVIYO_PRIVATE_KEY` is available in the environment.\n- A Klaviyo private API key sc",
  "cost": {
    "context_tokens": 1167
  }
}

Fetch it by URL: GET /api/v1/registry/jeremylongshore-tons-of-skills-marketplace-klaviyo-core-4e111a/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.