# Alerts ## List events - [GET /v1/alerts/events](https://documentation.mailgun.com/docs/inboxready/api-reference/openapi-final/alerts/get-v1-alerts-events.md): The current list of events that you can chose to receive alerts for. ## Add Alert - [POST /v1/alerts/settings/events](https://documentation.mailgun.com/docs/inboxready/api-reference/openapi-final/alerts/post-v1-alerts-settings-events.md): Use this endpoint to add new alert settings record. ### Webhooks This section covers details around consuming Mailgun Optimize alerts via webhooks. If you are familiar with Mailgun Send webhooks, there is a lot of overlapping similarity, however, there are also a few minor nuances to account for. #### Securing Webhooks HMAC is used to verified to integrity as well as the authenticity of received webhooks. To verify the origin of a webhook: 1. Encode the webhook’s entire POST request body with the HMAC algorithm (using your webhook signing key and SHA256 digest mode) 2. Compare the resulting hexdigest to the signature provided in the POST request’s X-Sign header. NOTE: If you’re consuming Mailgun Send webhooks, please note that your Mailgun Send webhook signing key differs from your Mailgun Optimize alerts webhook signing key. Your Mailgun Optimize alerts webhook signing key is available within the Mailgun Optimize UI. #### Webhook URL Validation When adding or updating a webhook URL for alerts, we will ensure the endpoint is reachable by sending a GET request to the provided URL. If a 200 response is not returned from your endpoint, the request will be rejected and your alert setting will not be saved. We intentionally chose to send a GET request instead of a POST when validating URLs so that your webhook endpoint does not have to account for test requests. Additionally, when a POST request is sent to your webhook URL, if a 2xx is not returned, we will attempt retries via an exponential backoff strategy for up to ~8 hours. If the max retry count is reached, the alert will be disabled and the related alert settings record’s disabled_at field will be populated. ## Update Alert - [PUT /v1/alerts/settings/events/{id}](https://documentation.mailgun.com/docs/inboxready/api-reference/openapi-final/alerts/put-v1-alerts-settings-events--id-.md): Use this endpoint to update an existing alert setting record. NOTE: When updating a webhook alert, we will ensure the endpoint is reachable by sending a GET request to the provided URL. If a 200 response is not returned, a 400 will be returned and the alert setting update will be rejected. ## Remove Alert - [DELETE /v1/alerts/settings/events/{id}](https://documentation.mailgun.com/docs/inboxready/api-reference/openapi-final/alerts/delete-v1-alerts-settings-events--id-.md) ## List Alerts - [GET /v1/alerts/settings](https://documentation.mailgun.com/docs/inboxready/api-reference/openapi-final/alerts/get-v1-alerts-settings.md): This endpoint returns a list of all configured alert settings for your account. ## Update Slack settings - [PUT /v1/alerts/settings/slack](https://documentation.mailgun.com/docs/inboxready/api-reference/openapi-final/alerts/put-v1-alerts-settings-slack.md) ## Delete Slack settings - [DELETE /v1/alerts/settings/slack](https://documentation.mailgun.com/docs/inboxready/api-reference/openapi-final/alerts/delete-v1-alerts-settings-slack.md): Delete Slack settings and Slack event settings for the Mailgun account. To revoke the Slack access token, use DELETE /v1/alerts/slack/oauth. To completely remove the Slack App from Slack Workspace, go into App Configuration in Slack. ## Reset Webhook Signing Key - [PUT /v1/alerts/settings/webhooks/signing_key](https://documentation.mailgun.com/docs/inboxready/api-reference/openapi-final/alerts/put-v1-alerts-settings-webhooks-signing-key.md) ## Test webhook - [POST /v1/alerts/webhooks/test](https://documentation.mailgun.com/docs/inboxready/api-reference/openapi-final/alerts/post-v1-alerts-webhooks-test.md): Sends test webhook request to specified url with dummy data. ## Test message - [POST /v1/alerts/email/test](https://documentation.mailgun.com/docs/inboxready/api-reference/openapi-final/alerts/post-v1-alerts-email-test.md): Sends test message to emails with dummy data. ## Test message - [POST /v1/alerts/slack/test](https://documentation.mailgun.com/docs/inboxready/api-reference/openapi-final/alerts/post-v1-alerts-slack-test.md): Sends test message to slack channels with dummy data. ## Revoke Slack access token - [DELETE /v1/alerts/slack/oauth](https://documentation.mailgun.com/docs/inboxready/api-reference/openapi-final/alerts/delete-v1-alerts-slack-oauth.md): Revoke Slack access token, delete Slack settings and Slack event settings. NOTE: All Mailgun accounts connected to the same Slack workspace share the same token. To completely remove the Slack App from Slack Workspace, go into App Configuration in Slack. ## Get Slack channel - [GET /v1/alerts/slack/channels/{id}](https://documentation.mailgun.com/docs/inboxready/api-reference/openapi-final/alerts/get-v1-alerts-slack-channels--id-.md): Returns Slack channel. ## List Slack channels - [GET /v1/alerts/slack/channels](https://documentation.mailgun.com/docs/inboxready/api-reference/openapi-final/alerts/get-v1-alerts-slack-channels.md): List Slack channels for the connected Slack workspace.