Mailchimp Campaigns CampaignSentTrigger

Mailchimp Campaigns CampaignSentTrigger

Certified

Trigger on sent Mailchimp campaigns

Polls GET /campaigns?status=sent by send time (send_time) and starts one execution per poll with every campaign sent since the last poll, stored as an ION file (trigger.uri, trigger.count). campaignId, sendTime and title describe the latest one; set includeReport to also get its report summary.

The position is kept in the namespace KV Store, per flow, trigger and listId filter: the newest send_time seen plus the campaign ids sent at exactly that time. The first poll only records the current position: campaigns already sent do not fire. Each poll reads at most 1000 rows (more only when they all share one timestamp), so a backlog larger than 1000 drains over several polls.

yaml
type: io.kestra.plugin.mailchimp.campaigns.CampaignSentTrigger

Post the report of every sent campaign.

yaml
id: mailchimp_campaign_sent
namespace: company.team

triggers:
  - id: campaign_sent
    type: io.kestra.plugin.mailchimp.campaigns.CampaignSentTrigger
    apiKey: "{{ secret('MAILCHIMP_API_KEY') }}"
    listId: "a1b2c3d4e5"
    includeReport: true
    interval: PT15M

tasks:
  - id: log
    type: io.kestra.plugin.core.log.Log
    message: "Campaign '{{ trigger.title }}' sent at {{ trigger.sendTime }}, {{ trigger.report.emailsSent ?? 'n/a' }} emails"
Properties

OAuth access token

Set exactly one of apiKey or accessToken. server is required with an access token.

Defaultfalse

Specifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.

Mailchimp API key

Set exactly one of apiKey or accessToken. The data center is taken from the key suffix (for example -us19) unless server is set.

Base URL override

Replaces https://<server>.api.mailchimp.com/3.0. The credential is sent to this URL, so it must be an https *.api.mailchimp.com host.

DefaultSTORE
Possible Values
STOREFETCHFETCH_ONENONE

Fetch strategy

STORE: write the new rows as ION to internal storage and return the uri. FETCH: return the new rows in rows (at most one page of 1000, or more when they share one timestamp). Default STORE.

Defaultfalse

Include report

Also fetch GET /reports/{id} for the latest sent campaign into report. Default false.

DefaultPT5M
Formatduration

Polling interval

Time between two polls. Defaults to 5 minutes, minimum 30 seconds to stay well within Mailchimp's rate limits.

Audience ID

Only campaigns sent to this audience (list_id). All audiences when not set.

Default3

Max retries

Retries done by this plugin on HTTP 429 (all methods) and on 5xx or I/O errors (GET and PUT only), with exponential backoff. Default 3, between 0 and 10. Kestra's HTTP client also replays a GET or PUT once after a 429 or 503 on its own, so 0 only turns off the plugin's retries.

Data center

Mailchimp data center such as us19. Required with accessToken, optional with apiKey (overrides the key suffix).

SubTypestring
Possible Values
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTED

List of execution states after which a trigger should be stopped (a.k.a. disabled).

DefaultPT2M

Request timeout

Idle read timeout of each call: how long to wait without receiving data. Default PT2M, must be positive. Mailchimp itself cuts requests off after 120 seconds.

Defaulttrue

A condition that determines whether the trigger should run.

A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.

Latest campaign ID

Id of the most recently sent campaign in this poll.

Number of newly sent campaigns

Number of newly sent campaigns, as rows in the uri file or in rows.

Latest campaign report

Report summary of the latest campaign, as GetCampaignReport returns it. Only set when includeReport is true; empty when Mailchimp has no report for it (404).

SubTypeobject

Sent campaigns

The newly sent campaigns, same fields as ListCampaigns, oldest first. Set when fetchType is FETCH.

Formatdate-time

Latest campaign send time

Send time of the latest campaign.

Latest campaign title

Subject-line title of the most recently sent campaign in this poll.

Formaturi

Sent campaigns URI

ION file in internal storage, one row per campaign, same fields as ListCampaigns, oldest first.