<!-- https://docs.poily.com/prompts/import · source: Apps/handoffs/admin_mkt/poily-import-integration-prompt.md · last synced: 2026-11-03 -->
# Poily import integration — reusable agent prompt (scan-to-create)

A **tenant-agnostic** handoff for wiring any site's existing native `<form>` to Poily in **one pass**.
Fill the four blanks, run the operator precheck, then paste the block to that site's agent. Mechanics
live in the forms guide at https://docs.poily.com/forms — this prompt just gates the three things that actually bite.

## Operator fill-ins
- `{{FORMS_DOMAIN}}` — the tenant's Poily forms host, e.g. `forms.alumnihub.co`
- `{{PAGE_URL}}` — the **deployed** page with the form, e.g. `https://alumnihub.co/`
- `{{FORM_SELECTOR}}` — the form on that page, e.g. `#ea-form` (or "the signup form")
- `{{IMPORT_KEY}}` — a stable, lowercase key (also becomes the form's slug), e.g. `alumnihub-signup`

## Operator precheck — out of scope for the agent; confirm these first
1. The tenant's `custom_domain` is registered in its brand kit (so `Origin` resolves to the line) and `{{FORMS_DOMAIN}}` is live.
2. The SDK on that host is **current**: `curl -s https://{{FORMS_DOMAIN}}/sdk.js | grep -c fieldKey` → must be `> 0`.
3. The agent can edit the **deployed** source of `{{PAGE_URL}}` (not just a preview/staging build).

---

## Prompt (paste to the tenant's marketing-site agent)

> Wire our existing signup form to Poily's scan-to-create import. Poily auto-builds the lead form from
> our markup — no form-building, no field renaming, fields keyed by `name` **or** `id`.
>
> **1) Edit `{{FORM_SELECTOR}}` on `{{PAGE_URL}}` — add two attributes, change nothing else:**
> ```html
> <form … data-poily-import="{{IMPORT_KEY}}" data-poily-placement="signup_page">
> ```
> **2) Load the SDK once near `</body>`:**
> ```html
> <script src="https://{{FORMS_DOMAIN}}/sdk.js" async></script>
> ```
> Deploy the change to **`{{PAGE_URL}}`** — the real live origin. (A `localhost` or preview URL won't
> resolve our tenant and will 403; the import keys the tenant off the page's `Origin`.)
>
> **3) Verify on the LIVE page — do NOT replay requests.** Load `{{PAGE_URL}}` in incognito, open
> DevTools → Network:
> - On load: `POST …/dev/f/import` → `200 {"slug":"{{IMPORT_KEY}}","created":…}` (confirms your fields
>   were scanned).
> - Submit the form: `POST …/dev/f/{{IMPORT_KEY}}/submit` → `200 {"id":"…"}` (confirms capture).
> - A "success" message from our own form proves nothing — only these two real POSTs do.
>
> **4) If step 3 shows NO `…/submit` POST**, our form's own JS consumed the submit event — add this and
> retest:
> ```html
> <script>
> document.addEventListener('poily:imported', function (e) {
>   var form = e.target, slug = e.detail.slug;
>   var btn = form.querySelector('[type=submit], button');
>   if (btn) btn.addEventListener('click', function () {
>     Poily.submit(slug, Poily.readForm(form), { placement: 'signup_page' });
>   });
> });
> </script>
> ```
>
> **Report:** the slug, the import `created` flag, and the submit `id` — taken from the real Network
> trace, not a replay. The Poily operator confirms the lead landed under the tenant.

---

## What the operator verifies after
`app.poily.com → [tenant] → Forms` shows the new form (`{{IMPORT_KEY}}`); `→ Submissions / Leads`
shows the test row. Delete the test lead once confirmed. JS-populated `<select>` options self-heal on
the next page load (deferred scan + backfill) — no action needed.
