---
title: "Netlify"
description: "Send Netlify deploy failed or succeeded alerts to Slack, Telegram, WhatsApp, or email via outgoing webhooks."
order: 4
---

You can configure Netlify to send alerts to AlertHub when a deployment fails.

import WebhookWidget from '../../../../components/WebhookWidget.astro';

You can configure Netlify to send alerts to AlertHub using outgoing webhooks. This allows you to receive notifications for build statuses without modifying your code.

## Method 1: Outgoing Webhook (Simple)

### 1. Get your Project Key
1. Go to your [AlertHub Project Settings](https://app.thealerthub.com/projects).
2. Copy your **Key**.

### 2. Add the Webhook in Netlify
1. Go to your Project configuration in Netlify.
2. Navigate to **Project configuration > Notifications**.
3. Click **Add Notification** and select **HTTP POST request**.
4. **Event to listen for:** Choose `Deploy failed`, `Deploy succeeded`, or `Deploy started`.
5. **URL to notify:** Use the URL generator below.


![Add notifications from Netlify to AlertHub](../../../../assets/images/blog/Add_notifications_from_Netlify_to_alerthub.png)


### 3. URL Construction

Use the following configuration to receive detailed alerts about your deployments.

<WebhookWidget 
  title="Netlify: {{state}}"
  source="Netlify"
  level="warning"
  desc="Deploy for branch **{{branch}}** is **{{state}}**. Context: {{context}}. URL: {{deploy_ssl_url}}"
/>

**Check the [Netlify docs](https://docs.netlify.com/site-deploys/notifications/#outgoing-webhooks) for more available data fields.**

## Method 2: Netlify Build Plugin (Advanced)

For a cleaner integration, you can create a local plugin `plugins/alerthub/index.js` and reference it in `netlify.toml`.

**netlify.toml**
```toml
[[plugins]]
  package = "/plugins/alerthub"
```

**plugins/alerthub/index.js**
```javascript
module.exports = {
  onError: async ({ error, utils }) => {
    const fetch = require('node-fetch');
    await fetch('https://api.thealerthub.com/sendAlert', {
      method: 'POST',
      body: JSON.stringify({
        ah_key: process.env.ALERTHUB_KEY,
        ah_title: "Netlify Build Error",
        ah_description: error.message,
        ah_level: "error",
        ah_source: "Netlify"
      })
    });
  }
};
```
