Skip to content

Connect Customer.io to ChatGPT: Automate Campaigns & Profile Data

Learn how to connect Customer.io to ChatGPT using a managed MCP server. This guide covers API realities, setup via UI and code, and real-world marketing workflows.

Sidharth Verma Sidharth Verma · · 10 min read
Connect Customer.io to ChatGPT: Automate Campaigns & Profile Data

If you want to connect Customer.io to ChatGPT to automate complex marketing workflows, audit campaign drop-offs, or debug user profile data, you need a Model Context Protocol (MCP) server. An MCP server bridges the gap between LLM tool-calling logic and the rigid structures of marketing automation APIs.

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

Giving an AI agent read and write access to a platform that sends live emails to millions of customers is inherently risky. You either spend cycles building, hosting, and maintaining a custom MCP server to translate ChatGPT's JSON arguments into Customer.io's specific payload structures, or you use a managed infrastructure layer.

This guide breaks down exactly how to use Truto to generate a secure, authenticated MCP server for Customer.io, connect it natively to ChatGPT, and execute complex lifecycle marketing workflows using natural language.

The Engineering Reality of the Customer.io API

Customer.io is an incredibly powerful platform, but building a custom MCP server against its API reveals several immediate architectural hurdles. If you decide to build a custom tool server, you own the entire integration lifecycle. Here is exactly what makes Customer.io challenging for LLMs:

The Dual API Architecture

Customer.io does not have a single, unified REST API. It has two distinct APIs with different authentication mechanisms and base URLs:

  1. The Track API (track.customer.io): Used for identifying people, updating profile attributes, tracking events, and adding devices. This requires a Site ID and a Track API Key.
  2. The App API (api.customer.io): Used for managing campaigns, segments, broadcasts, and retrieving metrics. This requires an App API Key.

An LLM does not know which base URL to use for which operation. If you build a custom MCP server, you must maintain a routing layer that intercepts the LLM's intent, maps it to the correct underlying API, and injects the corresponding authentication headers.

Unstructured Attribute Payloads

When updating a customer profile via the Track API (identify), the attributes payload is entirely unstructured. Customers can send any key-value pair. LLMs often struggle with schemaless dictionaries, hallucinating nested objects or converting strings to booleans incorrectly. Your MCP server needs dynamic schema definitions derived from the workspace's actual data model, otherwise ChatGPT will push corrupted data into your CRM.

Strict Rate Limits and Backoff Expectations

Customer.io enforces aggressive rate limits to protect its ingestion pipeline. The Track API typically allows up to 100 requests per second, while the App API has varying limits depending on the endpoint (e.g., 10 requests per second for exports).

When building an MCP server with Truto, it is critical to understand that Truto does not retry, throttle, or apply backoff on rate limit errors. When Customer.io returns an HTTP 429, Truto passes that error directly back to the caller (ChatGPT). What Truto does do is normalize the upstream rate limit information into standardized HTTP headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF specification. Your AI agent framework is entirely responsible for reading these headers and executing the retry and backoff logic.

Step 1: Generate a Customer.io MCP Server

To bypass these integration headaches, we will use Truto to dynamically generate a Customer.io MCP server. Truto derives tool definitions directly from the API's documentation and resource schemas, ensuring the LLM always has the correct parameters for both the Track and App APIs.

Each MCP server in Truto is scoped to a single integrated account. The server URL contains a cryptographic token that securely authenticates requests without requiring the client to manage API keys.

You can generate this server either via the Truto UI or programmatically via the API.

Method 1: Via the Truto UI

For ad-hoc tasks and testing, generating the server through the dashboard is the fastest route:

  1. Log in to your Truto dashboard.
  2. Navigate to the Integrated Accounts page and select your connected Customer.io account.
  3. Click on the MCP Servers tab.
  4. Click Create MCP Server.
  5. Select your desired configuration (e.g., restrict to read methods only, or filter by specific tags like campaigns and customers).
  6. Click Generate and copy the MCP server URL (e.g., https://api.truto.one/mcp/a1b2c3d4...). Treat this URL as a secret.

Method 2: Via the Truto API

If you are building an AI product and need to provision MCP servers dynamically for your end-users, use the REST API. This POST request validates the configuration, generates a secure token stored in edge KV infrastructure, and returns the endpoint.

curl -X POST https://api.truto.one/integrated-account/<CUSTOMER_IO_ACCOUNT_ID>/mcp \
  -H "Authorization: Bearer $TRUTO_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "ChatGPT Marketing Assistant",
    "config": {
      "methods": ["read", "write"],
      "tags": ["campaigns", "customers", "events"]
    }
  }'

The response contains the exact URL you need to provide to ChatGPT:

{
  "id": "mcp_srv_9x8y7z6",
  "name": "ChatGPT Marketing Assistant",
  "config": {
    "methods": ["read", "write"],
    "tags": ["campaigns", "customers", "events"]
  },
  "expires_at": null,
  "url": "https://api.truto.one/mcp/a1b2c3d4e5f6g7h8i9j0"
}

Step 2: Connect the MCP Server to ChatGPT

