Skip to main content

Mailchimp ExecModule

Overview

MailchimpModule connects ValkyrAI workflows to Mailchimp Marketing API 3.0 for audiences, members, member tags, campaigns, campaign content, send checklists, and explicitly confirmed campaign sends. It exposes 15 bounded operations through the native map I/O ExecModule ABI and keeps OAuth access tokens or API keys in a READY IntegrationAccount.

The official n8n Mailchimp integration and Mailchimp resource model informed the operation set. ValkyrAI adds a validated data-center host, encrypted IntegrationAccount boundary, bounded requests and responses, one-page pagination, credential redaction, safe-read-only retry, write reconciliation guidance, subscriber-hash normalization, and a mandatory send guard.

Usage

  1. Create a Mailchimp OAuth integration with only the audience and campaign access the workflow needs. For private internal workflows, a Mailchimp API key is also supported.
  2. Store the OAuth access token or API key only in the encrypted apiKey field of a ValkyrAI IntegrationAccount; set its status to READY.
  3. Bind the account through ExecModuleConfig.authConfig.integrationAccount.
  4. Set authMode to oauth_bearer (preferred) or api_key.
  5. Set serverPrefix to the account data-center prefix, such as us19; do not provide a URL.
  6. Choose one operation and provide its conditional audience, member, campaign, payload, or filter fields.
  7. For list operations, pass nextOffset to a later execution only when hasMore is true.

Inputs

NameTypeRequiredDescriptionConstraints
operationstringYesOperation listed below.Exact allowlist of 15 values.
serverPrefixstringYesMailchimp data-center prefix.Lowercase letters followed by digits, such as us19; not a URL.
authModestringYesoauth_bearer or api_key.Defaults to OAuth bearer.
audienceIdstringConditionalList/audience identifier.1–128 safe identifier characters.
memberIdstringConditionalMember email or subscriber hash.A bounded email is normalized to MD5 of its lowercase form; a hash must be 32 lowercase hex characters.
campaignIdstringConditionalCampaign identifier.1–128 safe identifier characters.
recordobjectConditionalPayload for mutations.Non-empty, at most 100 top-level fields and 256 KiB serialized; credential-like top-level keys rejected.
queryobjectNoResource-specific list filters.At most 20 allowlisted scalar fields; values at most 2,048 characters.
offsetintegerNoZero-based collection offset.0–1,000,000; default 0.
limitintegerNoProvider page size.1–500; default 100.
confirmSendbooleanConditionalExplicit send authorization.Must be true for send_campaign.

Operation-specific payload requirements:

  • upsert_member requires email_address and status_if_new; consent status must reflect the real contact state.
  • update_member_tags requires a non-empty tags array with no more than 100 entries.
  • create_campaign requires type, recipients, and settings.
  • set_campaign_content requires at least one of html, plain_text, or template.
  • send_campaign requires confirmSend: true and does not accept an implicit approval.

Outputs

NameTypeWhen presentDescription
statusstringAlwayssuccess or error.
operationstringAlwaysNormalized operation.
resourcestringAfter validationAccount, audience, member, tag, campaign, content, checklist, or send family.
dataobjectSingle/action successProvider record or bounded action response. A successful HTTP 204 action returns an empty object.
itemsarrayList successOne bounded Mailchimp page.
countintegerList successItems returned in this page.
hasMorebooleanList successWhether total_items indicates another page.
nextOffsetintegerWhen another page existsOffset for the next execution.
httpStatusintegerProvider responseMailchimp HTTP status.
attemptsintegerProvider call or errorHTTP attempts consumed.
errorobjectFailureRedacted code, message, and retryable fields.

Audience and campaign responses are classified restricted. Credentials and record values are not copied into progress logs.

IntegrationAccount Requirements

SettingRequirement
ProviderMailchimp Marketing API 3.0
Preferred authenticationOAuth 2 bearer token in IntegrationAccount.apiKey
Alternative authenticationMailchimp API key in IntegrationAccount.apiKey, sent with HTTP Basic over TLS
StatusExactly READY
accountNameHuman-readable Mailchimp account/integration identity
RelationshipExecModuleConfig.authConfig.integrationAccount

Mailchimp recommends OAuth 2 for integrations that access other users' accounts. Grant only the permissions needed to read or write audiences and campaigns. This module never puts the credential in URLs, records, query filters, examples, logs, or WorkflowState. OAuth initiation, callback, refresh, and marketplace enrollment remain outside version 1.0.0.

Configuration

Illustrative persisted configuration:

{
"version": "1.0.0",
"authConfig": {
"authStrategy": 1,
"integrationAccount": "integration-account:mailchimp-marketing"
},
"payloadConfig": {
"parameters": "{\"authMode\":\"oauth_bearer\",\"serverPrefix\":\"us19\",\"operation\":\"list_members\",\"audienceId\":\"a1b2c3\",\"limit\":100,\"query\":{\"status\":\"subscribed\"}}"
}
}

The relationship is symbolic. The generated IntegrationAccount owns the encrypted secret.

Operations

