AI in your agency’s hands
From Inbox to AgencyZoom
Resend email delivery, Gemini AI enrichment, and a direct AgencyZoom API push. Five prompts, real CRM integration, no middleware.
EP 02 takes the EP 01 Form Center from local-only to production-ready: every form fill becomes an email in your inbox, an AI-written brief, and a real lead in your AgencyZoom pipeline. It takes five prompts run in order, with Resend for email delivery, Gemini for enrichment, and a direct AgencyZoom API push, with no middleware.
This episode builds on EP 01, so you need the Form Center running first. If you don’t have it yet, start with Build a Lead Intake Form Center with AI.
Free download
EP 02: From Inbox to AgencyZoom Prompt Guide
All 5 prompts, copy-paste ready, with setup walkthroughs and fix-it prompts.
EP 01 made you capable. EP 02 makes you production-ready.
In EP 01 you built a Form Center: three branded intake forms running locally. Forms submitted, but the data went nowhere. EP 02 is where leads start moving: into your inbox, through an AI enrichment layer, and directly into your AgencyZoom pipeline.
Where EP 01 left off:
- Three forms running locally: general, auto, home
- Validation, scoring, and conditional fields wired up
- A submit handler that doesn’t go anywhere yet
Where EP 02 takes you:
- Notification email in your inbox in under 5 seconds
- AI-written brief with priority tier and first-touch line
- Real lead in your AgencyZoom pipeline, fully tagged
- No middleware. You own the path.
What you’ll build in EP 02
Five components, layered on top of the EP 01 Form Center. Each one is its own prompt. Run them in order.
- Resend Email Delivery (
/api/submit-lead). A clean lead notification email lands in your agency inbox in seconds. Validated, formatted, agent-facing, every field included. - Gemini AI Enrichment (
/lib/enrichment/gemini.ts). A 2-3 sentence agent brief, Hot/Warm/Cool priority tier, and a recommended first-touch talking point, attached to the email and staged for AZ. - AZ Auth + Discovery (
scripts/az-discover.ts). A one-time CLI utility that authenticates with AgencyZoom, fetches your pipelines, stages, and lead sources, and saves your picks to a config file. - AZ createLead Integration (
/lib/agencyzoom/client.ts), the payoff. The lead is created directly in AgencyZoom using your IDs. Gemini’s brief goes into notes. The priority tier becomes a tag. No middleware. - Aesthetic Pass (on-camera bonus). Filmed live, not in this guide: a single prompt that polishes the Form Center to feel like a real product, not a wireframe. Watch the video for that one.
End state: a prospect fills out your auto form. In 5 seconds you have an email, an AI brief saying “Hot: shopping due to rate increase, two vehicles, clean record,” and the lead is already in your AZ pipeline with the right stage, source, and tag.
Five prompts. In order.
Each prompt builds on the last. By the end, a form fill becomes a real lead in your CRM, with intelligence already attached.
Resend Email
Make it functional. Wire up the real submission flow. Form posts to your API, server validates, Resend delivers a clean notification to your inbox in under 3 seconds.
Gemini Enrichment
Add intelligence. Each submission goes to Gemini 2.5 Flash for a structured brief. Priority tier, summary, first-touch line. Attached to the email.
AZ Auth + Discovery
Map the CRM. Build a CLI that logs into AgencyZoom, fetches your pipelines and stages, and saves your picks to a config the next prompt will read.
createLead Integration
Push the lead. On submit, after the email and Gemini, the lead is created directly in AZ via
/v1/api/leads. AI brief lands in notes. Priority becomes a tag.Aesthetic Pass
On-camera bonus. A single polish prompt that turns the Form Center from working software into something you would actually put in front of a prospect.
The EP 02 Prompt Guide
Five prompts, copy-paste ready, with pre-written answers to every question Claude Code will ask. Plus full Resend, Gemini, and AgencyZoom setup walkthroughs and a fix-it section for the failure modes you’ll likely hit.
The guide is the complete 5-prompt sequence to take your EP 01 Form Center from local-only to production-ready. Every prompt is copy-paste ready. Every likely question from Claude Code has a pre-written answer. Each step has a “how you know it worked” check.
What’s included:
- All 5 prompts
- Resend, Gemini, and AgencyZoom setup walkthroughs
- The
.env.exampleto.env.localpattern (key hygiene) - Auth pathways for SSO vs non-SSO agencies
- An SSO Addendum with a modified Prompt 3
- An “If Something Goes Wrong” section with paste-back fix-it prompts for the most common Resend, Gemini, and AZ failures
The production habits inside this build
EP 02 isn’t just adding services. It’s teaching the patterns that separate weekend projects from production-ready code. These habits stay with you for every build after this one.
The .env.example to .env.local pattern
Claude Code never sees your real keys. It writes .env.example with placeholders, safe to commit. You copy it to .env.local and paste real keys there. Real keys never leave your machine. This is the single most important habit in the guide.
Ask the system, don’t assume
Every agency configures AgencyZoom differently. Pipeline IDs, stage IDs, lead source IDs: unique to your account. Hardcoding them would break the build for everyone else. The discovery script asks AZ what’s actually there. Production code asks. It does not assume.
Enrichment is enhancement, not blocker
If Gemini fails, the email still sends, with a safe default brief. If AZ push fails, the email still arrives so the lead is captured. Each layer is independent. A failure at one layer never costs you a lead. That is what production resilience looks like.
SSO vs non-SSO auth awareness
If your agency logs into AZ with email + password, the username/password API path works. If you use Google Workspace, Okta, or Microsoft SSO, you need a long-lived API token from AZ support. The guide includes an SSO Addendum with the modified Prompt 3: same flow, different auth header.
The full series
| Episode | Title | What it covers | Status |
|---|---|---|---|
| EP 01 | Foundation: The Form Center | Build the multi-form lead intake system. Three forms, scoring engine, Resend email delivery. No database yet, pure intake. | Available |
| EP 02 | From Inbox to AgencyZoom | Resend email delivery, Gemini AI enrichment with priority tiers, and a direct AgencyZoom API integration. | You are here |
| EP 03 | Public Website Wrapper | Wrap the system in a public-facing agency website. Real domain, real DNS, real Resend domain verification. Live on the internet, ready to take a lead from a stranger who found you on Google. | Coming soon |
Download the EP 02 Prompt Guide and run the five prompts in order. By end of session, a prospect can fill out a form and walk into a real lead in your AgencyZoom pipeline, with an AI brief already attached.