Now that you have your secure MCP endpoint, you need to expose it to ChatGPT. The Model Context Protocol uses JSON-RPC 2.0 over HTTP POST. You can configure this directly in the ChatGPT UI (if available on your plan) or via a manual configuration file for custom AI applications.

Method A: Via the ChatGPT UI (For Enterprise/Pro Users)

If you are using ChatGPT Pro, Plus, Business, Enterprise, or Education, you can add remote MCP servers directly in the interface.

  1. Open ChatGPT and navigate to Settings > Apps > Advanced settings.
  2. Enable the Developer mode toggle.
  3. Under the MCP servers / Custom connectors section, click Add a new server.
  4. Enter a descriptive name (e.g., "Customer.io Marketing Tools").
  5. Paste the Truto MCP url you generated in Step 1 into the Server URL field.
  6. Click Save.

ChatGPT will immediately ping the endpoint, perform the protocol handshake, and load the available Customer.io tools into its context window.

Method B: Via Manual Config File (SSE Transport)

If you are running a custom agent framework, an open-source ChatGPT clone, or a desktop client that supports standard MCP configuration files, you can route traffic to Truto using the SSE (Server-Sent Events) proxy.

Create or update your mcp_config.json file:

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

This instructs the client to proxy standard MCP JSON-RPC commands over SSE to the Truto edge router, completely abstracting the HTTP translation layer from your local environment.

Hero Tools for Customer.io Workflows

Truto dynamically generates tools for every documented Customer.io endpoint, but providing an LLM with 80+ tools can overwhelm its context window and degrade reasoning performance. Here are the highest-leverage "hero" tools to expose to ChatGPT for marketing workflows.

list_all_customer_io_campaigns

Retrieves a list of all automations (campaigns) and their associated metadata. This is the entry point for ChatGPT to understand the workspace's active marketing efforts.

Usage note: Customer.io refers to automations internally as "campaigns". This tool returns the id values required for all downstream metrics queries.

"List all active onboarding campaigns in our workspace and tell me their current status."

customer_io_customers_list_by_email

Returns a list of people in the workspace matching a specific email address.

Usage note: Customer.io allows multiple profiles to share an email if the workspace uses an ID-based identity model. Always instruct the LLM to verify the id field before executing destructive updates.

"Look up the customer profile for alex@example.com and summarize their current subscription attributes."

customer_io_campaign_actions_get_metrics

Fetches deep performance metrics (sends, opens, clicks, bounces) for an individual action (like an email or push notification) within a campaign.

Usage note: Requires both the campaign_id and the action_id. You must query the campaign actions list first to find the specific action ID.

"Get the open and click metrics for the 'Welcome Email Day 1' action inside the User Onboarding campaign."

customer_io_track_events_track

Sends a custom event associated with a specific person. This is how LLMs can programmatically trigger Customer.io campaigns based on conversational logic.

Usage note: Requires the identifier (usually the customer ID or email) and the event name. Payload attributes are passed as a JSON object.

"Track an event called 'requested_demo' for user ID 84920 with the attribute 'product_interest' set to 'enterprise'."

customer_io_messages_get_archived

Returns the actual archived copy of a delivery, including the rendered message body, recipient data, and metrics.

Usage note: This endpoint is strictly rate-limited by Customer.io to 100 requests per day. Use it sparingly for auditing specific failed deliveries.

"Fetch the archived copy of message ID 901823 so I can see exactly what email content was sent to the user."

customer_io_track_customers_identify

Creates a new person or updates the attributes of an existing person.

Usage note: This is a highly destructive tool if used improperly. Ensure your agent is specifically instructed on the required identifier format for your workspace (Email vs ID).

"Update the customer profile for ID 84920 to set 'lifecycle_stage' to 'evangelist' and 'nps_score' to 9."

For the complete tool inventory, including endpoints for App Store Connect integrations, ESP suppressions, and broadcast triggers, see the Customer.io integration page.

Workflows in Action

Once connected, ChatGPT can chain these tools together to execute complex, multi-step marketing operations that normally require logging into multiple dashboards.

Scenario 1: The Lifecycle Marketer Auditing Campaign Drop-off

Marketers frequently need to understand why an automated sequence is underperforming. Instead of manually exporting CSVs from the Customer.io UI, ChatGPT can audit the workflow autonomously.

"Why did our 'Pro Trial Onboarding' campaign performance drop this week? Check the metrics for the campaign actions, find the email with the lowest open rate, and retrieve its archived copy so I can review the subject line."

Execution Steps:

  1. list_all_customer_io_campaigns: ChatGPT searches for the ID of the 'Pro Trial Onboarding' campaign.
  2. list_all_customer_io_campaign_actions: Retrieves the list of emails and delays within that campaign.
  3. customer_io_campaign_actions_get_metrics: Iterates through the action IDs to pull performance stats, identifying the bottleneck.
  4. list_all_customer_io_campaign_messages: Finds a recent delivery ID for the underperforming action.
  5. customer_io_messages_get_archived: Pulls the HTML and subject line of the email for analysis.
