Skip to content

Connect Lettr to ChatGPT: Manage campaigns and audience marketing

Learn how to build and configure a managed MCP server to connect Lettr to ChatGPT. Automate audience marketing, email campaigns, and bulk contact management.

Nidhi KN Nidhi KN · · 9 min read
Connect Lettr to ChatGPT: Manage campaigns and audience marketing

If you need to connect Lettr to ChatGPT to automate audience marketing, orchestrate email campaigns, or manage bulk contact lists, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between ChatGPT's function calls and Lettr's REST API. You can either build and host this integration infrastructure yourself, or use a managed platform like Truto to dynamically generate a secure, authenticated MCP server URL.

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

Giving a Large Language Model (LLM) read and write access to an email marketing platform is an engineering risk. You have to handle bulk data limits, manage specific transactional transmission headers, and map complex payload structures. Every time Lettr adds a new endpoint or updates a schema, your custom server code must be updated, tested, and redeployed.

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

The Engineering Reality of the Lettr API

Building a custom MCP server means owning the entire integration lifecycle. While the open MCP standard provides a predictable JSON-RPC 2.0 format for models to discover tools, implementing it against Lettr's specific architecture requires understanding its unique constraints.

If you decide to build a custom Lettr MCP server, here are the specific integration challenges you must architect around:

Strict Sandbox Write Limitations

Lettr explicitly blocks almost all write operations when using sandbox API keys. Endpoints like POST /api/audience/contacts or POST /api/campaigns will fail if your LLM attempts to use them outside of a production environment. If you build a custom server, you must inject dynamic environment awareness into your MCP tool schemas, or your AI agent will enter a hallucination loop trying to fix HTTP 403 Forbidden errors that are actually environment restrictions.

Complex Bulk Matrix Constraints

Lettr handles bulk operations via highly specific matrix payloads. For example, the POST /api/audience/contacts/lists/bulk endpoint attaches contacts to lists by computing every combination of contact_ids × list_ids. Lettr strictly caps this at 1,000 contacts and 50 lists per request. If an LLM attempts to pass an array of 1,500 contacts, the API will reject it. Your integration layer must intercept these payloads, chunk the arrays perfectly, and paginate the bulk requests before forwarding them to Lettr.

Underlying SparkPost Idempotency Rules

Because Lettr utilizes SparkPost for its core email transmission infrastructure, sending transactional emails requires specific idempotency handling. When an LLM triggers POST /api/emails, the server must supply an Idempotency-Key header. These keys are namespaced per Lettr API key and retained by SparkPost for exactly 24 hours. If your MCP server fails to handle retries correctly and drops the idempotency key, a simple network timeout could result in your LLM blasting a user with duplicate transactional emails.

Step 1: Generate a Lettr MCP Server

Truto handles the Lettr API complexity by dynamically generating tools based on Lettr's endpoint schemas and documentation. You can spin up an MCP server scoped specifically to a single Lettr account in seconds.

First, connect Lettr as an Integrated Account in your Truto dashboard. Once connected, you can generate the MCP server URL in two ways:

Option A: Via the Truto UI

  1. Navigate to the Integrated Accounts page in the Truto dashboard.
  2. Click on your connected Lettr account.
  3. Click the MCP Servers tab.
  4. Click Create MCP Server.
  5. Select your desired configuration (e.g., restrict to specific methods like read or filter by tags like campaigns).
  6. Copy the generated MCP server URL. Treat this URL like a secret password - it contains the cryptographic token required for access.

Option B: Via the API

You can programmatically generate an MCP server for Lettr by passing the integrated_account_id to the Truto API. This is ideal for SaaS platforms provisioning agents for their end users.

curl -X POST https://api.truto.one/integrated-account/$INTEGRATED_ACCOUNT_ID/mcp \
  -H "Authorization: Bearer $TRUTO_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Lettr Marketing Agent",
    "config": {
      "methods": ["read", "write"],
      "tags": ["campaigns", "audience", "emails"]
    },
    "expires_at": "2026-12-31T23:59:59Z"
  }'

