Workflow: Anthem Network uptime Notifications

Monitoring Source:
This workflow is triggered by webhook events sent from Uptime Kuma, a self-hosted monitoring system. When a monitored service changes state (UP or DOWN), Uptime Kuma sends a JSON payload to this webhook endpoint, which then processes the data and forwards formatted notifications to Slack.

Purpose: Receive Uptime Kuma status webhooks and post Slack alerts for DOWN and UP events.


Nodes

1) Webhook

  • Type: Webhook (Trigger)
  • What it’s for: Entry point that receives the POST request from Uptime Kuma.
  • Endpoint path: POST /webhook/Anthemnetworkstatus
  • Expected payload: JSON with body.heartbeat and body.monitor

2) Code in JavaScript

  • Type: Code
  • What it’s for: Converts the raw Uptime Kuma webhook payload into clean fields used by the rest of the workflow.
  • Key logic:
    • Reads:
- `body.heartbeat` (status, ping, time, msg)
- `body.monitor` (name, hostname/url/type)
  • Creates:
- `isDown` → `true` when `heartbeat.status === 0` (Kuma: 0=DOWN, 1=UP)
- `name` → monitor name
- `hostnameOrURL` → monitor hostname/url fallback
- `time` → heartbeat time (fallback: now)
- `status` → `"Down"` or `"Up"`
- `msg` → human readable summary string
  • Also passes through:
- `heartbeat`
- `monitor`

3) If

  • Type: IF (Condition)
  • What it’s for: Routes the workflow based on the status.
  • Condition:{{$json.isDown}} is true
    • True path (DOWN) → goes to Only if go Down
    • False path (UP) → goes to Only if go up1

4) Only if go Down

  • Type: HTTP Request (POST to Slack Incoming Webhook)
  • What it’s for: Sends a DOWN alert to Slack when isDown=true.
  • Message formatting:
    • Title/header: “🚨 Service is DOWN”
    • Color: #e01e5a (red)
    • Includes fields: Service, Status, Target, Time
    • Includes details from heartbeat message / built msg

5) Only if go up1

  • Type: HTTP Request (POST to Slack Incoming Webhook)
  • What it’s for: Sends an UP alert to Slack when isDown=false.
  • Message formatting:
    • Title/header: “✅ Service is UP”
    • Color: #2eb886 (green)
    • Includes fields: Service, Status, Target, Time
    • Includes message block with the formatted msg

Connections (flow)

Webhook → Code in JavaScript → If →

  • True (DOWN) → Only if go Down
  • False (UP) → Only if go up1

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Secret Link