Skip to main content
Glama
dazanza
by dazanza

create_campaign

Create and configure new email campaigns in Mailchimp by specifying audience, subject line, sender details, and campaign type for marketing automation.

Instructions

Create a new Mailchimp email campaign. Returns the campaign ID for use with set_campaign_content and send_campaign.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
list_idYesAudience/list ID (get from list_audiences)
subject_lineYesEmail subject line
from_nameYesSender name shown to recipients
reply_toYesReply-to email address
typeNoCampaign type (default: regular)
preview_textNoPreview text shown in inbox
titleNoInternal campaign title (for your reference)
segment_idNoSegment ID to send to a subset of the audience

Implementation Reference

  • The implementation of the 'create_campaign' tool, which uses the Mailchimp API to create a campaign and returns its ID.
    server.tool(
      "create_campaign",
      "Create a new Mailchimp email campaign. Returns the campaign ID for use with set_campaign_content and send_campaign.",
      {
        list_id: z.string().describe("Audience/list ID (get from list_audiences)"),
        subject_line: z.string().describe("Email subject line"),
        from_name: z.string().describe("Sender name shown to recipients"),
        reply_to: z.string().describe("Reply-to email address"),
        type: z.enum(["regular", "plaintext", "absplit", "rss"]).optional().describe("Campaign type (default: regular)"),
        preview_text: z.string().optional().describe("Preview text shown in inbox"),
        title: z.string().optional().describe("Internal campaign title (for your reference)"),
        segment_id: z.number().optional().describe("Segment ID to send to a subset of the audience"),
      },
      async ({ list_id, subject_line, from_name, reply_to, type, preview_text, title, segment_id }) => {
        const body = {
          type: type || "regular",
          recipients: { list_id },
          settings: {
            subject_line,
            from_name,
            reply_to,
            preview_text: preview_text || "",
            title: title || subject_line,
          },
        };
        if (segment_id) {
          body.recipients.segment_opts = { saved_segment_id: segment_id };
        }
        const response = await mailchimp.campaigns.create(body);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  id: response.id,
                  status: response.status,
                  web_id: response.web_id,
                  subject_line: response.settings?.subject_line,
                  title: response.settings?.title,
                  list_id: response.recipients?.list_id,
                  archive_url: response.archive_url,
                },
                null,
                2
              ),
            },
          ],
        };
      }
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dazanza/mailchimp-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server