Skip to content

Connect Klaviyo to ChatGPT: Sync Profiles, Segments & Campaigns

Learn how to connect Klaviyo to ChatGPT using a managed MCP server. Automate campaigns, sync profiles, and handle Klaviyo's JSON:API quirks without custom code.

Sidharth Verma Sidharth Verma · · 9 min read

If you need to connect Klaviyo to ChatGPT to automate marketing campaigns, enrich customer profiles, or dynamically query segmentation data, you need a Model Context Protocol (MCP) server. This server acts as the critical translation layer between ChatGPT's function calling capabilities and Klaviyo's REST APIs. You can either spend weeks building, hosting, and maintaining this infrastructure yourself, or use a managed integration platform like Truto to dynamically generate a secure, authenticated MCP server URL.

If your team uses Claude, check out our guide on connecting Klaviyo to Claude or explore our broader architectural overview on connecting Klaviyo to AI Agents.

Giving a Large Language Model (LLM) read and write access to a marketing automation platform like Klaviyo is a severe engineering challenge. You have to handle strict JSON:API compliance, orchestrate asynchronous bulk operations, and manage complex compound identity markers. Every time an API schema updates or you need to expose a new endpoint, your custom server code must be updated, redeployed, and tested.

This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Klaviyo, connect it natively to ChatGPT, and execute complex e-commerce and marketing workflows using natural language.

Stop writing boilerplate API integration code. Let Truto generate secure, managed MCP servers for your AI agents in seconds. :::

The Engineering Reality of the Klaviyo API

A custom MCP server is a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools, implementing it against Klaviyo's highly opinionated API is exceptionally painful.

If you decide to build a custom MCP server for Klaviyo, you own the entire API lifecycle. Here are the specific integration challenges that break standard CRUD assumptions when working with Klaviyo:

Strict JSON:API Compliance and Relationship Linkages

Klaviyo enforces a strict implementation of the JSON:API specification. You cannot simply send a flat JSON payload to update a profile or attach a tag. Payloads must strictly define a data object containing type, id, attributes, and relationships. When an LLM wants to associate a profile with a list, your custom server must instruct the model to construct a specific resource linkage object containing the exact type and id mapping. Standardizing LLM outputs to perfectly match nested JSON:API structures requires writing extensive validation and schema parsing layers.

Compound Identifiers for Catalog Items

When managing catalog categories and variants, Klaviyo utilizes compound identifiers. Instead of a standard UUID, an item ID might look like {integration}:::{catalog}:::{external_id}. If an LLM needs to query a specific variant, it must format this compound string perfectly. Your custom MCP server must supply exact schema descriptions and regex patterns to ensure the LLM does not hallucinate the delimiter or format.

Synchronous Limits vs. Asynchronous Bulk Jobs

Klaviyo severely limits payload sizes on synchronous endpoints (often 100KB per profile). To scale, Klaviyo pushes developers toward asynchronous bulk creation jobs (e.g., create_a_klaviyo_catalog_category_bulk_create_job). These jobs accept up to 5MB payloads but require an entirely different architectural pattern. You have to trigger the job, receive a 202 Accepted response, and then aggressively poll a status endpoint to determine success or failure. Orchestrating this polling loop inside an LLM tool call forces you to build long-running task managers inside your custom MCP server.

Rate Limits and the 429 Reality

Klaviyo enforces strict rate limits across all endpoints. If your AI agent gets stuck in a loop and attempts to query too many campaigns at once, Klaviyo will return an HTTP 429 Too Many Requests error. It is important to note: Truto does not retry, throttle, or apply backoff on rate limit errors. When an upstream API returns HTTP 429, Truto passes that error directly to the caller. Truto normalizes the upstream rate limit information into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF spec. The caller (your LLM application or orchestration framework) is strictly responsible for interpreting these headers and executing exponential backoff.

The Managed MCP Server Approach

Instead of forcing your engineering team to build JSON:API translators and pagination handlers, Truto allows you to generate a fully managed MCP server for Klaviyo in seconds.

Truto derives MCP tool definitions dynamically from the integration's underlying resources and documentation records. A tool only appears in the MCP server if it has a corresponding documentation entry. This documentation-driven approach acts as a quality gate, ensuring only well-described, schema-validated endpoints are exposed to the LLM.

Each server is scoped to a single authenticated Klaviyo account and exposed via a secure tokenized URL. You simply provide this URL to ChatGPT.

Step 1: Create the MCP Server

You can generate the MCP server URL via the Truto UI or programmatically via the API.

Option A: Via the Truto UI

  1. Navigate to the integrated account page for your connected Klaviyo instance.
  2. Click the MCP Servers tab.
  3. Click Create MCP Server.
  4. Select your desired configuration (e.g., method filters, tags, expiration time).
  5. Copy the generated MCP server URL (e.g., https://api.truto.one/mcp/a1b2c3d4e5f6...).

Option B: Via the API For programmatic deployment, authenticate your API call to Truto and POST the desired configuration.

curl -X POST https://api.truto.one/integrated-account/{integrated_account_id}/mcp \
  -H "Authorization: Bearer YOUR_TRUTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "ChatGPT Klaviyo Server",
    "config": {
      "methods": ["read", "write"]
    }
  }'

