Recovering unfinished forms

For developersVersion 1.0.0Last updated:

Code: includes/modules/forms/class-builder-os-forms-abandon.php; public JS public/js/builder-os-forms-abandon.js. Off by default, per form and per wizard; when off, no JS is loaded and no notice is shown.

  • Settings (option builder_os_forms): abandon (bool), abandon_note (editable privacy notice; by default “If you don’t finish, we save your email or phone so we can help you. You can ask us to delete it.”) and abandon_crm (bool, “Create contact in the CRM”). In the wizard: graph.abandon = { on, note, crm } (switch in its general settings). Global (Home → Forms): abandon_minutes (1 to 1440, default 30).
  • Page: per request (uncached) Builder_OS_Forms::finalize() adds <input name="_bos_ab"> and data-bos-abandon-note. The JS waits for a valid email, phone or name, 1.5 s after the last keystroke, and sends with navigator.sendBeacon on focusout, visibilitychange and pagehide. With a full page cache you must flush it when you change the setting.
  • Data: private content type bos_form_partial (outside the bos_submission queries). Metadata: _bos_form_key, _bos_form_id, _bos_form_name, _bos_ab_kind, _bos_email, _bos_phone, _bos_ab_name, _bos_ab_reached, _bos_ab_step, _bos_ab_last, _bos_ab_token (hash), _bos_ab_crm, _bos_ab_fired, _bos_crm_contact. Never free text, option answers, IP or user agent. The visit token lives in the browser’s memory (it isn’t a cookie) and only its hash is stored on the server.
  • Retention: 30 days with no activity; the queue (forms.abandon_purge) deletes it daily. A real submission with the same token, email or phone deletes it instantly. Exporter and eraser in WordPress’s privacy tools (“Unfinished forms (BuilderOS)”), suggested privacy policy text and deletion on uninstall.
  • Public REST: POST /builder-os/v1/forms/abandon ({ schema, sig, rt, token, fields, reached, bos_website, page, lang }; checks signed schema 400, per-IP limit 429 with the builder_os_forms_abandon_rate_limit filter [40 per 10 min], honeypot, time token, setting on, visit token and valid email or phone; otherwise, 200 {ok, stored}). In wizards, POST /wizard/<id>/partial with the same rules and only with the setting on.
  • Messages inbox (GET /builder-os/v1/forms/inbox): status=abandoned lists the partials (“Unfinished” folder; they don’t count toward total, unread or forms of /forms/inbox/counts, which adds abandoned). Each item carries kind (form|wizard), step, reached, summary and contact ({mailto, whatsapp, tel}); delete or trash deletes it (no trash). The detail adds meta.recovery, crm_contact_id and crm_url.
  • CRM: with abandon_crm and after abandon_minutes (filter builder_os_forms_abandon_minutes) the contact is created with origin form-abandoned, without marketing consent, and the form_abandoned trigger is emitted once (form_id, form_key, form_name, step, partial_id). The abandoned_form template sends a marketing email only to someone who’s subscribed; otherwise, it creates the task “Call {{nombre}}: left a form unfinished.”
  • MCP: forms_list_abandoned (read-only, “Forms with AI” group; limit 1 to 50, form_id): { total, abandoned:[{ id, form, step, last_activity, email, phone }] }, with no name or free text; Messages permission.
  • For the AI (chapter 25): it’s optional and off; don’t turn it on unless the user asks, keep the privacy notice visible, don’t ask for or save anything beyond name, email or phone, don’t turn on “Create contact in the CRM” unless asked, and never write to someone without consent: create a call task. To read them use forms_list_abandoned.