Module 03 · foundations · beginner
Exercises 03 · Google Sheets Lead Tracker
Start from workflow/starter.json (Webhook + Normalize) or your finished lesson workflow.
Exercise 1: Track when a lead first appeared
Task: Add a first_seen column that is set when a lead is created and never overwritten on updates.
Done when: sending the same email twice keeps the original first_seen but changes updated_at.
Hint
Before saving, look the lead up with Google Sheets Get Row(s) (filter on email). Turn on Always Output Data so the flow continues when nothing is found.
Exercise 2: Count by source
Task: Add a second endpoint GET /webhook/lead-stats that returns how many leads came from each source, e.g. {"twitter": 3, "website": 7}.
Done when: the curl returns counts that match the sheet.
Hint
Webhook → Google Sheets Get Row(s) (no filter) → Code node that reduces the rows into an object → Respond.
Exercise 3: Block disposable emails
Task: Reject emails from mailinator.com, tempmail.com and 10minutemail.com with a 400.
Done when: {"name":"X","email":"x@mailinator.com"} returns 400.
Hint
Add a third IF condition: the domain part of the email is not in a list. $json.email.split('@')[1] gives the domain.