# Anthos Notifications Manager

Send Slack and email notifications to Anthos employees from any internal app.

## Auth

Every producer app has its own API key. Send it as the `X-API-Key` header.
Ask an admin to add your app (one env edit, no deploy).

## Send your first notification (minimal)

```bash
curl -X POST $BASE_URL/v1/notifications \
  -H "X-API-Key: $YOUR_KEY" -H "Content-Type: application/json" \
  -d '{"body": "Deploy finished ✅"}'
```

With no recipients, it posts to your app's default Slack channel.

## Full payload — POST /v1/notifications

```jsonc
{
  "title": "Sync failed",                     // optional; email subject / header
  "body": "Forge sync **failed**.",           // required; markdown
  "channels": ["slack", "email"],             // optional; default ["slack"]
  "recipients": [                              // optional; bare strings are inferred
    "ana@anthoscapital.com",                   // email => Slack DM and/or email
    "#forge-alerts",                           // channel post
    {"email": "bo@anthoscapital.com"},
    {"slackChannel": "C0123456789"}
  ],
  "blocks": [],                                // optional; raw Slack Block Kit
  "idempotencyKey": "sync-fail-2026-06-11",   // optional; dedupes replays
  "scheduledAt": "2026-06-12T09:00:00Z"       // optional; delays delivery
}
```

Responses: `202` accepted (returns the notification + planned deliveries),
`200` replay of an existing idempotencyKey, `400` with precise per-field
`issues` you can fix and retry, `401` bad/missing API key.

## History

`GET /v1/notifications?source=&status=&recipient=&channel=&from=&to=&page=&pageSize=`
and `GET /v1/notifications/:id` — auth with an API key or a Clerk session
token (Authorization: Bearer).

Valid `status` values: `pending`, `processing`, `sent`, `partial`, `failed`.
Valid `channel` values: `slack_dm`, `slack_channel`, `email`.
`from` and `to` take ISO 8601 dates, e.g. `2026-06-11T00:00:00Z`.

## Machine-readable spec

OpenAPI JSON at `/openapi.json`, Swagger UI at `/docs`.
This guide is also served at `/llms.txt`.
