Send a weekly digest to Slack
POST /api/v1/weekly-report collects everything published in the last seven days, groups it by project and posts one message. dry=1 returns the message instead of sending it, no publications means no message, a missing webhook answers 501 instead of failing quietly. scripts/cron.mjs runs the due publishing first, then the digest.
This commit is contained in:
+18
@@ -223,6 +223,24 @@ curl -s -X POST -H "Authorization: Bearer $CRON_SECRET" \
|
||||
|
||||
Antwort: `{ "published": [...], "meta": { "total": 0 } }`.
|
||||
|
||||
### POST /api/v1/weekly-report
|
||||
|
||||
Sammelt alles, was in den letzten sieben Tagen veröffentlicht wurde, gruppiert es nach Projekt und schickt es als eine Nachricht in den Slack-Kanal aus `SLACK_WEBHOOK_URL`. Verlangt ebenfalls `CRON_SECRET`.
|
||||
|
||||
| Parameter | Wirkung |
|
||||
|---|---|
|
||||
| `dry=1` | baut die Nachricht und gibt sie zurück, ohne zu senden |
|
||||
| `days` | anderes Fenster als sieben Tage, 1 bis 90 |
|
||||
|
||||
```bash
|
||||
curl -s -X POST -H "Authorization: Bearer $CRON_SECRET" \
|
||||
"http://localhost:4700/api/v1/weekly-report?dry=1"
|
||||
```
|
||||
|
||||
Wurde nichts veröffentlicht, geht keine Nachricht raus und die Antwort sagt `nothing_published`. Fehlt der Webhook, kommt 501 statt stiller Stille.
|
||||
|
||||
Im Container erledigt `node scripts/cron.mjs` beide Aufrufe hintereinander, erst fällige Termine, dann der Bericht.
|
||||
|
||||
## Werkzeuge
|
||||
|
||||
| Adresse | Inhalt |
|
||||
|
||||
Reference in New Issue
Block a user