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> with data-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

fieldmeaningrequired
form_idstable form identifier (grouping key)auto-set from data-feedback-form
namerespondent nameno
emailreply-to (validated)no
subjectshort summaryone of subject/message
messagethe response bodyone of subject/message
ratingscore / NPS / satisfactionno
categoryrouting bucket (docs, sales, support…)no
pageoriginating URLauto-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) and submissions.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 _honey honeypot 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

MethodPathPurpose
POST/feedbackSubmit (JSON, form-encoded or multipart)
OPTIONS/feedbackCORS preflight
GET/feedbackEndpoint description
GET/feedback/healthLiveness probe
GET/feedback/submissionsRead submissions (admin token)
GET/feedback/forms/feedback.jsThe 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.