Mailchimp unsubscribe notifications on your phone.

Get a low-priority push notification when someone unsubscribes from your Mailchimp audience, and a louder one when they report your email as spam.

How it works

Three steps to your first push

STEP 01

Install the recipe

One click in Studio gives you a personal webhook URL.

STEP 02

Paste your URL into Mailchimp

Add it as a webhook for Email unsubscribes.

STEP 03

Get a push on your phone

With the text, sound and buttons from the recipe.

Setup

How to set up the Mailchimp email unsubscribes webhook

  1. Click Install in Studio and sign in. The recipe is added to your account and you get a personal webhook URL.
  2. In Mailchimp, open Audience, pick your audience, then More options > Audience settings > Manage webhooks and click Create webhook.
  3. Paste your webhook URL as the Callback URL. Mailchimp checks it with a quick GET, which JustPush accepts silently.https://••••••••/•••••••• your personal URL, shown after install
  4. Tick only Email unsubscribes under the update types, keep all three sources ticked, and click Create webhook.
  5. Mailchimp only sends the audience's ID, not its name. To show the name in the push, add it to the Callback URL:
  6. ```
  7. your webhook URL?audience=Weekly%20Newsletter
  8. ```
  9. (`%20` is a space.) Leave it out and the push says "your audience".
  10. Keep the **By an account admin** source ticked if you also want a push when someone on your team deletes a contact.
  11. Mailchimp checks the URL with a GET request when you save the webhook. The recipe answers it without sending a push.
  12. Mailchimp can sign deliveries (`X-Mailchimp-Signature`) and shows a signing secret once after you save. JustPush doesn't check that signature yet, so you can dismiss the secret and keep your endpoint URL private.
The code

What runs when the webhook arrives

Studio calls handleRequest(request) with the incoming webhook and sends the message it returns. It's yours after install; change anything.

