Netlify

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

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.
  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

3. URL Construction

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

Generate Webhook URL
GET POST
https://api.thealerthub.com/sendAlert?ah_key=YOUR_KEY&ah_source=Netlify&ah_title=Netlify%3A+%7B%7Bstate%7D%7D&ah_level=warning&ah_description=Deploy+for+branch+**%7B%7Bbranch%7D%7D**+is+**%7B%7Bstate%7D%7D**.+Context%3A+%7B%7Bcontext%7D%7D.+URL%3A+%7B%7Bdeploy_ssl_url%7D%7D

Check the Netlify docs 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

[[plugins]]
  package = "/plugins/alerthub"

plugins/alerthub/index.js

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"
      })
    });
  }
};