<
Priya Nain | December 2nd, 2026 · Updated Dec 2026

How to Create Email Campaigns Using Claude, ChatGPT and the SendX API

Share

Think about everything that happens between deciding to send an email and actually sending it.

Someone has to write the copy, format it, create a campaign in the email marketing platform, select the right audience, configure exclusions and set up the sending schedule. For a team managing dozens of campaigns every week, that's a considerable amount of repetitive work.

And even if you're using AI to write your emails, you're probably still doing much of this manually.

What if you could describe a whole campaign in your own words and let AI set it up for you?

The SendX API lets you do that. Once you connect it to a tool like Claude or ChatGPT, the AI can work directly in your SendX account to turn a campaign brief into a draft, manage your subscriber lists, save reusable templates, and much more.

This guide shows you how to set it up and how to create your first email campaign with AI.

How AI can work directly with your email marketing platform

When you ask ChatGPT or Claude to write an email, it generates the content within the chat window. You then need to copy that content into your email marketing platform and set up the campaign yourself.

An API (Application Programming Interface) allows two pieces of software to communicate with each other.

SendX has an API that allows external applications to perform actions inside your SendX account. These include creating campaigns, retrieving subscriber lists, managing contacts and accessing campaign reports.

When you connect an AI assistant to the SendX API, the assistant can translate your everyday language into instructions that SendX understands.

Diagram comparing manual campaign setup, where you copy and paste the AI-written email into SendX, with asking Claude to build the draft through the SendX API

For example, when you ask Claude to create a promotional campaign for your free-plan users, it can look up the relevant subscriber list in SendX, generate the email content and create the actual campaign inside your account.

You can then log into SendX and find the campaign ready for review.

The connection requires a little initial setup, including an API key that authorizes access to your SendX account. Once that's done, you can use natural language prompts to perform many of your everyday email marketing tasks.

What can you do with AI and the SendX API?

The SendX REST API gives AI tools access to many of the functions you would typically perform inside your email marketing platform.

Once you've connected an AI assistant with the appropriate API access, here's what you can ask it to do:

Task

Example prompt

Create email campaigns

Create a promotional email offering free users a discount on our annual plan.

Manage contacts

Add these new subscribers to our newsletter list.

Manage audiences

Create a list for people who registered for our webinar.

Configure recipients

Send this campaign to our newsletter subscribers, excluding existing customers.

Create email templates

Build a reusable HTML template for our weekly newsletter.

Schedule campaigns

Schedule a new campaign for Thursday at 10 AM EST.

Analyze performance

Pull the results of our last five campaigns and compare their click rates.

Retrieve campaign information

Show me all the campaigns currently saved as drafts.

This can be particularly useful if you manage email campaigns for multiple clients, send newsletters frequently, or have repetitive campaign setup and reporting tasks.

You can connect an AI assistant to SendX in three ways. The right method depends on your technical comfort level and how much you want the AI to handle on its own.

Setup

Who runs the API requests?

Best for

Setup time

Regular ChatGPT or Claude chat

You. The AI writes the cURL commands, which you copy and run in a terminal or Postman.

First-time users or teams that don't want to give an AI tool direct access to their API key.

No setup required

Claude Code or another coding agent

The AI agent runs the API requests from your terminal, using an API key stored as an environment variable.

Hands-on marketers and developers who want to execute campaigns directly through AI.

5 minutes

ChatGPT custom GPT with Actions

ChatGPT makes the API requests using the SendX OpenAPI specification and a securely configured API key.

Teams that want to build a shared, in-house email campaign assistant.

15 minutes

For this tutorial, we'll use Claude Code, as it's the quickest way to get an AI assistant to execute the entire campaign creation process for you.

How to create a SendX email campaign using Claude Code

Before you start

You'll need:

  • A SendX account with access to your team API key.

  • Claude Code.

  • A verified sender email address in SendX.

  • At least one list, tag or segment containing your intended recipients.

We recommend starting with a test account or controlled internal audience while you're getting familiar with the process.

