Notify API v0.2

Self-hosted push notification service

Push Message

POST/api/messages

Send a notification to all connected clients.

curl -X POST /api/messages \
  -H "Authorization: <token>" \
  -H "Content-Type: application/json" \
  -d '{"tag":"deploy", "title":"Deployed", "content":"v1.2.3 is live"}'
FieldTypeRequiredDescription
titlestring*Message title
contentstring*Message body
tagstringNoTag for filtering

At least one of title or content is required.

Response:

{"id":"abc123","tag":"deploy","title":"Deployed","content":"v1.2.3 is live","timestamp":1711700000}

Subscribe (SSE Stream)

GET/api/stream

Long-lived Server-Sent Events connection for real-time push.

curl -N http://server:8083/api/stream

Events:

: connected

id: abc123
event: message
data: {"id":"abc123","tag":"deploy","title":"Deployed","content":"v1.2.3","timestamp":1711700000}

: keepalive

Keepalive sent every 30s by default (configurable via -keepalive). Client should auto-reconnect on disconnect.

Message History

GET/api/messages

Returns last 100 messages as JSON array.

ParamDescription
afterMessage ID — returns only messages after this ID (for catch-up)
curl http://server:8083/api/messages?after=abc123

Health Check

GET/health

{"status":"ok"}

Authentication

Push requires token via Authorization header or ?token= query param.
Subscribe and history endpoints are public.

Errors

StatusMeaning
400Invalid request body
401Missing or invalid token