Webhooks
With webhooks, Mailiqo notifies your server when an email is delivered, bounces, gets a complaint, is rejected or fails. Instead of asking the API for the status of each message, you receive a POST request with the event as soon as it happens.
How it works
- You add your server's URL — the endpoint — to a sending domain, from the panel.
- For each email sent from that domain, Mailiqo sends a
POSTto that URL with a JSON describing what happened. - Your server verifies the signature, answers
2xxand processes the event.
Each endpoint belongs to one sending domain and receives the events of the emails sent with that domain, over the API and over SMTP alike. The number of endpoints per domain depends on your plan: today it is one on every plan.
Events
| Event | When it is sent |
|---|---|
email.delivered | The recipient's mail server accepted the message |
email.bounced | The destination server returned the message |
email.complained | The recipient marked the message as spam |
email.rejected | The message was discarded before being sent |
email.failed | The message could not be sent because of a technical problem |
You choose which events each endpoint receives. What each one contains is in Events.
In addition, from the panel you can send an endpoint.ping to check the connection with your server. It does not depend on the events you have chosen.
Opens and clicks do not produce an event: check them in the panel or with GET /email-message/{id}.
Set up an endpoint
- In the panel, go to Email → Domains and pick the domain.
- Open the Webhooks tab and, under Production, click Add webhook.
- Enter your server's URL and tick the events you want to receive.
- On saving, the signing secret is shown; it starts with
whsec_. Copy it then: it is not shown again.
Your server uses that secret to check that each request comes from Mailiqo. See Verify signatures.
To build your integration without touching production, the same tab has a Testing section with its own secret. See Testing.
URL requirements
- It starts with
https://. Any port is accepted. - It is a public domain name with a valid TLS certificate. IP addresses, credentials inside the URL and names that point to private or local addresses are not accepted.
- It is at most 1,024 characters long.
Redirects are not followed: a 3xx response counts as a failure. Configure the final URL.
What your server must do
- Verify the signature before trusting the content.
- Answer with a
2xxstatus in under 10 seconds. Any other response, a connection error or a slower response counts as a failure, and the event is retried. If processing takes time, put the event on a queue and answer before processing it. - Accept duplicates. The same event can arrive more than once. The
webhook-idheader is the same on every attempt: use it to drop the ones you have already processed. - Not rely on order. Events can arrive out of order. The
timestampfield says when each one happened. - Ignore what it does not know. New fields can appear in the JSON, and so can new event types. Answer
2xxto the types you do not use as well.
The body of your response is not used. Its first 500 bytes are kept in the delivery log in the panel, to help you debug.
If your server answers 410 Gone, Mailiqo takes it that the endpoint no longer exists: it disables it and stops sending it events.
What you can expect from Mailiqo
- Each event is delivered at least once. If your server fails, it is retried for about 24 hours. See Retries and failures.
- Format changes are additive: fields and event types can be added, but the existing ones are not removed and do not change meaning.
- The IP addresses the events come from can change. Do not filter by IP: use the signature.
Next steps
- What each event contains → Events
- Check that a request comes from Mailiqo → Verify signatures
- What happens when your server does not answer → Retries and failures
- Test your integration, locally too → Testing