Step 1: Get your SendX API key

Log into your SendX account and navigate to:

Settings → Configuration → API & Webhooks → API

You'll arrive in API settings

SendX Settings page with the API tab open under API and Webhooks, showing the Team API Keys list and the Create API key button

Click on ‘Create API key,’ add a name for it and choose a scope. Full access can read and change data, which the campaign setup in this guide needs. Read only can fetch data but refuses any request that would change something, so it suits reporting jobs like the weekly report below. You can't change a key's scope after you create it.

The Create API key dialog in SendX with a name field and a choice between Full access and Read only scope

Once you click on ‘Create key,’ it'll create a key that you'll be shown only once. You can copy it from here.

The SendX API setup page after creating a key, with a notice to copy the key now because it will not be shown again. The key itself is hidden in this screenshot.

Your API key allows external tools to interact with your SendX account. A Full access key can read and change data in your team's account, so treat it like a password. Avoid including it in shared documents, screenshots or AI chat messages.

Step 2: Make your API key available to Claude Code

Four numbered Mac screenshots showing how to open the zshrc file in Terminal, add the SENDX_API_KEY line, save it in TextEdit and start Claude Code in a new Terminal window

On a Mac using the zsh shell, open your terminal and enter:

touch ~/.zshrc && open -e ~/.zshrc

This opens your shell configuration file in TextEdit.

Add the following line at the bottom of the file, replacing the placeholder with your SendX API key.

export SENDX_API_KEY="paste-your-key-here"

Save and close the file.

This makes your API key available as an environment variable for new shell sessions. Editing the file directly also avoids putting the key into your terminal command history.

This method stores the key in a local configuration file as plain text. Follow your organization's credential storage policies if there are any.

Open a new terminal session and launch Claude Code. Ask:

Is SENDX_API_KEY set?

Don't print or reveal the actual key.

If you're using the Claude desktop app, open the Code tab and start a local session. Ask Claude to load your shell configuration and check whether the SendX API key is available without revealing its value.

You should see a confirmation like this:

Claude Code confirming that the SENDX_API_KEY variable is set without printing its value

Once Claude confirms that the environment variable is available, you can proceed.

Step 3: Give Claude your campaign instructions

Let's imagine you run a SaaS business called TaskNest, a to-do list and productivity app that helps people organize their daily tasks, manage projects and plan their week.

You want to encourage your free-plan users to upgrade by offering them 30% off an annual Pro subscription. You want to exclude existing paying customers from this promotion.

You also want to review the campaign before it goes out.

Here's a prompt you can copy and customize for your own business.

You're helping me run an email campaign through the SendX REST API.

Base URL: https://api.sendx.io/api/v1/rest

Authentication: X-Team-ApiKey header with the key in $SENDX_API_KEY. Use JSON bodies.

API reference: https://docs.sendx.io/llms.txt

Rules:

- Never guess an ID. Look up senders, lists, tags and segments first.

- Create campaigns only as drafts, with "status": 0. Never use "scheduleType": 1.

- Show me every request that changes anything and wait for my approval before running it. Redact credentials.

- If a call fails, explain the error and proposed correction before retrying.

- Never send or schedule an email.

Task:

1. Find our verified sender hello@tasknest.example, the "Free Users" list and the "Paying Customers" tag.

2. Write a promotional email offering 30% off our annual Pro subscription with the code PLAN30.

TaskNest is a to-do list and productivity app. The Pro plan includes unlimited projects, recurring tasks, calendar integration and advanced reminders.

Keep the email friendly, short and focused on how these features help users stay organized.

Include one CTA button linking to https://tasknest.example/upgrade.

3. Write a subject line under 50 characters, preview text and a mobile-friendly HTML email with inline styles.

4. Save it as a draft targeting the "Free Users" list and excluding the "Paying Customers" tag.

5. Tell me the campaign ID and what I need to review before sending.

Replace the company details, sender address, audience names, offer and URLs with your own information.

