Send UniFi Alerts to Slack (with One-Click Acknowledge)

A Pro guide. This post contains affiliate links; if you buy through them we may earn a small commission at no extra cost to you.

If you run a Ubiquiti UniFi network, you already know the alerts pile up — a device goes offline, a WAN link flaps, a firmware update is ready. The problem is that those alerts sit in the UniFi console or an email inbox nobody watches. This guide shows how I route UniFi alerts into a Slack channel where the team actually sees them, with a one-click Acknowledge button so everyone knows when an alert has been picked up.

How it works (the architecture)

UniFi has no native Slack integration, so we use a small relay in the middle:

  • UniFi emits alerts (via the Network API, syslog, or email).
  • A relay service (a small script) catches each alert and posts it to Slack with an “Acknowledge” button.
  • Slack shows the alert in your channel. When someone clicks Acknowledge, Slack calls your relay back, which updates the message to show who ack’d it and when.

Step 1: Get alerts out of UniFi

Pick whichever fits your setup. The simplest reliable option is to poll the UniFi Network API for new alarms on a short interval and forward anything new. Alternatively, point UniFi’s remote syslog at your relay host, or forward UniFi alert emails to a parser. (Exact menus vary by UniFi OS version, so check your controller’s Settings → System / Notifications.)

Step 2: Set up the Slack side

  • Create a Slack app at api.slack.com/apps.
  • Add a Bot Token with the chat:write scope, and install it to your workspace.
  • Turn on Interactivity and set the Request URL to your relay’s public endpoint (e.g. https://your-relay/slack/actions). This is what makes the Acknowledge button work.
  • Invite the bot to your alerts channel (e.g. #network-alerts).

Step 3: Post the alert to Slack (with an Acknowledge button)

This Python snippet posts a UniFi alert to Slack as a Block Kit message with a primary “Acknowledge” button:

import requests

SLACK_BOT_TOKEN = "xoxb-your-bot-token"
CHANNEL = "#network-alerts"

def post_alert(text, alert_id):
    requests.post(
        "https://slack.com/api/chat.postMessage",
        headers={"Authorization": f"Bearer {SLACK_BOT_TOKEN}"},
        json={
            "channel": CHANNEL,
            "text": f"UniFi Alert: {text}",
            "blocks": [
                {"type": "section",
                 "text": {"type": "mrkdwn", "text": f":rotating_light: *UniFi Alert*\n{text}"}},
                {"type": "actions", "elements": [
                    {"type": "button",
                     "text": {"type": "plain_text", "text": "Acknowledge"},
                     "style": "primary",
                     "action_id": "ack",
                     "value": alert_id}
                ]}
            ]
        }
    )

Step 4: Handle the Acknowledge click

When someone clicks the button, Slack POSTs an interaction payload to your Request URL. This small Flask handler updates the original message to show who acknowledged it:

import json, requests
from flask import Flask, request

app = Flask(__name__)

@app.route("/slack/actions", methods=["POST"])
def actions():
    payload = json.loads(request.form["payload"])
    user = payload["user"]["username"]
    original = payload["message"]["text"]
    # Replace the message (and its button) with an acknowledged note
    requests.post(payload["response_url"], json={
        "replace_original": True,
        "text": f":white_check_mark: {original} - acknowledged by @{user}"
    })
    return "", 200

That is the whole trick: the button carries the alert ID, and on click your relay rewrites the message so the channel can instantly see it is handled. (For production, verify Slack’s request signature and keep a small record of which alerts were ack’d.)

Tips for running it

  • Run the relay on something always-on — a small home server, a Raspberry Pi, or a cheap cloud VM.
  • De-duplicate alerts so a flapping device does not spam the channel.
  • Add severity colors or @-mentions for critical alerts (WAN down) vs. informational ones.

The gear

This setup works with any UniFi controller — a Dream Machine/Dream Router, a Cloud Key, or self-hosted. If you are building out a UniFi network, the console I run this on is the UniFi Dream Machine Pro Max on Amazon — it is the gateway, controller, and NVR in one box.

That is it — noisy UniFi alerts become a tidy, acknowledge-able Slack feed your whole team can act on.

Scroll to Top