Lesson 2 · Module 2: Your First Working AI Automation
Building a lead capture flow: web form to Google Sheets to email
- Build the three steps
- Map each form field
- Test with a real submission
Why this matters
A form that nobody answers quickly is a lost customer. Many small businesses collect leads on a website and then let them sit in an inbox, where they get buried under other mail. This lesson shows how to connect a web form to a Google Sheet and two emails with n8n, so every request is captured, stored in order, and sent to the right person the moment it arrives.
Key ideas
- A webhook is the front door. A Webhook node gives your form a web address to post to. Each submission arrives as one small item, with the fields tucked under a key called
body. - An expression reads one field. Text in double curly braces, such as
{{ $json.body.name }}, pulls one value out of the incoming item and places it where you need it. Getting the path right matters more than anything else. - Append Row keeps every lead. Each run adds one new line to the sheet, with one column per field and a status that starts as "New", so you can see which requests still need an answer.
- Test URL and production URL differ. The test address works only while you press "listen" in the editor. The production address works all the time, but only when the workflow is switched on.
- Worked example. A form sends
{"body": {"name": "Hana Saleh", "service": "Deep cleaning"}}. The expression{{ $json.body.name }}givesHana Saleh. The expression{{ $json.name }}gives nothing, so that cell stays empty while the node still shows green.
Try it before you watch
If a form sends the name "Hana" and the flow stores the data under body, which expression fills a cell with "Hana"?
Show answerHide answer
{{ $json.body.name }}. The fields sit under body, so the path must include it. Reading {{ $json.name }} would return nothing, which is the mistake that leaves a cell empty without any error.
Words to know
- Webhook: a web address that waits for another program, such as a form, to send it data.
- Node: one box in an n8n workflow that does a single job, such as receiving data or sending an email.
- Expression: a short piece of text in double curly braces that reads a value from the data passing through the flow.
- Item: one bundle of data moving through a workflow, for example one form submission.
- POST: a way of sending data to a web address, which is how a form delivers its answers.
- Credential: a saved, secure link to an account, such as your Google login, that a node uses without showing your password.
What to watch for
- Watch where the data sits. Notice that every field is read from
body, and that the expression path is written exactly like that. - Watch the test submission. Notice that the row and both emails are checked by hand, because the green ticks alone do not prove the data is right.
- Watch the difference between the two addresses. Notice when the test address works and when the production address does.
Learn it with your tutor on the live board
Key points from the video
A quote request at night
- A request at eleven at night
- Read on Friday, too late
- Nobody owned the reply
layout: side
direction: LR
components:
customer: {kind: user, label: "Customer"}
omar: {kind: user, label: "Omar"}
site: {kind: browser, label: "Omar's website"}
inbox: {kind: email, label: "Shared inbox"}
links: [customer->site, site->inbox, inbox->omar]
steps:
- at: "Omar runs a home cleaning company"
show: [omar]
- at: "fills in the quote form"
show: [customer, site]
flow: ["customer>site: quote form"]
- at: "lands in his email"
show: [inbox]
flow: ["site>inbox: quote request"]
- at: "finally reads it"
show: [omar]
flow: ["inbox>omar: Friday"]
- at: "already booked another company"
note: "Booked elsewhere"
- at: "nobody owned the reply"
highlight: [inbox]
note: "Nobody owned it" What you will learn
- Build the three steps
- Map each form field
- Test with a real submission
layout: wide
parts:
flow: {chip: "LEAD FLOW", sub: "Form, sheet, email"}
steps:
- at: "build the three steps"
spokes: {of: flow, items: ["Build the steps", "Map the fields", "Test it live"]}
- at: "same pattern works"
note: "Any service business"
- at: "plain node you can see"
highlight: flow Every lead flow does three jobs
- Capture: the website form
- Keep: a Google Sheet
- Tell: an email
direction: down
tree:
Lead flow: [Capture, Keep, Tell]
steps:
- at: "It does three jobs"
note: "Three jobs"
- at: "capture the request"
show: Capture
- at: "keep every request"
show: Keep
- at: "tell the right person"
show: Tell
- at: "builds exactly those three jobs"
note: "Build all three" Step one: the webhook receives the form
- Webhook node receives the form
- Test and production addresses
- HTTP Method set to POST
- One item per submission
{
"body": {
"name": "Hana Saleh",
"email": "[email protected]",
"phone": "0100 555 0182",
"service": "Deep cleaning",
"date": "Friday"
}
} Expressions read one field each
- An expression in braces
- Body holds every field
- The flow swaps in the value
layout: side
cells:
A1: "Field"
B1: "Expression"
C1: "Value"
steps:
- at: "double curly braces"
note: "An expression"
- at: "reads the name"
type: {A2: "Name", B2: "{{ $json.body.name }}"}
- at: "holds Hana Saleh"
type: {C2: "Hana Saleh"}
highlight: C2
- at: "works the same way"
type: {A3: "Phone", B3: "{{ $json.body.phone }}", C3: "0100 555 0182"}
- at: "follow the same pattern"
type: {A4: "Service", B4: "{{ $json.body.service }}", C4: "Deep cleaning", A5: "Date", B5: "{{ $json.body.date }}", C5: "Friday", A6: "Email", B6: "{{ $json.body.email }}", C6: "[email protected]"}
- at: "exactly as the customer typed it"
note: "Exactly as typed" Step two: Append Row writes the line
- Append Row adds a line
- One column per field
- Status starts as New
layout: side
cells:
A1: "Name"
B1: "Phone"
C1: "Service"
D1: "Date"
E1: "Status"
F1: "Email"
steps:
- at: "adds one new line"
select: A2:F2
- at: "the name goes into column A"
type: {A2: "Hana Saleh"}
- at: "phone goes to column B"
type: {B2: "0100 555 0182"}
- at: "service goes to column C"
type: {C2: "Deep cleaning"}
- at: "date goes to column D"
type: {D2: "Friday"}
- at: "Status starts as New"
type: {E2: "New"}
highlight: E2
- at: "email goes to column F"
type: {F2: "[email protected]"} Step three: two Gmail nodes send two emails
- Hana gets a reply
- Omar gets the lead
- Nothing is typed twice
layout: side
lines:
- "Hi Hana, we got your request for deep cleaning on Friday."
- "New lead: Hana Saleh, deep cleaning, Friday."
steps:
- at: "we got your request"
note: "To the customer"
- at: "New lead"
highlight: Saleh
note: "To Omar"
- at: "nothing is typed twice"
note: "Typed once, used twice" Test URL first, then production
- Test address while building
- Production address, always on
- Switch the workflow on
layout: wide
parts:
flow: {chip: "WEBHOOK", sub: "One node, two addresses"}
steps:
- at: "two addresses"
spokes: {of: flow, items: ["Test URL", "Production URL"]}
- at: "copy the production address"
highlight: flow
note: "Paste it into the form"
- at: "switch the workflow on"
note: "Active before customers arrive" Test with a real submission
- Submit the form yourself
- A new row in the sheet
- Both emails arrive
layout: side
direction: LR
components:
form: {kind: client, label: "Website form"}
webhook: {kind: api, label: "Webhook"}
sheet: {kind: storage, label: "Google Sheet"}
gmail_customer: {kind: email, label: "Gmail to customer"}
gmail_omar: {kind: email, label: "Gmail to Omar"}
links: [form->webhook, webhook->sheet, webhook->gmail_customer, webhook->gmail_omar]
steps:
- at: "submit it yourself"
show: [form, webhook]
flow: ["form>webhook: POST"]
- at: "a new row appears"
show: [sheet]
flow: ["webhook>sheet: new row"]
- at: "send both emails"
show: [gmail_customer, gmail_omar]
flow: ["webhook>gmail_customer: email", "webhook>gmail_omar: email"]
- at: "the flow works"
highlight: [sheet, gmail_customer, gmail_omar]
note: "All green, data right" Common mistake: green does not mean correct
- Green does not mean correct
- Expression reads nothing
- Check every column
layout: side
objects:
eq1: {tex: 'x = 150 + 170 + 190', pos: top}
eq2: {tex: 'x = 510', pos: top}
eq3: {tex: 'x = 510 / 3 = 170', pos: top}
mark: {text: "All green, but wrong", pos: bottom}
steps:
- at: "green does not mean correct"
show: eq1
- at: "Expression reads nothing"
morph: [eq1, eq2]
- at: "the name cell stays empty"
morph: [eq2, eq3]
- at: "Check every column"
show: mark Recap: three takeaways
- Webhook catches the form
- Append Row keeps each lead
- Two emails, a real submission
layout: wide
parts:
flow: {chip: "LEAD FLOW", sub: "Form, sheet, two emails"}
steps:
- at: "the webhook catches the form"
spokes: {of: flow, items: ["Webhook", "Sheet row", "Two emails"]}
- at: "Append Row keeps one line per lead"
highlight: flow
note: "One row per lead"
- at: "two Gmail nodes send two emails"
highlight: flow
note: "Two emails"
- at: "a green tick only means"
highlight: flow
note: "Test with a real submission" Exercise: build it before the next lesson
- Build the flow yourself
- Submit your own form
- Done means both emails arrive
direction: down
tree:
Your exercise: [Webhook, Sheet row, Two Gmail nodes, Check the row]
steps:
- at: "a Webhook node"
show: Webhook
- at: "row in your sheet"
show: Sheet row
- at: "two Gmail nodes"
show: Two Gmail nodes
- at: "check the row"
show: Check the row Transcript
A quote request at night. Picture this. Omar runs a home cleaning company in Cairo, and he spends his days on customer jobs, with a mop in one hand and a phone in the other. At eleven at night, a woman fills in the quote form on his website. Her message lands in his email, between the newsletters and the supplier invoices. On Friday morning he finally reads it. She has already booked another company. Nothing crashed. The message simply got buried, and nobody owned the reply.
What you will learn. By the end of this lesson you will have a working lead flow, and you will know why each part is there. First you will build the three steps, one after another. Then you will map each form field to a column and to an email. Last, you will test it with a real submission, so no customer finds the bugs first. The same pattern works for a plumber, a tutor or a photographer. Every part is a plain node you can see and check.
Every lead flow does three jobs. So what does a lead flow actually do? It does three jobs. First, capture the request with the website form, so nothing is lost on the way. Second, keep every request in a Google Sheet that you can sort and filter. Third, tell the right person by email, so someone acts the same day. That is the whole idea, and the rest of this lesson builds exactly those three jobs.
Step one: the webhook receives the form. So where does the data come from? Your website form sends a message to an n8n Webhook node, the entry point of the flow. The Webhook node has two addresses: a test address for building, and a production address, which the live form posts to later. Set its HTTP Method to POST, because the form sends its data that way, and n8n's default is GET. Each submission becomes one item, a small bundle of named fields. The fields sit under a key called body, so the name is inside body, the email is inside body, and the service is inside body too. Remember that path, because every later step reads from it.
Expressions read one field each. So how does a cell know which field to read? You write an expression, a short piece of text in double curly braces. Inside the braces, dollar json dot body dot name reads the name from the webhook item. The flow body holds every field, and it swaps in the real value, so the cell holds Hana Saleh. Phone works the same way, with dollar json dot body dot phone. Service, date and email follow the same pattern. That keeps every answer exactly as the customer typed it.
Step two: Append Row writes the line. In the Google Sheets node, connect your Google account in the node's credential field, then pick the spreadsheet and sheet. Choose the operation called Append Row. Append Row adds one new line at the bottom each time the flow runs. Each column is one field, and each cell reads its value from an expression, so the name goes into column A. The phone goes to column B. The service goes to column C. The date goes to column D. The status starts as New, so you can see what still needs a reply. The email goes to column F, so you can reach the customer later.
Step three: two Gmail nodes send two emails. Two Gmail nodes send two emails, and both read the same fields from the webhook item. The first one goes to the customer, at the address in dollar json dot body dot email, so Hana gets a reply that says, Hi Hana, we got your request for deep cleaning on Friday. The second one goes to Omar, and it reads, New lead: Hana Saleh, deep cleaning, Friday. Both emails pull the name and the service from the form, so nothing is typed twice.
Test URL first, then production. The Webhook node has two addresses, and they behave differently. The test address works only while you press listen for a test event in the editor. The production address works around the clock, as long as the workflow is active. So build with the test address, then copy the production address into your form. And switch the workflow on, or the form posts to a switched off flow.
Test with a real submission. Now comes the most important step, a real test. Open your form and submit it yourself, with your own name and a real email. The data travels to the webhook, and a new row appears in the sheet. Then the two Gmail nodes send both emails, so check your inbox. If every node turns green and the row and both emails look right, the flow works.
Common mistake: green does not mean correct. Green does not mean correct. The worst mistake is a flow that runs, turns green, and still gets the data wrong. Say you wrote dollar json dot name, instead of dollar json dot body dot name. That expression reads nothing, so the name cell stays empty. The phone and the service still fill in. The date and the status fill in too, so the row looks fine at a glance. Nothing errors, so nothing alerts you, which is why you must check every column.
Recap: three takeaways. Let's recap the lead flow in three takeaways. First, the webhook catches the form, and its fields sit under body. Second, Append Row keeps one line per lead, and each cell reads its value from an expression. Third, two Gmail nodes send two emails, one to Omar and one to the customer. A green tick only means the node ran without an error, so always finish with a real submission, and then read the row.
Exercise: build it before the next lesson. Your exercise is to build this flow yourself before the next lesson. Start with a Webhook node, copy its test address, and send a test submission through your form or a POST tool. Opening the address in a browser only sends a GET, with no form data, so it will not work. Then add an Append Row step, so each form field lands in its own column of a row in your sheet. Add two Gmail nodes, one for Omar and one for the customer. Finally, submit your own form and check the row and both emails before you call it done.
Explore the animations
The animations from the video, exact and live: play them, pause, drag the slider or jump to a step at your own pace.
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Loading the animation...
Answer every question, then check. 70% passes; you can retry as often as you like.
Lesson summary
- Reading
- Video watched
- Quiz passed (70%)
- Webhook catches the form
- Append Row keeps each lead
- Two emails, a real submission