Once you enter the campaign prompt, Claude will prepare the email content based on your instructions.

In our example, Claude generated a subject line, preview text, mobile-friendly HTML email and a plain-text version. It also used SendX's personalization tags and included the necessary footer elements.

Claude Code reporting that the draft is ready for review, with the subject line, preview text and the personalization tags and unsubscribe footer it used

Step 4: Review and approve Claude's actions

Claude Code can use HTTP requests to communicate with SendX.

Here's what happens behind the scenes when you give it the campaign prompt:

  1. Looks up your sender and audience: Claude retrieves the unique IDs associated with your verified sender, the Free Users list and the Paying Customers tag.

  2. Writes the email: Claude generates the subject line, preview text and HTML email based on your instructions.

  3. Prepares the API request: Claude puts together the information SendX needs to create the campaign, including your audience selections and exclusions.

  4. Creates the campaign: Once you approve the request, Claude executes it and saves the campaign as a draft inside SendX.

  5. Returns the campaign ID: Claude confirms whether the campaign was successfully created and shares its unique ID.

Before approving any request, check that Claude has identified the correct audience and sender and is creating a draft.

Since we explicitly asked Claude to wait for our approval, it presents the proposed campaign details before creating anything in SendX.

If you're happy with the content and campaign settings, approve the request.

Claude Code showing the checked payload for the campaign draft and asking for approval before creating it in SendX

Step 5: Review your campaign inside SendX

Once you approve the request, Claude creates the campaign through the SendX API and returns a unique campaign ID.

In our example, Claude also retrieved the newly created campaign to verify that the content, sender and audience matched what we had approved and that nothing had been scheduled or sent.

Claude Code confirming the campaign was saved as a draft in SendX, with its campaign ID, sender, audience and status

Log into SendX and navigate to Campaigns. You should find the new campaign saved as a draft.

Before scheduling it, check:

  • The sender name and email address.

  • The subject line and preview text.

  • The email's appearance on desktop and mobile.

  • All links, discount codes and personalization.

  • The inclusion and exclusion audiences.

  • The final recipient count.

  • The unsubscribe link.

Once you're happy with everything, schedule or send the campaign directly from SendX.

You can edit any of these details directly inside SendX if needed.

The SendX campaign overview for the draft, showing status, subject, preview text, sender and a preview of the TaskNest email

Next, check the Recipients section to make sure Claude has selected the correct audience.

For this demonstration, we used an internal testing segment containing just two contacts. When creating a real campaign, you can specify your intended lists, tags, segments and exclusions in your prompt.

The Recipients section of a SendX campaign with an internal testing segment included, nothing excluded and a count of two contacts who will receive it

The SendX API also supports creating campaigns that are scheduled for a specific date and time or sent immediately.

Four-step diagram: you ask in plain English, Claude looks up IDs and writes the draft, you approve the request, and the draft waits in SendX for you to send

5 more ways to use Claude or ChatGPT with SendX

Setting up campaigns is just one thing you can do once your AI assistant is connected to SendX. Here are a few more ideas to try.

1. Get a weekly performance report

If you run several campaigns a week, gathering the numbers by hand eats up a lot of time. Your AI assistant can pull the reports from SendX for you and turn them into a summary you can read in a few minutes.

Prompt:

Pull the reports for every campaign sent in the last 7 days. Compare opens, clicks, bounces, unsubscribes and spam complaints. Point out anything unusual and tell me which campaigns I should look into.

Agencies that send clients a report every week or month will find this especially handy.

2. Turn your content calendar into campaign drafts

Share your content calendar with your AI assistant, including your upcoming promotions, newsletters and announcements. Then ask it to build a draft for each one using your audience names, brand guidelines and approved offers.

Prompt:

Use this month's content calendar to create 5 email campaign drafts in SendX. Follow our brand guidelines and use the audience listed for each campaign. Keep all 5 as drafts.

Your team can then review and approve each draft as the month goes on.

3. Build templates you can reuse

