To use n8n with Mailchimp, you can integrate the two by using the built-in Mailchimp node in n8n. This allows you to automate tasks like adding subscribers, updating lists, and sending campaigns. Here's a step-by-step guide:
β
Prerequisites:
- An n8n instance (cloud or self-hosted).
- A Mailchimp account.
- A Mailchimp API Key.
π Step 1: Get Mailchimp API Key
- Go to your Mailchimp dashboard.
- Navigate to Account > Extras > API keys.
- Create a new API key if you donβt have one.
- Copy the key.
π Step 2: Add Mailchimp Credentials in n8n
- Open n8n.
- Go to Credentials > New Credential.
- Choose Mailchimp API.
- Paste your API key and save it.
βοΈ Step 3: Create Your Workflow
Example: Add a new contact to Mailchimp when a form is submitted
Start with a trigger (e.g., Webhook, Gmail, or Form trigger).
Add a Mailchimp node.
Operation: Add member
Select the Mailchimp credential.
Choose the List ID (audience).
Set the fields (e.g., email, first name, last name).
Connect the trigger to the Mailchimp node.
π§ͺ Step 4: Test the Workflow
- Execute the workflow manually or wait for the trigger.
- Check your Mailchimp audience to see if the new subscriber was added.
π‘ Example Use Cases
- Add users to Mailchimp when they submit a Typeform or Google Form.
- Send welcome emails when new contacts are added in Airtable or Google Sheets.
- Sync CRM data (like HubSpot or Salesforce) with Mailchimp lists.
π οΈ Optional Nodes to Combine With Mailchimp:
- HTTP Request Node: for more complex Mailchimp API operations not available in default node.
- Set Node: to shape data before sending to Mailchimp.
- If Node: to add logic like checking if email already exists.
Great! Letβs go with a practical example:
π― Goal: Add subscribers to Mailchimp when a user submits a form (via Webhook in n8n)
This example will:
- Use a Webhook to collect data like name and email.
- Add the contact to a specific Mailchimp audience/list.
π§± Workflow Nodes Overview:
- Webhook (trigger)
- Set (format incoming data)
- Mailchimp (add member to list)
π§ Step-by-Step Instructions
π§© 1. Webhook Node
- Trigger Type:
POST
- Set a name like
add-mailchimp-subscriber
- After saving, copy the Test URL (youβll send a POST request here later)
π§© 2. Set Node
- Add fields:
email: {{$json["email"]}}
first_name: {{$json["first_name"]}}
last_name: {{$json["last_name"]}}
π§© 3. Mailchimp Node
Resource: Member
Operation: Add
Audience List: Choose your audience (required)
Email: Use the email field from the Set node
Under "Fields":
First Name: first_name
Last Name: last_name
Status: subscribed
Select your Mailchimp credentials.
π JSON Sample of the Workflow
You can import this into n8n directly (replace your-list-id with your actual list ID):
{
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "mailchimp-subscriber"
},
"id": "Webhook",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [250, 300]
},
{
"parameters": {
"fields": {
"email": "={{$json[\"email\"]}}",
"first_name": "={{$json[\"first_name\"]}}",
"last_name": "={{$json[\"last_name\"]}}"
}
},
"id": "Set",
"name": "Set Data",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [500, 300]
},
{
"parameters": {
"resource": "member",
"operation": "add",
"listId": "your-list-id",
"email": "={{$json[\"email\"]}}",
"status": "subscribed",
"mergeFields": {
"FNAME": "={{$json[\"first_name\"]}}",
"LNAME": "={{$json[\"last_name\"]}}"
}
},
"id": "Mailchimp",
"name": "Add to Mailchimp",
"type": "n8n-nodes-base.mailchimp",
"typeVersion": 1,
"position": [750, 300],
"credentials": {
"mailchimpApi": {
"id": "your-credential-id",
"name": "Mailchimp API"
}
}
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Set Data",
"type": "main",
"index": 0
}
]
]
},
"Set Data": {
"main": [
[
{
"node": "Add to Mailchimp",
"type": "main",
"index": 0
}
]
]
}
}
}
π Test Your Workflow
- Activate the workflow in n8n.
- Send a POST request to your webhook URL:
curl -X POST https://<your-n8n-host>/webhook/mailchimp-subscriber \
-H "Content-Type: application/json" \
-d '{"email":"john@example.com","first_name":"John","last_name":"Doe"}'
- Check your Mailchimp audience β the subscriber should appear π