Setu Recipes: reusable digital workers across every app.Browse templates

Integrations / Mailchimp

Mailchimp

Mailchimp Marketing API: audiences, members (read, add or update), campaigns and campaign reports.

8 actions API key 7 read1 write Calls api.mailchimp.com

Connect

TypeScript
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "mailchimp" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();

Permissions requested

This toolkit uses a single credential and requests no scopes.

Actions

Get audiencereadmailchimp.get_audienceGet one audience (list) by ID with its settings and statistics.
InputTypeDescription
list_idstringRequiredAudience (list) ID
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mailchimp.get_audience",
  input: {
    "list_id": "<list_id>"
  },
});
Get campaign reportreadmailchimp.get_campaign_reportGet the performance report of one sent campaign: emails sent, opens, clicks, bounces and unsubscribes.
InputTypeDescription
campaign_idstringRequiredCampaign ID
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mailchimp.get_campaign_report",
  input: {
    "campaign_id": "<campaign_id>"
  },
});
Get audience memberreadmailchimp.get_memberGet one contact of an audience. subscriber_hash must be the MD5 hash of the lowercased email address: compute it before calling (the plain email address is also accepted by Mailchimp).
InputTypeDescription
list_idstringRequiredAudience (list) ID
subscriber_hashstringRequiredMD5 hash of the lowercased email address
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mailchimp.get_member",
  input: {
    "list_id": "<list_id>",
    "subscriber_hash": "<subscriber_hash>"
  },
});
List audiencesreadmailchimp.list_audiencesList the audiences (lists) in the account with member counts and open and click rates.
InputTypeDescription
countintegerOptionalAudiences to return (default 10, max 1000)
offsetintegerOptionalAudiences to skip
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mailchimp.list_audiences",
  input: {},
});
List campaign reportsreadmailchimp.list_campaign_reportsList the reports of sent campaigns, newest first, with sent, open and click numbers for each.
InputTypeDescription
countintegerOptionalReports to return (default 10, max 1000)
offsetintegerOptionalReports to skip
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mailchimp.list_campaign_reports",
  input: {},
});
List campaignsreadmailchimp.list_campaignsList campaigns, optionally only those with one status (save, paused, schedule, sending, sent) or of one type.
InputTypeDescription
statusstringOptionalOnly campaigns with this status
typestringOptionalOnly campaigns of this type
countintegerOptionalCampaigns to return (default 10, max 1000)
offsetintegerOptionalCampaigns to skip
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mailchimp.list_campaigns",
  input: {},
});
List audience membersreadmailchimp.list_membersList the contacts in an audience, optionally only those with one status (subscribed, unsubscribed, cleaned, pending, transactional).
InputTypeDescription
list_idstringRequiredAudience (list) ID
statusstringOptionalOnly members with this status
countintegerOptionalMembers to return (default 10, max 1000)
offsetintegerOptionalMembers to skip
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mailchimp.list_members",
  input: {
    "list_id": "<list_id>"
  },
});
Add or update audience memberwritemailchimp.upsert_memberAdd a contact to an audience or update an existing one (PUT). subscriber_hash is the MD5 hash of the lowercased email address: compute it first. status_if_new is required for contacts not yet in the audience.
InputTypeDescription
list_idstringRequiredAudience (list) ID
subscriber_hashstringRequiredMD5 hash of the lowercased email address
email_addressstringRequiredThe contact's email address
status_if_newstringOptionalStatus to give a contact who is not yet in the audience
statusstringOptionalNew status for the contact (subscribed, unsubscribed, ...)
merge_fieldsobjectOptionalMerge tag values, e.g. {FNAME: 'Urist', LNAME: 'McVankab'}
tagsarray of stringOptionalTags to set on the contact
TypeScript
await setu.execute({
  userId: "user_1",
  action: "mailchimp.upsert_member",
  input: {
    "list_id": "<list_id>",
    "subscriber_hash": "<subscriber_hash>",
    "email_address": "<email_address>"
  },
});