feat: send song requests to Hermes via webhook

- Add Hermes webhook platform support on ntfy.hallsworth.ca
- Add /admin/settings form to configure webhook URL + HMAC secret
- Add /admin/request/<id>/send-to-hermes action
- POST request data to Hermes with V2 HMAC signature and callback URL
- Hermes can reply via chat or POST the Suno prompt back to /api/prompt/<id>
- Add test button, update README, bump version to 0.7.0
This commit is contained in:
Troll (Hermes Agent) 2026-08-24 22:49:08 +00:00
parent d058d8db1d
commit d7ed56f34e
6 changed files with 213 additions and 15 deletions

View file

@ -1,6 +1,6 @@
# Theme Song Booth
**Version:** `v0.6.3`
**Version:** `v0.7.0`
A Flask web application for running a convention booth where visitors request a custom AI-generated theme song. Operators manage the queue from an admin dashboard, generate Suno prompts, upload MP3 previews, collect payment, and deliver final songs by email.
@ -25,12 +25,13 @@ A Flask web application for running a convention booth where visitors request a
## What the booth does
1. A visitor fills out a short form at `/request`.
2. The operator reviews the request in the admin dashboard and generates a Suno Custom Mode prompt.
3. The operator (or an AI assistant via the `/api/prompt` callback) saves the prompt to the request.
4. The operator creates two song versions in Suno, downloads them, and uploads **Version A** and **Version B** to the request page.
5. The operator sends a preview email; the customer visits their private player page, listens to both versions, and either approves one/both or requests changes.
6. After the customer approves and pays, the operator records the payment reference and delivers the selected MP3(s) by email.
7. Optional stems / extras can be delivered via a share link that appears on the player page after delivery.
2. The operator reviews the request in the admin dashboard and clicks **Send to Hermes** to push the customer data to a Hermes webhook.
3. Hermes generates a Suno Custom Mode prompt and can POST it directly back to the `/api/prompt` callback endpoint, or reply in chat with the prompt text.
4. The operator (or the Hermes callback) saves the prompt to the request.
5. The operator creates two song versions in Suno, downloads them, and uploads **Version A** and **Version B** to the request page.
6. The operator sends a preview email; the customer visits their private player page, listens to both versions, and either approves one/both or requests changes.
7. After the customer approves and pays, the operator records the payment reference and delivers the selected MP3(s) by email.
8. Optional stems / extras can be delivered via a share link that appears on the player page after delivery.
---
@ -74,10 +75,10 @@ The selected pronouns are stored in the `pronouns` column and included in confir
|------|------|---------|
| Login | `/admin/login` | Simple session-based login. Password comes from the `ADMIN_PASSWORD` environment variable. |
| Dashboard | `/admin` | Main queue. Filter by status and auto-refresh at a configurable interval. |
| Request detail | `/admin/request/<id>` | Full control of one request: edit customer info (including pronouns and structured style), save prompt, copy Hermes callback, view revision history, upload MP3s, send preview, record payment, deliver files, add operator notes, and cancel. |
| Request detail | `/admin/request/<id>` | Full control of one request: edit customer info (including pronouns and structured style), save prompt, copy Hermes callback, **Send to Hermes** webhook, view revision history, upload MP3s, send preview, record payment, deliver files, add operator notes, and cancel. |
| Pricing | `/admin/pricing` | Configure fixed prices (one song, both songs, WAV per song, STEMs per song) and up to 5 custom items. |
| Sales | `/admin/sales` | Report of all delivered requests with customer details and Square payment references. |
| Settings | `/admin/settings` | Database health, backups, SMTP config, MP3 metadata defaults, revision limit, auto-refresh interval, kiosk mode, booth open/closed switch, Hermes API key management, and system reset. |
| Settings | `/admin/settings` | Database health, backups, SMTP config, MP3 metadata defaults, revision limit, auto-refresh interval, kiosk mode, booth open/closed switch, Hermes API key, Hermes webhook configuration, and system reset. |
| Reset | `/admin/reset` | Clears all requests and uploaded files. Requires admin password confirmation. |
---
@ -110,9 +111,14 @@ The `/admin/settings` page is split into functional sections:
### Hermes API key
- Displays whether a key is configured.
- **Regenerate API Key** creates a new random key stored in runtime settings.
- The key is used by the `/api/prompt/<id>` callback and by the `/api/key-test` diagnostic endpoint.
- Copy this key into your Hermes skill or AI assistant config.
- Copy this key into your Hermes webhook subscription and AI assistant config.
### Hermes webhook
- Configure the public webhook URL and HMAC secret so the booth can push song request data to Hermes.
- The operator clicks **Send to Hermes** on a request to trigger prompt generation.
- The payload includes the callback URL so Hermes can POST the generated prompt back to `/api/prompt/<id>`.
- **Send Test Request** verifies the URL, secret, and signature.
### Customer revision limit
- Maximum number of times a customer can click **Request Changes** on the player page.
@ -174,9 +180,8 @@ python init_db.py
```
7. Point your reverse proxy at the host port you chose (default `127.0.0.1:8000`).
8. Visit `/admin/settings` and click **Regenerate API Key**.
9. Copy the key to your Hermes skill / AI assistant.
10. Print or display a QR code pointing to `https://your-domain/request`.
8. Visit `/admin/settings` and configure the **Hermes webhook** URL and secret.
9. Print or display a QR code pointing to `https://your-domain/request`.
### Updating the deployment