> For the complete documentation index, see [llms.txt](https://docs.mailtrap.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mailtrap.io/inbound-email/webhooks.md).

# Webhooks

Step-by-step guide to setting up Mailtrap Inbound Email webhooks for real-time new-message notifications, signature verification, and delivery retries.

In this article, you'll learn how to configure Mailtrap webhooks to get notified about every new message you receive in your inbound email inbox.

### How it works

When a new email arrives, Mailtrap POSTs a JSON payload to your webhook URL. The payload includes an `events` array where each object contains the event (`inbound.message_received`), a unique event ID, a Unix timestamp, the inbox ID, the Mailtrap message ID, and the sender name.

Payloads are signed with HMAC-SHA256 via the `mailtrap-signature` header so you can verify they came from Mailtrap.

{% hint style="info" %}
Failed deliveries are retried every 5 minutes, for up to 40 attempts. The same retry schedule applies to outbound webhooks.
{% endhint %}

#### Step 1. Either [create your webhook via API](https://docs.mailtrap.io/developers/email-sending/webhooks) or go to [Mailtrap webhooks](https://mailtrap.io/webhooks), click on Create New Webhook

#### Step 2. Add your Webhook URL, select Inbound Inboxes, and select your Inbox

<div align="left" data-with-frame="true"><figure><img src="https://1476453098-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS3xyr7ba7aGO19rc8dSK%2Fuploads%2FnV9q0gTbaFn49FBpJwce%2FSCR-20260926-pyrm.png?alt=media&amp;token=9cc71120-c524-4171-a577-54fc6f1b56ea" alt="" width="563"><figcaption></figcaption></figure></div>

#### Step 3. Once you receive a message in your Inbound Inbox, you should see the following output from your webhook:

<figure><img src="https://1476453098-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS3xyr7ba7aGO19rc8dSK%2Fuploads%2FvVQJhC4x0ncYQf7KpyPe%2Fwebhook%202.png?alt=media&amp;token=61f20768-2752-4d5d-976b-0e69197d3b78" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mailtrap.io/inbound-email/webhooks.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
