#!/bin/sh
# Run with: sh test-webhook.sh (from the extracted download folder).
# Requires curl. Nothing is installed or changed on your Home Assistant.
set -eu
cd "$(dirname "$0")"
printf 'Paste your private webhook URL (input is visible; do not screen-share): '
IFS= read -r webhook_url
case "$webhook_url" in
  https://*|http://*) ;;
  *) printf '%s\n' 'Expected a full http:// or https:// webhook URL.' >&2; exit 1 ;;
esac
curl --fail --silent --show-error --max-time 20 \
  --request POST --header 'Content-Type: application/json' \
  --data-binary @test-reminder.json --url "$webhook_url"
printf '\nRequest sent. Check the automation trace AND the destination notification.\nAn HTTP success response alone does not prove that Home Assistant ran the automation.\nTesting also obeys the blueprint notification hours.\n'
