This API allows you to create, access, and delete webhooks programmatically.
Supported webhooks, and their documentation, are listed below:
Webhook Name | Documentation |
---|---|
bounce | um-tracking-bounces |
deliver |
|
drop |
|
spam | um-tracking-spam-complaints |
unsubscribe | um-tracking-unsubscribes |
click | um-tracking-clicks |
open | um-tracking-opens |
GET /domains/<domain>/webhooks
Returns a list of webhooks set for the specified domain.
Parameter | Description |
---|---|
domain | Name of the domain |
GET /domains/<domain>/webhooks/<webhookname>
Returns details about a the webhook specified in the URL.
Parameter | Description |
---|---|
domain | Name of the domain |
id | Name of the webhook. (See above for supported webhooks) |
POST /domains/<domain>/webhooks
Creates a new webhook.
Note
When adding a Click or Open webhook, ensure that you also have tracking enabled.
Parameter | Description |
---|---|
domain | Name of the domain |
id | Name of the webhook. (See above for supported webhooks) |
url | URL for the webhook event. |
PUT /domains/<domain>/webhooks/<webhookname>
Updates an existing webhook.
Parameter | Description |
---|---|
domain | Name of the domain |
id | Name of the webhook. (See above for supported webhooks) |
url | URL for the webhook event. |
DELETE /domains/<domain>/webhooks/<webhookname>
Deletes an existing webhook.
Note
Mailgun imposes a rate limit for the Webhook API endpoint. Users may issue no more than 300 requests per minute, per account. See the resultant rate limit response below.
Parameter | Description |
---|---|
domain | Name of the domain |
id | Name of the webhook. (See above for supported webhooks) |
Return a list of webhooks set for the specified domain.
Sample response:
{
"webhooks": {
"open": {
"url": "http://postbin.heroku.com/860bcd65"
},
"click": {
"url": "http://postbin.heroku.com/860bcd65"
}
}
}
Return a webhook for a specific event for the defined domain.
Sample response:
{
"webhook": {
"url": "http://google.com"
}
}
Create a new webhook.
Sample response:
{
"message": "Webhook has been created",
"webhook": {
"url": "http://bin.mailgun.net/8de4a9c4"
}
}
Update an existing webhook.
Sample response:
{
"message": "Webhook has been updated",
"webhook": {
"url": "http://google.com"
}
}
Delete a webhook.
Sample response:
{
"message": "Webhook has been deleted",
"webhook": {
"url": "http://postbin.heroku.com/860bcd65"
}
}
Rate Limit Response:
{
"retry-seconds": 60,
}