flowchart TD
    A["ChatGPT Request"] --> B["list_all_customer_io_campaigns"]
    B --> C["list_all_customer_io_campaign_actions"]
    C --> D["customer_io_campaign_actions_get_metrics"]
    D --> E["Identify Underperforming Email"]
    E --> F["list_all_customer_io_campaign_messages"]
    F --> G["customer_io_messages_get_archived"]
    G --> H["Return Analysis to User"]

The user receives a detailed breakdown: "Action 3 ('Feature highlight') has a 12% open rate, down from 28%. I reviewed the archived copy, and the subject line 'Your trial features' might be triggering spam filters. I recommend testing a new variant."

Scenario 2: Support Engineer Troubleshooting a Bounced User

Support engineers often field complaints from users who are not receiving password resets or transactional emails. ChatGPT can diagnose the suppression list and trigger a remediation event instantly.

"Check if support@acmecorp.com is on our suppression list. If they bounced, un-suppress them, update their profile to clear the 'bounce_status' attribute, and trigger a 'password_reset_requested' event to send them a new link."

Execution Steps:

  1. customer_io_esp_suppressions_get_by_email: ChatGPT checks if the address was suppressed by the underlying ESP (e.g., SendGrid/Mailgun).
  2. customer_io_esp_suppressions_unsuppress: If suppressed, it removes the block.
  3. customer_io_customers_list_by_email: Finds the internal Customer.io profile ID for the user.
  4. customer_io_track_customers_identify: Updates the profile to set bounce_status: null.
  5. customer_io_track_events_track: Fires the password_reset_requested event to trigger the transactional campaign.
sequenceDiagram
    participant Support as "Support Engineer"
    participant ChatGPT as "ChatGPT"
    participant Truto as "Truto MCP Server"
    participant CustIO as "Customer.io API"

    Support->>ChatGPT: "Fix bounce for support@acmecorp.com..."
    ChatGPT->>Truto: Call esp_suppressions_get_by_email
    Truto->>CustIO: GET /v1/esp_suppressions...
    CustIO-->>Truto: { suppressed: true, reason: "bounce" }
    Truto-->>ChatGPT: Return result
    
    ChatGPT->>Truto: Call esp_suppressions_unsuppress
    Truto->>CustIO: DELETE /v1/esp_suppressions...
    
    ChatGPT->>Truto: Call track_customers_identify
    Truto->>CustIO: PUT /api/v1/customers/:id
    
    ChatGPT->>Truto: Call track_events_track
    Truto->>CustIO: POST /api/v1/customers/:id/events
    CustIO-->>Truto: Success 200 OK
    Truto-->>ChatGPT: Return execution confirmation
    ChatGPT-->>Support: "User un-suppressed, profile updated, and reset email triggered."

Security and Access Control

Customer.io contains highly sensitive PII and controls the communication pipelines for your business. Granting an LLM unrestricted access is a critical security vulnerability. Truto provides several mechanisms to lock down the MCP server configuration:

  • Method Filtering: By defining "methods": ["read"] during server creation, you strip out all POST, PUT, and DELETE operations. ChatGPT can query campaign stats and view profiles, but cannot trigger emails or overwrite user data.
  • Tag Filtering: You can isolate the LLM's blast radius by applying tags. For example, "tags": ["customers", "events"] ensures the agent can manage profiles but cannot interact with or discover campaigns or broadcasts.
  • Time-to-Live (expires_at): For temporary workflows or contractor access, you can generate an MCP URL with a strict expiration timestamp. Once the clock runs out, the edge infrastructure automatically purges the token and revokes access instantly.
  • Double Authentication (require_api_token_auth): If enabled, possessing the generated MCP URL is not enough. The client must also inject a valid Truto API bearer token in the headers. This ensures that even if the MCP URL is leaked in a log file, unauthorized users cannot execute tool calls against Customer.io.

Wrapping Up

Connecting Customer.io to ChatGPT fundamentally changes how teams interact with marketing data. Instead of writing custom Python scripts to parse CSV exports or navigating complex UI dashboards to find specific action metrics, engineers and marketers can rely on LLMs to orchestrate the API directly.

By leveraging an auto-generated MCP server, you eliminate the need to write routing logic for dual APIs, maintain dynamic JSON schemas for profile updates, or handle manual HTTP transport layers. You generate the URL, configure your constraints, and let the model do the heavy lifting.

FAQ

How does Truto handle Customer.io API rate limits for AI agents?
Truto does not retry, throttle, or absorb rate limit errors. When Customer.io returns an HTTP 429, Truto passes the error back to the LLM or caller, normalizing the rate limit information into standard headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF spec. Your agent is responsible for executing backoff logic.
Does Truto cache Customer.io profile or campaign data?
No. Truto operates as a pass-through proxy for MCP tool calls. When ChatGPT invokes a Customer.io tool, the request is routed securely to the upstream API and the result is returned directly to the model. Data is not cached at rest.
Can I restrict ChatGPT to only read Customer.io data?
Yes. When generating the MCP server token via Truto, you can configure method filters (like `"methods": ["read"]`) to ensure the LLM can only query data and cannot create, update, or delete profiles and campaigns.

More from our Blog