Lead Capture from Chat: From Discount Seekers to CRM-Ready Customers
How a Shopify chat widget can collect emails the right way — when to trigger, where to route them, and how to keep coupon generation separate from lead routing.
A chat widget that doesn't capture leads is a chat widget that's answering questions for free and walking the buyer back out the door. The problem isn't whether to ask for an email — it's when, why, and where the email goes after.
This post covers the foundation: how Milly Chat decides to ask for an email, the two adapters it ships with (Shopify Discount and Maestra CRM), and the design decision that keeps coupon generation separate from lead routing — so a wholesale buyer doesn't walk away with a 10%-off code instead of a callback.
Why capture leads from chat at all?
Most Shopify stores already capture emails through pop-ups, footer signup forms, and checkout opt-ins. Chat-based capture sits in a different part of the funnel. It catches three audiences the other surfaces miss:
- Discount seekers who searched for a coupon code, got a chat response, and converted because the widget made the ask in context — not on page load.
- Newsletter signups who asked "do you have a mailing list?" or "do you do drops?" — high-intent subscribers, not pop-up casuals.
- Business inquiries — wholesale, partnership, custom orders — that don't fit any pop-up template and would otherwise leave with a "please contact us" reply.
The chat surface knows what the visitor was actually asking when they handed over their email. That context — what they wanted, which page they were on, what the AI said back — is the asset. The email is just the address you reply to.
The capture_email tool: when the AI knows to ask
Milly Chat exposes a capture_email tool to both the Claude and OpenAI chat paths. The model decides when to call it based on the conversation, not on a hardcoded trigger phrase. Practical examples of when it fires:
- Visitor asks about coupon codes, promos, sales, discounts
- Visitor asks about wholesale, B2B pricing, bulk orders
- Visitor asks about a partnership, collaboration, or sample request
- Visitor explicitly says "sign me up for the newsletter"
- Visitor describes a support request, complaint, or custom inquiry that needs human follow-up
The AI writes a short summary of what the visitor was asking when the capture happened. That summary lands in the lead's body field in the Leads dashboard — no scrolling through transcripts to find out why someone signed up.
Two adapters out of the box: Shopify Discount + Maestra
The lead-capture pipeline is adapter-based, so the same capture_email tool can route to different destinations per merchant. Two adapters ship at the foundation level:
- Shopify Discount — merchant configures a template discount in Shopify admin (with the percentage / amount / scope they want), then pastes the discount URL into the lead-capture settings. Each capture generates a unique
MILLY-XXXXXXcode from that template and surfaces it in the chat reply. The code lands in the merchant's Shopify discounts admin. - Maestra — for merchants running Maestra for loyalty / lifecycle marketing, the adapter creates a customer in Maestra, subscribes them to the configured brand list, and relies on Maestra's own promo-code engine to issue a code. The captured email lives in Maestra alongside the rest of the merchant's loyalty data.
Adapters are configured per-store. Most merchants pick one as the primary capture path and let the others stay off; both are coupon-generating, so running both at once would issue two codes for one capture.
The Leads dashboard view
Every captured lead lands in the Leads page in the dashboard: searchable, date-range filterable, paginated. Each row opens a slideout drawer with the captured email, the AI summary, the page URL where the conversation happened, the last 20 messages of the conversation inline, and a link to the full replay.
For coupon-eligible captures, the assigned discount code shows on a badge alongside the email — fast triage when someone cross-references "this code came from where?".
Decoupling lead capture from coupon generation
The structural decision that pays off downstream: lead capture and coupon generation are independently configurable. A merchant can run:
- Capture on, coupon on — discount-seeker leads get a code; every captured lead lands in the dashboard
- Capture on, coupon off — every email is persisted, no auto-coupons issued. Useful when the merchant runs their own outbound coupon flow downstream
- Capture off — the
capture_emailtool is unavailable to the AI; nothing is captured or coupon-issued
The reason this matters: the moment lead capture and coupon generation are bound together, every emailing lead becomes a discount seeker. A wholesale buyer who hands over a corporate address gets a 10%-off code they didn't want. With the gate decoupled, the AI captures every lead but only the coupon-eligible intent triggers a code.
What this foundation makes possible
Once the capture-email tool, the adapter pipeline, and the decoupled coupon gate are in place, everything that ships next composes on top:
- Intent classification — the AI labels each capture as discount / newsletter / business / support, and merchants can route different intents to different destinations.
- Per-intent CRM mapping — discount captures go to Klaviyo, business inquiries open a HubSpot ticket, support requests open a Zendesk ticket. Same widget, different destinations by intent.
- Custom webhooks — any system that accepts a JSON POST becomes a routable destination. Slack channel, internal API, custom CRM, your own database.
Those are separate posts. This one is the floor: the AI knows when to ask, the adapter pipeline routes the answer, and the coupon gate stays out of the routing logic. Everything else is a question of how many destinations you wire up.