main
 1#!/usr/bin/env bash
 2# Handle incoming ntfy notification
 3# This script is called by ntfy for each incoming message
 4# It stores the message details and displays the notification
 5
 6set -euo pipefail
 7
 8# Store message details for later acknowledgment
 9STATEFILE="/tmp/ntfy-last-message"
10
11# These variables (topic, id, title, message) are provided by ntfy as environment variables
12# shellcheck disable=SC2154
13cat >"$STATEFILE" <<EOF
14TOPIC=$topic
15ID=$id
16TITLE=$title
17MESSAGE=$message
18EOF
19
20# Display notification via mako
21# shellcheck disable=SC2154
22notify-send -a ntfy "$title" "$message"