Overview
Webhooks allow you to receive real-time HTTP notifications when events occur in your MailGreet account. Instead of polling the API for updates, webhooks push data to your server automatically.Webhooks are delivered as HTTP POST requests with a JSON payload to your specified endpoint URL.
Setting Up Webhooks
1. Create a Webhook Endpoint
Set up an endpoint on your server to receive webhook notifications:Node.js (Express)
Python (Flask)
PHP
2. Register Your Webhook
In your MailGreet dashboard:- Navigate to Settings → Integrations → Webhooks
- Click “Add Webhook”
- Enter your endpoint URL
- Select the events you want to receive
- Save your webhook configuration
Webhook Events
Email Events
email.delivered
email.delivered
Triggered when an email is successfully delivered to the recipient’s mail server.
email.opened
email.opened
Triggered when a subscriber opens an email (tracked via pixel).
email.clicked
email.clicked
Triggered when a subscriber clicks a link in an email.
email.bounced
email.bounced
Triggered when an email bounces (hard or soft bounce).
email.complained
email.complained
Triggered when a subscriber marks an email as spam.
Subscriber Events
subscriber.created
subscriber.created
Triggered when a new subscriber is added.
subscriber.unsubscribed
subscriber.unsubscribed
Triggered when a subscriber unsubscribes.
Webhook Security
Verifying Webhook Signatures
All webhook requests include a signature header for verification:Node.js
Best Practices
Respond Quickly
Always respond with a 200 status within 5 seconds. Process webhooks asynchronously if needed.
Idempotency
Design your webhook handler to handle duplicate deliveries gracefully using the message_id.
Retry Logic
MailGreet retries failed webhooks up to 3 times with exponential backoff.
Logging
Log all webhook events for debugging and audit purposes.
Retry Schedule
If your endpoint fails to respond with a 2xx status, MailGreet will retry:| Attempt | Delay |
|---|---|
| 1st retry | 1 minute |
| 2nd retry | 5 minutes |
| 3rd retry | 30 minutes |