ResourceOperationProvider routeBehavior
Accountget_accountGET /3.0Read account root.
Audienceslist_audiencesGET /3.0/listsOne offset page.
Audiencesget_audienceGET /3.0/lists/{audienceId}Read one audience.
Memberslist_membersGET /3.0/lists/{audienceId}/membersOne offset page.
Membersget_memberGET /3.0/lists/{audienceId}/members/{subscriberHash}Read one member.
Membersupsert_memberPUT /3.0/lists/{audienceId}/members/{subscriberHash}Add or update one member.
Member tagsupdate_member_tagsPOST /3.0/lists/{audienceId}/members/{subscriberHash}/tagsAdd/remove declared tags.
Campaignslist_campaignsGET /3.0/campaignsOne offset page.
Campaignsget_campaignGET /3.0/campaigns/{campaignId}Read one campaign.
Campaignscreate_campaignPOST /3.0/campaignsCreate one campaign.
Campaignsupdate_campaignPATCH /3.0/campaigns/{campaignId}Update one campaign.
Contentget_campaign_contentGET /3.0/campaigns/{campaignId}/contentRead content.
Contentset_campaign_contentPUT /3.0/campaigns/{campaignId}/contentReplace declared content fields.
Checklistget_campaign_send_checklistGET /3.0/campaigns/{campaignId}/send-checklistInspect readiness.
Sendsend_campaignPOST /3.0/campaigns/{campaignId}/actions/sendRequires confirmSend=true.

Audience deletion, permanent member deletion, batch jobs, webhooks, automations, templates, reports, scheduling, unscheduling, replication, test sends, conversations, e-commerce, and transactional email are deferred.

Errors and Failure Modes

FailureCauseRetry guidance
VALIDATION_ERRORMissing/invalid prefix, ID, consent payload, tags, campaign fields, query, bound, or send confirmation.Correct the request; no provider call was sent.
INTEGRATION_ACCOUNT_REQUIREDNo bound secure account.Bind the intended account.
INTEGRATION_ACCOUNT_NOT_READYAccount status is not READY.Repair or reauthorize the account.
MAILCHIMP_HTTP_400/404Provider validation, nonexistent resource, or campaign not ready.Correct identifiers, field shapes, audience/campaign state, or filters.
MAILCHIMP_HTTP_401/403Invalid credential or insufficient access.Reauthorize OAuth or rotate the API key with minimum required access.
MAILCHIMP_HTTP_429Account rate limit.Reads retry at most three total attempts and honor bounded numeric Retry-After; writes remain single-attempt.
MAILCHIMP_HTTP_5xx / NETWORK_ERRORProvider or transport failure.Reads retry. Reconcile member, tag, campaign, content, or send state before manually retrying a write.
RESPONSE_TOO_LARGEProvider response exceeded 5 MiB.Narrow fields, filters, or page size.
Identity mismatchA requested audience/member/campaign returned a different id.Treat as failure and verify provider compatibility.

Errors are bounded to 500 characters and pass through credential redaction. A timed-out mutation may have reached Mailchimp, so automatic write replay is disabled.

Example

Upsert an explicitly opted-in contact:

{
"serverPrefix": "us19",
"operation": "upsert_member",
"audienceId": "a1b2c3",
"memberId": "ada@example.com",
"record": {
"email_address": "ada@example.com",
"status_if_new": "subscribed",
"status": "subscribed",
"merge_fields": {
"FNAME": "Ada",
"LNAME": "Lovelace"
}
}
}

Expected normalized result:

{
"status": "success",
"operation": "upsert_member",
"resource": "members",
"data": {
"id": "3e3417d7ef77d5932a6734b916515ed5",
"email_address": "ada@example.com",
"status": "subscribed"
},
"httpStatus": 200,
"attempts": 1
}

Notes

  • Pagination: collection operations return one page. Use nextOffset only when hasMore is true; the module never silently traverses every page.
  • Rate limits: Mailchimp can return HTTP 429. The module retries only safe reads, honors bounded numeric Retry-After, and caps safe reads at three attempts.
  • API limits: Mailchimp documents count up to 1,000; ValkyrAI intentionally caps pages at 500, request JSON at 256 KiB, and response JSON at 5 MiB.
  • Idempotency: GET calls are retry-safe. Member PUT is provider-addressed by subscriber hash but can still trigger automations; every mutation is single-attempt and requires reconciliation after ambiguous transport failure.
  • Consent: status_if_new and status must reflect real, provable contact consent. The module does not infer subscription permission.
  • Destructive behavior: permanent deletion is intentionally not exposed. Tag changes, campaign updates, content replacement, and campaign sending are externally visible side effects.
  • Sending: check get_campaign_send_checklist first. send_campaign requires confirmSend=true, sends immediately, and is never automatically retried.
  • External verification: deterministic tests cover validation, URL construction, auth modes, subscriber hashing, payload mapping, pagination, rate-limit retry, write non-retry, redaction, send guarding, response identity, and annotation discovery. Live Mailchimp execution is deferred until a separately authorized provider account is supplied.

See the official Mailchimp Marketing API reference, methods and pagination guide, OAuth 2 guide, and the official n8n Mailchimp node source for the functional reference.