The API returns a JSON payload containing the url field (e.g., https://api.truto.one/mcp/<token>).

Step 2: Connect the MCP Server to ChatGPT

Once you have your Truto MCP URL, you can plug it directly into your LLM environment.

Option A: Via the ChatGPT UI

If you are using ChatGPT (Pro, Plus, Business, Enterprise, or Education accounts), you can add the server directly via the interface:

  1. Open ChatGPT and go to Settings -> Apps -> Advanced settings.
  2. Enable the Developer mode toggle.
  3. Under MCP servers / Custom connectors, click to add a new server.
  4. Name: Enter a recognizable name (e.g., "Lettr Marketing Engine").
  5. Server URL: Paste the Truto MCP URL.
  6. Click Save. ChatGPT will immediately execute an MCP initialize handshake and pull the Lettr tool definitions.

Option B: Via Manual Config File

If you are running a custom AI agent framework, LangChain, or desktop clients that rely on configuration files, you can connect the server using the official MCP SSE transport module.

Add this to your MCP configuration JSON:

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

Hero Tools for Lettr Automation

Truto auto-generates dozens of tools for the Lettr integration. Rather than overwhelming the LLM context window with every possible API endpoint, you should filter your MCP server to expose only the tools required for your specific use case. Here are the highest-leverage operations for marketing workflows.

1. List Campaigns

Tool: list_all_lettr_campaigns This tool retrieves a paginated list of campaigns for the authenticated team. Crucially, Lettr embeds engagement stats directly in the response, allowing your LLM to immediately see open rates, click rates, and bounce data without making secondary requests.

"Fetch the latest Lettr campaigns and summarize the engagement stats. Tell me which campaign had the highest open rate this week."

2. Create a Draft Campaign

Tool: create_a_lettr_campaign This operation creates a draft campaign. The LLM can supply content via raw HTML (html_content) or use a pre-existing template_id. The LLM must ensure the specified sender email domain is verified in the Lettr account.

"Draft a new Lettr campaign named 'Summer Product Update'. Use the template ID 88492 and set the sender to updates@ourdomain.com."

3. Send a Campaign

Tool: lettr_campaigns_send This tool immediately dispatches a draft campaign by its ID. Lettr transitions the campaign status to preparing and handles the send asynchronously. The campaign must have a subject, sender email, and content to succeed.

"Send the 'Summer Product Update' campaign draft we just created. Confirm once the dispatch command has been successfully submitted."

4. Bulk Create Contacts

Tool: lettr_audience_contacts_bulk_create This endpoint creates up to 1,000 contacts in a single request. The LLM can pass detailed properties, lists, and topics for each contact array object, preventing the need for iterative, slow REST calls.

"Take this list of 45 webinar attendees and bulk import them into Lettr as new audience contacts."

5. Bulk Subscribe to Topics

Tool: lettr_audience_contact_topics_bulk_create This tool subscribes a matrix of contacts to specific topics. The LLM passes arrays of contact_ids and topic_ids. Lettr processes the matrix and returns the results, explicitly flagging pairs that were already_subscribed.

"Take the 45 contacts we just created and bulk subscribe all of them to the 'Product Updates' topic ID."

6. Create a Sending Domain

Tool: create_a_lettr_domain This operation registers a new sending domain. Lettr interfaces with SparkPost to provision the domain and stores it as approved by default (pending DNS verification checks).

"Register the domain 'marketing.acme.com' in Lettr as a new sending domain."

For a complete list of endpoints and JSON schema requirements, check out the full Lettr integration documentation.

Workflows in Action

AI agents excel at multi-step orchestration. By chaining Lettr tools together, an LLM can execute complex marketing logic from a single natural language prompt. Here are two real-world examples of how ChatGPT interacts with the Lettr MCP server.

Scenario 1: Automated Campaign Generation and Dispatch

User Prompt:

"Draft a new campaign called 'Q3 Feature Release' using our standard template ID 9912. Once it is created, dispatch the campaign immediately."

Execution Steps:

  1. ChatGPT calls create_a_lettr_campaign, supplying the name, template ID, and required sender details.
  2. The Lettr API responds with the new campaign object, including its unique campaign_id.
  3. ChatGPT extracts the campaign_id and calls lettr_campaigns_send to trigger the asynchronous dispatch.
  4. ChatGPT informs the user that the campaign is now in the preparing state.
sequenceDiagram
    participant User as User
    participant ChatGPT as ChatGPT (Client)
    participant Truto as Truto MCP Server
    participant Lettr as Lettr API

    User->>ChatGPT: "Draft Q3 Feature Release..."
    ChatGPT->>Truto: call tool: create_a_lettr_campaign
    Truto->>Lettr: POST /api/campaigns
    Lettr-->>Truto: 201 Created (id: "cmp_abc123")
    Truto-->>ChatGPT: Tool Result: Success
    ChatGPT->>Truto: call tool: lettr_campaigns_send (id: "cmp_abc123")
    Truto->>Lettr: POST /api/campaigns/cmp_abc123/send
    Lettr-->>Truto: 200 OK (status: preparing)
    Truto-->>ChatGPT: Tool Result: Success
    ChatGPT-->>User: "Campaign created and dispatch triggered."

Scenario 2: Audience Segmentation and Tagging

User Prompt:

"Here are 30 new enterprise leads. Add them to Lettr, attach them to the 'Enterprise Prospects' list (ID 45), and subscribe them to the 'B2B Newsletter' topic (ID 12)."

Execution Steps:

  1. ChatGPT maps the user's data into the required JSON array and calls lettr_audience_contacts_bulk_create.
  2. Lettr processes the batch and returns an array of the 30 new contact_ids.
  3. ChatGPT calls lettr_audience_contact_lists_bulk_create, passing the array of 30 contact_ids and the list ID 45.
  4. ChatGPT calls lettr_audience_contact_topics_bulk_create, passing the same contact_ids array and the topic ID 12.
  5. ChatGPT returns a summary of the successful bulk operations.

Security and Access Control

Giving an LLM direct API access requires strict governance. Truto's MCP architecture enforces security at the token level, ensuring your LLM can only interact with the endpoints you explicitly allow.

  • Method Filtering: Use config.methods to restrict the server to specific HTTP verbs. You can set this to ["read"] to allow ChatGPT to pull campaign analytics while completely blocking it from creating or deleting contacts.
  • Tag Filtering: Use config.tags to limit the functional scope. By setting tags to ["audience"], the MCP server will hide all campaign, domain, and webhook tools from the LLM, preventing accidental modifications to core infrastructure.
  • API Token Authentication: By enabling require_api_token_auth: true, the MCP endpoint will reject requests unless the client also passes a valid Truto API session token. This adds a second layer of security beyond the URL hash.
  • Time-to-Live (TTL): Set an expires_at timestamp when generating the server. Once the timestamp passes, the server URL automatically self-destructs. This is perfect for granting a temporary autonomous agent access to execute a specific background task.

Handling Lettr Rate Limits

When writing custom integrations, dealing with HTTP 429 Too Many Requests errors is a massive time sink.

Factual note on how Truto handles rate limits: Truto does not automatically retry, throttle, or apply backoff logic on rate limit errors. When the upstream Lettr API returns an HTTP 429, Truto passes that error directly through to the caller. However, Truto normalizes Lettr's upstream rate limit information into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF specification.

Because Truto normalizes these headers, your LLM framework (or standard API client) can implement a unified retry and backoff strategy that works across all connected APIs, without needing to write custom parsing logic for Lettr's specific rate limit header format.

Wrap Up

Connecting Lettr to ChatGPT natively opens up powerful AI-driven marketing workflows. Instead of manually clicking through UI dashboards to segment lists, analyze campaign stats, or draft newsletters, you can orchestrate the entire Lettr platform using natural language.

By leveraging Truto's dynamic MCP server generation, you avoid writing boilerplate JSON-RPC handlers, mapping bulk data structures, or fighting with SparkPost idempotency rules. You configure the security scopes, copy the URL, and let the LLM do the rest.

FAQ

Can I restrict ChatGPT to only read campaigns in Lettr?
Yes. When generating the MCP server in Truto, you can pass `config: { methods: ["read"], tags: ["campaigns"] }`. This ensures the LLM only has access to read-only endpoints related to campaigns, preventing accidental email sends or data modification.
How does Truto handle Lettr API rate limits?
Truto passes HTTP 429 rate limit errors directly to the caller. It normalizes Lettr's rate limit information into standard IETF headers (`ratelimit-limit`, `ratelimit-remaining`, `ratelimit-reset`). The client or LLM framework is responsible for implementing retry and backoff logic.
Why do Lettr endpoints fail when using a sandbox API key?
Lettr explicitly blocks almost all write operations (like creating contacts or sending campaigns) when using sandbox API keys. You must use a production API key for full read/write functionality.

More from our Blog