Webhooks can either be configured at the domain level or at the account level, enabling you to set unique endpoints for each domain or fire an event for any of your domains/subaccounts to simplify setup. Each event type is configured individually and can contain up to 3 URLs per event type.
We recommend using http://bin.mailgun.net/ for creating temporary URLs to test and debug your webhooks.
Domain-level webhooks will only fire when an event happens for the domain they are configured for.
Account-level webhooks will trigger when an event happens on any of the domains belonging to that account. If the account has one or more subaccounts, a webhook will also trigger when an event occurs on those subaccounts.
US and EU regions are isolated, meaning you will need to create webhooks in each for the account/domains in their respective region.
If you configure the same URL for the same event at both the domain level and account level, Mailgun treats that as a duplicate and will only send the event once. This prevents your endpoint from receiving multiple copies of the same event. Here are some other considerations:
- Deduplication: Events are delivered once to each unique URL configured at any level. If the same URL is configured at domain and account level, Mailgun will only send the event once.
- Account inheritance: Configuration is inherited downward only. If an account-level webhook is configured on a parent account and an event happens on a domain that belongs to a subaccount, the account-level webhook will fire. It is not possible to suppress events from inherited configuration. So if, for the same event type, the parent account and the subaccount each have a webhook set to different URLs, both URLs will receive the event.
- Scope isolation: A webhook configured on a subaccount applies only to the domains within that same subaccount. It does not fire for domains that belong to the parent account directly or to a sibling subaccount under the same parent.