Slack to ntfy Middleware
A lightweight Go service that acts as a middleware between Slack webhooks and ntfy servers, with Bearer token authentication and basic authentication support.
Features
- ✅ Parses Slack webhook format
- ✅ Forwards alerts to self-hosted ntfy servers
- ✅ Bearer token authentication support
- ✅ Health check endpoint
- ✅ Lightweight Docker container (~8.4MB)
- ✅ High performance and low resource usage
Quick Start
-
Configure the service:
# Edit docker-compose.yml and set: # - NTFY_BASE_URL=https://your-ntfy-server.com # - NTFY_TOKEN=tk_your_bearer_token # OR # - NTFY_USERNAME=your_username # - NTFY_PASSWORD=your_password -
Run the service:
docker compose up -d -
Configure Slack:
- Go to Slack Integrations → Incoming Webhooks
- Add new webhook
- Webhook URL:
http://your-server-ip:8080/your-topic-name
-
Test the service:
# Test webhook curl -X POST http://localhost:8080/test-topic \ -H 'Content-Type: application/json' \ -d '{"text": "Test alert from Slack to ntfy"}' # Check health curl http://localhost:8080/health
Configuration
| Environment Variable | Default | Description |
|---|---|---|
NTFY_BASE_URL |
https://ntfy.sh |
Your ntfy server URL (without topic) |
NTFY_TOKEN |
"" |
Bearer token for ntfy authentication |
NTFY_USERNAME |
"" |
Username for ntfy basic authentication |
NTFY_PASSWORD |
"" |
Password for ntfy basic authentication |
BIND_ADDRESS |
0.0.0.0 |
Interface to bind to |
BIND_PORT |
8080 |
Port to listen on |
Development
Build locally
make build
make run
Build Docker image
make docker-build
Run tests
make test
License
MIT License
Languages
Go
50.7%
Shell
32.5%
Makefile
10.9%
Dockerfile
5.9%