MailSlurp logo

Receive email in your application with webhooks

Create a real inbox, attach an HTTP endpoint, and let MailSlurp post a typed event when email arrives. Store the event and message IDs, fetch the full body or attachments by API, and keep delivery history available for retries and investigation.

Create an inbox webhook in the MailSlurp dashboard

Trusted by top companies worldwide

  • Broadcom
  • Scraper
  • Trivago
  • Avast
  • Wolt
  • Panasonic
  • Broadcom
  • Scraper
  • Trivago
  • Avast
  • Wolt
  • Panasonic

Handle inbound email events in TypeScript

Validate the incoming event, acknowledge it promptly, and move parsing or business actions into a retry-safe worker. Fetch the complete email record by API when the handler needs message bodies, headers, links, or attachments.

A reliable email-to-webhook contract

Keep the first request small and make the stored MailSlurp message the recoverable source for every downstream action.

Email webhook vs inbound email API

An email webhook is the push notification that tells your application a message arrived. The inbound email API provides the inbox, message retrieval, attachments, search, and replay controls around that notification. Production systems normally use both.

Store identifiers before running business logic

Persist the event ID, inbox ID, and message ID, return a success response, then enqueue parsing, CRM updates, ticket creation, or document processing. Treat the event ID as an idempotency key so a retry cannot create the same downstream record twice.

Fetch content and attachments when the worker needs them

Keep the webhook payload bounded. Workers can retrieve the complete HTML and text body, headers, links, and attachments through the API, then hand the message toAI email extraction, support routing, or an operations pipeline.

Make failures visible and recoverable

Failed webhook deliveries retry automatically for 24 hours before exhausted results move to a dead-letter queue. Review delivery history, fix the endpoint, then manually redrive one failed result or all failed results. Use the inbound email routing solutionwhen one mailbox needs aliases, queues, review lanes, or multiple destinations.

Complete the workflow with a controlled reply

After the worker retrieves the message, validates attachments, and completes parsing or routing, send the response from the MailSlurp inbox that received the email. Store the outbound message ID beside the inbound event so support, order, and finance workflows keep a traceable receive-to-reply record.

Inbound email webhook questions

Direct answers for choosing and operating the event-delivery layer.

How can my application receive email with a webhook?

Create a MailSlurp inbox, register your HTTPS endpoint for new-email events, and store the event and message IDs when MailSlurp posts the payload. Retrieve the full message or attachments through the API when processing begins. Open the webhook documentation.

Is an email webhook the same as an inbound email API?

No. The webhook pushes an arrival event to your application. The inbound email API provides inbox creation, message retrieval, attachments, search, routing, and fallback access around that event. Explore the inbound email API.

What should an email webhook handler return?

Validate and persist the event, return a successful 2xx response promptly, and move slow parsing or business actions into a worker. This reduces delivery timeouts and makes retries safer.

How does MailSlurp retry a failed webhook?

MailSlurp automatically retries failed webhook deliveries for 24 hours before moving exhausted results to a dead-letter queue. You can inspect delivery history and manually redrive an individual failed result or all failed results after the endpoint recovers.

Can MailSlurp webhooks handle email attachments?

Yes. The event identifies the received email so your worker can fetch attachment metadata and content through the API before storing, validating, parsing, or routing the files.

How do I prevent duplicate processing after a retry?

Persist the webhook event ID and enforce idempotency before creating downstream records. A repeated delivery can then acknowledge the existing event without repeating the business action.