Webhook for Alerts

Radio Mast can send a webhook to your website when your radio stream goes down, so you can build your own custom integrations.

This page explains the technical details of the webhook requests so you know what to expect and can build your integration accordingly. For information about alerting in general, see Alerting.

To add a webhook, visit your Alerting page, and click "Add Contact". After adding a webhook, remember to add it to an Alert Policy so that it gets triggered.

Webhook Request Specification

Radio Mast will send an HTTP POST request a stream goes down or comes back online. The POST request will contain a JSON-encoded body with the following fields:

  • timestamp - A UNIX timestamp in UTC of when this event was created
  • summary - A simple text description of the event.
  • event - A dictionary containing:
    • type - A string defining the event type. Will be down if the stream is down, and up if the stream is up.
    • stream - (Optional - See note below) A dictionary containing:
      • id - The UUID of the stream
      • name - The name of the stream
      • listening_url - The stream URL that was monitored
      • silence - (Optional) A boolean indicating if silence was detected. Will only be included if silence detection is enabled for this stream.
    • station - A dictionary containing:
      • id - The UUID of the station the stream belongs to
      • name - The name of the radio station the stream is from

Note about the optional stream field: If an alert policy is set to only send notifications when all streams are down, then the stream field in a webhook will be set to null.

An example JSON body from an alert webhook POST is as follows:

{
    "timestamp": 1579728021,
    "summary": "Example FM Alert: Stream 1 is down",
    "event": {
        "type": "down",
        "stream": {
          "id": "6ffd5f90-64dd-421d-b48a-349eee8ca535",
          "name": "Stream 1",
          "listening_url": "http://yourstreamexample.com/mount",
          "silence": true
        },
        "station": {
          "id": "fd75e020-9569-4e9a-af3f-a8e1ea9c87d3",
          "name": "Example FM" 
        }       
    }
}

Your web application should respond with an HTTP 200 OK response.