This guide explains how to use Mailchimp’s automation tools and webhooks to send a letter through Stannp's API based on your Mailchimp audience activity
Prerequisites
-
Stannp Account & API Key:
- You’ll need a Stannp account and an active API key.
- Find your API key in Account Settings > API Keys on Stannp.
-
Mailchimp Account:
- Have an active Mailchimp account with an audience or list set up.
-
Zapier, Make.com, or Server (Optional):
- If you’re not directly handling webhooks, you may use automation platforms like Zapier or Make.com to bridge Mailchimp and Stannp.
Step-by-Step Integration Guide
Step 1: Set Up a Mailchimp Automation
- Log in to Mailchimp.
- Go to Automations and click Create Automation.
- Choose a trigger based on the action you want to use (e.g., new subscriber, tag added, or campaign sent).
- Follow the setup process to define your trigger conditions.
Step 2: Add a Webhook to Stannp's API
Since Mailchimp does not natively support custom API actions, you’ll need to set up a webhook to connect Mailchimp to Stannp. You can configure this webhook manually or through an automation tool.
Option 1: Use Zapier or Make.com
-
Zapier:
- Trigger: Use Mailchimp's trigger for new subscribers or tag updates.
- Action: Use a webhook to call the Stannp Send a Letter endpoint.
-
Make.com:
- Module 1: Mailchimp trigger (e.g., new subscriber).
- Module 2: HTTP action to call Stannp's API with the required parameters.
Option 2: Configure a Webhook Manually
-
Set Up a Server (if applicable):
If you’re managing webhooks directly, ensure you have a server to process the Mailchimp webhook data. -
Create a Stannp Request:
When Mailchimp triggers the webhook, send the necessary data to Stannp’s Send a Letter endpoint:Endpoint:
https://api-us1.stannp.com/v1/letters/create?api_key=YOUR_API_KEY
Parameters:
recipient
: Pass subscriber data (e.g., name, address) from Mailchimp.template
: Use a predefined Stannp template ID, or send a file directly via thefile
parameter.- Optional fields:
test
,duplex
,tags
, andaddons
.
Step 3: Map Mailchimp Data to Stannp Parameters
When mapping data, ensure you use the following structure:
Required Parameters:
- Recipient Data: Map Mailchimp subscriber fields to Stannp's recipient array:
"recipient": {
"firstname": "{{merge_first_name}}",
"lastname": "{{merge_last_name}}",
"address1": "{{merge_address1}}",
"city": "{{merge_city}}",
"postcode": "{{merge_postcode}}",
"country": "{{merge_country}}"
}
Optional Parameters:
- Test Mode: Use
test: true
to create a sample without sending. - Duplex: Set to
false
if you want to print on one side only. - File: Directly upload a PDF or DOC file instead of using a template.
- Tags: Add tags for easy tracking in Stannp reports.
Step 4: Test Your Integration
- In Mailchimp, add a test subscriber or perform the triggering action.
- Verify that the subscriber data reaches Stannp correctly.
- Check your Stannp dashboard to ensure the letter was processed.
Example JSON Request for Stannp:
Below is an example of the request sent to Stannp’s API, including the API key query parameter for authentication:
{
"test": false,
"recipient": {
"firstname": "{{merge_first_name}}",
"lastname": "{{merge_last_name}}",
"address1": "{{merge_address1}}",
"city": "{{merge_city}}",
"postcode": "{{merge_postcode}}",
"country": "{{merge_country}}"
},
"template": 12345,
"duplex": true,
"clearzone": true,
"tags": "mailchimp, campaign",
"addons": "FIRST_CLASS"
}
Endpoint URL Example (with the api_key
query parameter):
https://api-us1.stannp.com/v1/letters/create?api_key=YOUR_API_KEY
Additional Notes:
- Mailchimp Merge Tags: Use Mailchimp’s merge tags like
{{merge_first_name}}
to dynamically pass data. - Automation Flexibility: Combine this setup with Mailchimp conditions (e.g., segments or tags) to personalize letters further.