transform.js
1// Mailchimp → unsubscribe
2// Fires when a contact unsubscribes from a Mailchimp audience, or an admin deletes them.
3// A spam complaint (reason "abuse") also arrives as an unsubscribe.
4// Docs: https://mailchimp.com/developer/marketing/guides/sync-audience-data-webhooks/
5//
6// Mailchimp POSTs form-encoded fields such as type=unsubscribe, data[email]=…,
7// data[reason]=manual. Depending on how the body was parsed, it can arrive as a
8// nested object, a flat object with bracket keys, or only as the raw string.
9
10// Keys that must never become object properties.
11const UNSAFE = new Set(["__proto__", "constructor", "prototype"])
12
13// Put a value at a bracket path such as data[merges][FNAME].
14function setPath(target, key, value) {
15 const parts = String(key).replace(/\]/g, "").split("[")
16 if (parts.some((p) => p === "" || UNSAFE.has(p))) return
17 let node = target
18 for (const part of parts.slice(0, -1)) {
19 if (!node[part] || typeof node[part] !== "object") node[part] = {}
20 node = node[part]
21 }
22 node[parts[parts.length - 1]] = value
23}
24
25// Decode one form-encoded piece; a bad escape shouldn't break the whole body.
26function decode(value) {
27 try {
28 return decodeURIComponent(String(value).replace(/\+/g, " "))
29 } catch {
30 return String(value)
31 }
32}
33
34// Turn whatever Studio gives us into { type, fired_at, data: { … } }.
35function readForm(request) {
36 const body = request.body
37 const out = {}
38 if (body && typeof body === "object" && !Array.isArray(body)) {
39 // Nested keys are copied as they are; bracket keys are expanded.
40 for (const [key, value] of Object.entries(body)) {
41 if (key.includes("[")) setPath(out, key, value)
42 else if (!UNSAFE.has(key)) out[key] = value
43 }
44 if (out.type) return out
45 }
46 // Fall back to the raw form-encoded string.
47 const raw = typeof request.raw === "string" ? request.raw : typeof body === "string" ? body : ""
48 if (raw.includes("=")) {
49 for (const pair of raw.split("&")) {
50 const at = pair.indexOf("=")
51 if (at > 0) setPath(out, decode(pair.slice(0, at)), decode(pair.slice(at + 1)))
52 }
53 }
54 return out
55}
56
57// Form fields are strings; treat blanks as missing.
58function text(value) {
59 return typeof value === "string" && value.trim() ? value.trim() : null
60}
61
62function handleRequest(request) {
63 // Mailchimp checks the callback URL with a GET when you save the webhook.
64 if (String(request.method ?? "").toUpperCase() === "GET") {
65 console.log("Mailchimp URL check (GET) — nothing to send")
66 return null
67 }
68
69 const form = readForm(request)
70 const data = form.data && typeof form.data === "object" ? form.data : {}
71
72 // Guard: only unsubscribes, so other update types on this webhook stay quiet.
73 if (form.type !== "unsubscribe") {
74 console.log(`Ignoring Mailchimp "${form.type ?? "unknown"}" update`)
75 return null
76 }
77
78 const merges = data.merges && typeof data.merges === "object" ? data.merges : {}
79 const email = text(data.email) ?? text(merges.EMAIL)
80 const name = [text(merges.FNAME), text(merges.LNAME)].filter(Boolean).join(" ")
81 const who = name && email ? `${name} (${email})` : name || email || "Someone"
82 // Mailchimp only sends the audience ID, so ?audience=Newsletter names it for you.
83 const audience = text(request.query?.audience) ?? "your audience"
84
85 // "abuse" means they reported your email as spam; "delete" means an admin removed them.
86 if (data.reason === "abuse") {
87 return {
88 title: "⚠️ Spam complaint",
89 message: `${who} marked your email as spam and left ${audience}`,
90 topic: "Mailchimp",
91 priority: 0, // Normal — worth a look at what you sent, not urgent
92 }
93 }
94 const deleted = data.action === "delete"
95
96 return {
97 title: deleted ? "🗑️ Contact deleted" : "👋 Unsubscribed",
98 message: deleted
99 ? `${who} was deleted from ${audience}`
100 : `${who} unsubscribed from ${audience}` + (text(data.campaign_id) ? " after a campaign" : ""),
101 topic: "Mailchimp",
102 priority: -1, // Low — routine list churn
103 }
104}
Payload

The Mailchimp unsubscribe webhook

This is what Mailchimp sends to your URL for email unsubscribes. It is a sample, trimmed to the fields recipes use.

unsubscribe · sample.json
1{
2 "data": {
3 "id": "8a25ff1d98",
4 "email": "[email protected]",
5 "action": "unsub",
6 "ip_opt": "203.0.113.10",
7 "merges": {
8 "EMAIL": "[email protected]",
9 "FNAME": "Ada",
10 "LNAME": "Lovelace",
11 "INTERESTS": "Weekly digest"
12 },
13 "reason": "manual",
14 "list_id": "a6b5da1054",
15 "email_type": "html",
16 "campaign_id": "cb398d21d2"
17 },
18 "type": "unsubscribe",
19 "fired_at": "2026-09-29 09:40:57"
20}
FAQ

Mailchimp unsubscribe notifications: questions

Does this work on iPhone and Android?

Yes. Install the JustPush app from the App Store or Google Play and sign in. Every phone signed in to your account gets the notification.

Do I need to write code?

No. Install the recipe in Studio, paste your webhook URL into Mailchimp and you are done. The code is there if you want to change the text, the sound or the buttons.

Can I change what the notification says?

Yes. After install the recipe's code is yours. Edit it in Studio and test it against the sample payload before you save.

What does it cost?

JustPush is free for 30 days. After that it's $19.99 a year, or $39.99 once. There is no extra charge for recipes.

Ready when you are

Mailchimp on your phone in two minutes.

Install the recipe, paste one URL, done. Free for 30 days, no credit card required.