The response contains the secure URL you will provide to ChatGPT:

{
  "id": "abc-123",
  "name": "ChatGPT Klaviyo Server",
  "config": { "methods": ["read", "write"] },
  "expires_at": null,
  "url": "https://api.truto.one/mcp/a1b2c3d4e5f6..."
}

Step 2: Connect the Server to ChatGPT

Once you have the URL, you connect it to your LLM client.

Option A: Via the ChatGPT UI

  1. Open ChatGPT and navigate to Settings -> Apps -> Advanced settings.
  2. Enable the Developer mode toggle.
  3. Under MCP servers / Custom connectors, click Add new server.
  4. Provide a descriptive Name (e.g., "Klaviyo Marketing").
  5. Paste the Truto MCP URL into the Server URL field.
  6. Save the configuration. ChatGPT will immediately connect, perform the JSON-RPC handshake, and load the available Klaviyo tools.

Option B: Via Manual Config (for Claude Desktop or custom SSE clients) If you are using Claude Desktop or an orchestration framework that relies on an MCP config file, you map the URL via an SSE transport command. Edit your claude_desktop_config.json file:

{
  "mcpServers": {
    "klaviyo-truto": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "https://api.truto.one/mcp/a1b2c3d4e5f6..."
      ]
    }
  }
}

Hero Tools for Klaviyo

When the MCP server initializes, ChatGPT receives a comprehensive inventory of your connected Klaviyo capabilities. Truto automatically generates detailed query and body schemas. Here are the core "hero" tools critical for marketing automation.

list_all_klaviyo_campaigns

Lists all Klaviyo campaigns in the account. The tool automatically injects limit and next_cursor fields to manage pagination. The LLM must supply a filter parameter for the channel (e.g., equals(messages.channel,'email')).

Usage Notes: This is your primary discovery tool for reviewing past marketing efforts. The LLM will use this to grab the id of a specific campaign before triggering detailed message lookups.

"Fetch the latest 5 email campaigns we sent from Klaviyo. I need their names, send status, and scheduled send times. Please format the output as a markdown table."

list_all_klaviyo_segments

Lists all segments in the Klaviyo account. Returns a JSON:API resource object containing names, definition logic, and status timestamps.

Usage Notes: The LLM can use the additional-fields [segment] parameter to explicitly request profile_count. This is crucial when estimating audience sizes before cloning a campaign.

"List all active segments in our Klaviyo account. Include the profile count for each segment so I know the current audience size."

list_all_klaviyo_segment_profiles

Lists the actual Klaviyo profiles that belong to a specific segment. Returns deeply nested objects containing emails, phone numbers, location data, and custom properties.

Usage Notes: This tool is limited to 100 profiles per page. If an LLM needs to export a massive segment, it must iterate using the next_cursor string exactly as it receives it.

"Get the profiles belonging to the 'VIP Customers' segment (ID: X). I need their first names, emails, and any custom properties associated with their account."

create_a_klaviyo_profile_import

Creates or updates a profile using upsert behavior. You pass attributes and an optional ID. Setting a field to null explicitly clears it.

Usage Notes: The payload must strictly conform to the data.type and data.attributes structure. Maximum payload size is 100KB per request. This tool is perfect for single-user enrichment workflows executed by an agent.

"Update the profile for customer john.doe@example.com in Klaviyo. Append a custom property 'LifetimeValue' set to 1500, and ensure his location is set to New York."

create_a_klaviyo_campaign_send_job

Triggers a Klaviyo campaign to send asynchronously. You provide the campaign ID, and Klaviyo initiates the send process returning an HTTP 202 Accepted status.

Usage Notes: Because the send process is asynchronous, the LLM will receive a campaign send job object. If the LLM needs to verify the send is complete, it must use the corresponding get_single_klaviyo_campaign_send_job_by_id tool to poll the status.

"Trigger a send job for the 'Q4 Holiday Promo' campaign (ID: Y). Let me know the tracking ID of the job so we can monitor its dispatch status."

View the complete Klaviyo tool inventory on the Truto Integration page.

Workflows in Action

By chaining these tools together, ChatGPT can execute multi-step marketing operations. Here are two concrete workflows showing exactly how an LLM handles the logic.

Workflow 1: Campaign Performance Audit and Resend

A marketing manager wants to clone an underperforming campaign, adjust the target audience, and prepare it for a secondary send.

"Find the 'Summer Flash Sale' email campaign in Klaviyo. Check its status, clone it, and assign the newly cloned campaign to our 'Unengaged Subscribers' segment."

  1. list_all_klaviyo_campaigns: The agent queries campaigns filtering by name equals 'Summer Flash Sale' to extract the source id.
  2. list_all_klaviyo_segments: The agent searches for the segment named 'Unengaged Subscribers' to extract its id.
  3. create_a_klaviyo_campaign_clone: The agent calls the clone tool, passing the source campaign ID in the JSON:API relationship structure, creating a fresh campaign with a new ID.
  4. update_a_klaviyo_campaign_by_id: The agent patches the new campaign, updating the audiences attribute to point to the unengaged segment's ID.
