Recipe: Slack alerts on bounces & complaints
Get a Slack message when mail from one of your domains bounces or gets marked as spam.
Trigger: Notify Bounce or Complaint webhook for a verified domain. Action: post to Slack.
Steps
- Create a Slack incoming webhook (Slack app → Incoming Webhooks) and copy the URL.
- Deploy a tiny HTTPS endpoint that receives Notify events and forwards to Slack (recommended over pasting Slack's URL into Notify).
- In Notify → Webhooks, create a webhook: your endpoint URL, events
BounceandComplaint, select the verified domain for that site. - Send a test payload or trigger a real bounce and confirm Slack.
export async function POST(req: Request) {
const event = await req.json();
if (String(event.event_type).endsWith('-test')) {
return Response.json({ ok: true });
}
const label =
event.event_type === 'Complaint' ? 'spam complaint' : 'bounce';
await fetch(process.env.SLACK_WEBHOOK_URL!, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
text: `⚠️ ${label} for ${event.destination} from ${event.source} (scoped ${event.domain})`
})
});
return Response.json({ ok: true });
}
Create the Notify subscription:
curl -X POST https://notify.cx/api/webhooks \
-H "Content-Type: application/json" \
-H "x-api-key: $NOTIFY_API_KEY" \
-d '{
"webhookUrl": "https://your-app.com/api/notify-slack",
"subscribedEvents": ["Bounce", "Complaint"],
"domainId": "YOUR_VERIFIED_DOMAIN_UUID"
}'