If you send the same kinds of emails again and again, ask your AI assistant to write the HTML for a template and save it to SendX for you.

Prompt:

Create a reusable weekly newsletter template with a header, an intro, 3 article sections, a sponsor spot and a footer. Use our brand colors and inline CSS. Once I approve the HTML, save it as a new template in SendX.

Next time you put together a campaign, you can start from the template instead of a blank page.

4. Manage subscriber lists and tags

You can use the SendX API to create lists and tags and add or update contacts.

For example, if you've collected registrations for a webinar, Claude can help organize those contacts inside SendX.

Prompt:

Create a list called December Webinar Attendees. Add the contacts from this approved registration file and apply the tag December Webinar.

Only use subscriber data that you're authorized to process and share with your AI provider.

5. Audit your campaign inventory

If multiple team members create campaigns, you might accumulate drafts that are outdated, duplicated or no longer needed.

Prompt:

Retrieve all draft campaigns in SendX. Organize them by creation date and identify possible duplicates. Give me a list of campaigns we should review for deletion. Don't delete anything without my approval.

This gives your team an opportunity to clean up its workspace without manually opening every campaign.

Best practices when using AI to manage email campaigns

Once an AI assistant can work inside your email account, you need a few extra safeguards. Start with these:

  • Approve every send yourself: Let the AI create campaigns, but keep the final send as a separate step that a person signs off on, at least until your workflow is settled.

  • Keep your API key private: Never paste it into a prompt, a shared chat or any file other people can see.

  • Check the audience: Ask the assistant to look up the real list and tag IDs in SendX rather than guess or make them up.

  • Share only the subscriber data it needs: Give the assistant access to what the task requires and nothing more.

  • Watch for duplicate campaigns: If a request fails or times out, check whether the campaign was created before you try again.

  • Review the HTML before sending: Make sure the email displays properly and that the links, personalization and unsubscribe link all work.

  • Keep each client separate: Use a separate session and API key for every client, and confirm you're in the right SendX account before the AI does anything.

Start building your AI-powered email marketing workflow

If your team already uses AI to write emails, connecting it to your email marketing platform opens up more opportunities to reduce repetitive work.

Start with a single campaign draft. Once you're comfortable with the process, explore reporting, template creation, audience management and more advanced campaign workflows.

The SendX API gives you the flexibility to incorporate email marketing into the AI tools and workflows your team already uses.

Explore the SendX API documentation to get started.

FAQs

Do I need to know how to code to use Claude Code with SendX?

You need some familiarity with setting up Claude Code and reviewing commands, but you can describe your campaign requirements in plain English. Claude Code can prepare and execute the API requests for you.

Can I connect ChatGPT directly to SendX?

You can configure a custom GPT with Actions using the SendX API specification and authentication credentials. A regular ChatGPT conversation without HTTP execution capabilities can help you write API requests, which you can run separately.

Can AI send emails without my approval?

An AI assistant with the necessary API access can create and send campaigns. You should configure your workflow and tool permissions to require explicit approval before any live send.

Can Claude analyze my previous SendX campaigns?

Yes. Claude can retrieve campaign reporting data through the SendX API and summarize how your campaigns performed.

Can I use the SendX API to create campaigns for multiple clients?

Yes, provided you have authorized API access to each client's SendX account. You should keep credentials and sessions separate to avoid accidentally creating campaigns in the wrong account.

Does SendX have an MCP server for Claude or ChatGPT?

SendX does not currently have a native MCP server. However, AI assistants that can execute HTTP requests can interact with SendX through its REST API.

Where can I find the SendX API documentation?

You can access the SendX API documentation and the LLM-friendly API reference to explore supported endpoints and request formats.

Notes on email that works.

From the team that delivers 4.4 billion emails a year.

The most useful thing from our weekly email strategy call, plus the best of what we have written.

Ready to switch to a better email platform?

Join 3,000+ businesses delivering email with 95–98% inbox placement rates. Start your free 14-day trial — no credit card required.

Get Started
No credit card required
Cancel anytime