sequenceDiagram
    participant User as User
    participant LLM as ChatGPT
    participant MCP as Truto MCP Server
    participant API as Klaviyo API
    
    User->>LLM: "Clone the 'Summer Flash Sale' campaign..."
    
    LLM->>MCP: Call list_all_klaviyo_campaigns (filter name)
    MCP->>API: GET /api/campaigns?filter=equals(name,'Summer Flash Sale')
    API-->>MCP: Campaign ID: 12345
    MCP-->>LLM: JSON resource object
    
    LLM->>MCP: Call list_all_klaviyo_segments (filter name)
    MCP->>API: GET /api/segments?filter=equals(name,'Unengaged Subscribers')
    API-->>MCP: Segment ID: 98765
    MCP-->>LLM: JSON resource object
    
    LLM->>MCP: Call create_a_klaviyo_campaign_clone(data.relationships)
    MCP->>API: POST /api/campaign-clone
    API-->>MCP: New Campaign ID: 55555
    MCP-->>LLM: Cloned campaign details
    
    LLM->>MCP: Call update_a_klaviyo_campaign_by_id(55555, audiences: 98765)
    MCP->>API: PATCH /api/campaigns/55555
    API-->>MCP: Updated Campaign
    MCP-->>LLM: Final success confirmation
    LLM-->>User: "The campaign has been cloned and targeted."

Workflow 2: VIP Segment Enrichment

A support administrator wants to review a specific segment of users and update their custom properties based on external chat interactions.

"Pull the first 10 profiles from the 'High Value Prospects' segment in Klaviyo. Check if any of them lack a 'Last Interaction Date' custom property. For those missing it, update their profile with today's date."

  1. list_all_klaviyo_segments: The agent finds the segment ID for 'High Value Prospects'.
  2. list_all_klaviyo_segment_profiles: The agent pulls the first page of 10 profiles associated with that segment ID.
  3. The agent processes the JSON output in its context window, inspecting the attributes.properties dictionary for each profile.
  4. update_a_klaviyo_profile_by_id: For any profile missing the target key, the agent iteratively calls the update tool, passing the specific profile ID and the merged custom properties dictionary.

Security and Access Control

When deploying AI agents against a production marketing database, security is the primary concern. Truto provides four distinct configuration layers to lock down the MCP server payload during creation:

  • Method Filtering (config.methods): Restrict the server to safe operations. Setting this to ["read"] completely blocks create, update, and delete operations at the server level, rendering the LLM read-only regardless of prompt injection.
  • Tag Filtering (config.tags): Scope the server to specific operational domains. By specifying tags, you can expose only profile-related endpoints and hide destructive catalog or campaign administration endpoints entirely.
  • Extra Authentication (require_api_token_auth): By default, the cryptographically hashed MCP URL acts as the authentication vector. Setting this flag to true requires the connecting client to additionally pass a valid Truto API token in the Authorization header.
  • Expiration (expires_at): Generate ephemeral access. Pass an ISO datetime string to schedule an automatic destruction alarm. Once the alarm fires, the edge storage and database records are instantly wiped, cleanly revoking the LLM's access.

Final Thoughts

Manually coding an MCP integration for Klaviyo forces you to absorb massive maintenance overhead. You are stuck writing JSON:API normalization logic, managing pagination state, and formatting complex compound identifiers before the LLM can safely execute a tool call.

By leveraging Truto's dynamically generated MCP servers, your engineering team bypasses the boilerplate. Truto uses the integration's existing documentation and resource definitions to construct the JSON-RPC interface automatically. You get a secure, authenticated URL, robust method filtering, and perfectly structured JSON Schemas. You spend less time writing API wrappers and more time building powerful AI marketing workflows.

FAQ

Does Truto automatically retry requests if Klaviyo hits a 429 rate limit?
No. Truto does not retry, throttle, or apply backoff on rate limit errors. If Klaviyo returns an HTTP 429, Truto passes that error directly to the caller, mapping the upstream rate limit information into standardized IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset). Your application or LLM orchestrator is responsible for handling exponential backoff.
How do I restrict the ChatGPT agent to only read data from Klaviyo?
When creating the MCP server via the Truto UI or API, pass a method filter of `["read"]` in the configuration payload. This ensures only `get` and `list` operations are exposed as tools to the LLM, preventing accidental updates or deletions.
Can I automatically expire an MCP server used by ChatGPT?
Yes. When generating the MCP server, you can supply an `expires_at` ISO datetime string. Truto sets an automated edge storage expiration and database cleanup alarm. Once the time is reached, the server URL is permanently revoked.
Why does Klaviyo require 'type' and 'id' fields inside a 'data' object?
Klaviyo strictly adheres to the JSON:API specification. Resource representations and relationship linkages require deeply structured JSON rather than flat key-value pairs. Truto's auto-generated MCP schemas explicitly map these requirements so the LLM knows exactly how to construct the payload.

More from our Blog