#!/bin/bash set -e MIDDLEWARE_URL="https://localhost:8080" TEST_TOPIC="test-topic" echo "๐Ÿงช Testing Slack to ntfy middleware..." # Check if service is running echo "Checking if middleware is running..." if ! curl -k -s "$MIDDLEWARE_URL/health" > /dev/null; then echo "โŒ Middleware is not running on $MIDDLEWARE_URL" echo "Please start it with: docker compose up -d" exit 1 fi echo "โœ… Middleware is running" # Test health endpoint echo "Testing health endpoint..." HEALTH_RESPONSE=$(curl -k -s "$MIDDLEWARE_URL/health") echo "Health response: $HEALTH_RESPONSE" # Test Slack webhook format echo "Testing Slack webhook format..." curl -k -X POST "$MIDDLEWARE_URL/$TEST_TOPIC" \ -H 'Content-Type: application/json' \ -d '{"text": "๐Ÿงช Test alert from Slack to ntfy middleware test script"}' \ -w "\nHTTP Status: %{http_code}\n" # Test plain text format echo "Testing plain text format..." curl -k -X POST "$MIDDLEWARE_URL/$TEST_TOPIC" \ -H 'Content-Type: text/plain' \ -d 'Plain text test alert' \ -w "\nHTTP Status: %{http_code}\n" echo "โœ… Tests completed!" echo "Check your ntfy client to see if messages were delivered to topic: $TEST_TOPIC"