Forms & Feedback Endpoint
Every form the Mainframe ships submits to one endpoint: https://mainframe.prodg.studio/feedback. Build the form; skip the backend.
Rule for all future forms: mark the
<form>withdata-feedback, load the shared bridge script, and use the canonical field names. That's the whole integration.
The 60-second integration
<script defer src="https://mainframe.prodg.studio/feedback/forms/feedback.js"></script>
<form data-feedback data-feedback-form="contact" method="POST"
action="https://mainframe.prodg.studio/feedback">
<label for="f-name">Name</label>
<input id="f-name" name="name" autocomplete="name">
<label for="f-email">Email</label>
<input id="f-email" type="email" name="email" autocomplete="email">
<label for="f-message">Message</label>
<textarea id="f-message" name="message"></textarea>
<!-- spam trap: hidden, must stay empty -->
<input name="_honey" type="text" tabindex="-1" hidden>
<button type="submit">Send</button>
<p data-feedback-status role="status" aria-live="polite"></p>
</form>
No JavaScript needed from you. The bridge intercepts submit, validates, POSTs JSON, renders success/error in the status region, fires a prodg:feedback:success event, and resets the form. With JS disabled the plain action/method still works — the endpoint accepts form-encoded bodies.
There is a live demo at assets/feedback-demo.html — copy it as your starting point, or use https://mainframe.prodg.studio/feedback/forms/form-template.html.
Canonical fields
| field | meaning | required |
|---|---|---|
form_id | stable form identifier (grouping key) | auto-set from data-feedback-form |
name | respondent name | no |
email | reply-to (validated) | no |
subject | short summary | one of subject/message |
message | the response body | one of subject/message |
rating | score / NPS / satisfaction | no |
category | routing bucket (docs, sales, support…) | no |
page | originating URL | auto-set |
Anything else you send is preserved verbatim under extra, so adding a new form field never requires touching the service.
What the endpoint gives you back
- Persistence — every submission lands in
/opt/prodg/data/feedback/feedback.db(queryable) andsubmissions.jsonl(append-only audit trail). - Telegram notification — a formatted card in the Control room supergroup, including form id, respondent, rating and the message body.
- Spam handling — a filled
_honeyhoneypot gets a 202 and is dropped; submissions are rate-limited to 12/minute per IP. - CORS — origins under
prodg.studio(plus localhost) may post cross-origin; same-origin pages need nothing.
Reading submissions
TOKEN=$(grep '^FEEDBACK_ADMIN_TOKEN=' /opt/prodg/feedback/.env | cut -d= -f2)
curl -s -H "Authorization: Bearer $TOKEN" \
'https://mainframe.prodg.studio/feedback/submissions?limit=100'
# or straight from the database
sqlite3 -header -column /opt/prodg/data/feedback/feedback.db \
"SELECT id, received_at, form_id, email, rating FROM submissions ORDER BY id DESC LIMIT 20;"
Reference
| Method | Path | Purpose |
|---|---|---|
POST | /feedback | Submit (JSON, form-encoded or multipart) |
OPTIONS | /feedback | CORS preflight |
GET | /feedback | Endpoint description |
GET | /feedback/health | Liveness probe |
GET | /feedback/submissions | Read submissions (admin token) |
GET | /feedback/forms/feedback.js | The shared bridge |
Operational detail — service unit, route changes, the Caddy single-file-mount gotcha, retention and pruning — lives in /opt/prodg/feedback/README.md on the host.