Skip to content
Tutorials Center
My learning

Topics

Lesson 33 of 36 ยท Projects and Practice

Project: Lead Intake and Routing Pipeline

Design and build a complete lead pipeline: a webhook form, validation, deduplication in a table, scoring, routing to the right rep, notification and error handling, with a runnable simulator.

This is the first of four projects that combine everything in this part of the course. You will design a lead intake pipeline: visitors submit a contact form on your website, and within seconds the lead is validated, checked for duplicates, scored, assigned to a salesperson and announced in chat. It touches webhooks, tables, filters, lookups, API calls and error handling in a realistic order.

The Zapier product cannot run on this site, so the project has two parts: a precise build guide you can follow in your own account, and a JavaScript simulator that runs the same logic here, so you can test the rules before building. The simulator is a stand-in and not Zapier code. Menu names and plan features change, so adapt the steps if your screens differ.

The requirements

  1. The website form posts JSON to a webhook.
  2. Reject bad submissions (missing or malformed email) and record them.
  3. Never create the same lead twice (same email).
  4. Score each lead from simple rules.
  5. Route by region to a rep using a lookup table; leads without a region go to a default queue.
  6. High scores (70 or more) notify the rep immediately; others get a daily digest.
  7. Failures alert the owner.
flowchart TD
    A["Website form"] --> B["Catch Hook"]
    B --> C{"Valid email?"}
    C -- "no" --> X["Log to Rejected table"]
    C -- "yes" --> D["Find or Create in Leads table"]
    D --> E{"New lead?"}
    E -- "no" --> Y["Stop: duplicate"]
    E -- "yes" --> F["Score"]
    F --> G["Lookup rep by region"]
    G --> H{"Score 70 or more?"}
    H -- "yes" --> I["Notify rep now"]
    H -- "no" --> J["Mark for digest"]

The whole pipeline in one picture.

Step 1: tables

Create two tables (Zapier Tables Basics):

  • Leads: email (the unique key), name, company, country, region, score, owner, status (dropdown: new, notified, digest), created_at, source.
  • Reps (the lookup, see Tables as Lookup, State and Dedupe): region, rep_name, rep_chat_id. Add a row with region Default for unknown regions.
  • A Rejected table with payload, reason, received_at.

Step 2: the trigger

Create a Zap with Webhooks by Zapier, Catch Hook (Webhooks by Zapier: Catch Hook). Send a complete sample such as:

JSON
{ "email": "[email protected]", "name": "Ada Lovelace", "company": "Analytical Ltd",
  "country": "DE", "employees": 120, "message": "We need a demo next month" }

Name the Zap [Sales] New lead -> Route to rep (Tables + Slack) and add the five-line description (Naming, Documentation and Change Management).

Step 3: validate, then dedupe

Add a Filter (or a Paths branch) that continues only if email contains @. Put the failed branch into the Rejected table so nothing vanishes silently. Then add Tables: Find or Create Record on email, and continue only if the record was created in this run.

Step 4: score and route

Scoring can be a Formatter step plus a small Code step, or, even simpler, a set of Paths that each add points. Rules used in the simulator below: company size 100 or more adds 30; a business email domain adds 20 (free mail domains add 0); a message mentioning "demo" or "pricing" adds 30; a known country adds 10; maximum 100.

The region comes from country through another small lookup table (country to region), then the Reps table gives the owner. Remember the not-found default.

Try the whole logic

The simulator below runs the pipeline over several test submissions, including a bad email and a duplicate, and prints what each branch would do.

JS Stand-in: the lead pipeline simulator

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check the outputs against your expectations: the duplicate is detected despite different capitalisation because the key is lower-cased (the same cleaning step you would add with a Formatter). The Brazilian lead has no region mapping, so it lands in the default queue.

Step 5: notify, and the digest

For notified leads add a Slack or Microsoft Teams or email action that mentions the rep (using the rep_chat_id field) and includes the lead's name, company, score and a link to the table record. For the rest, create a second Zap that runs on a Schedule (every weekday at 08:00), finds records in the view "status is digest", builds one summary with a Line-item to Text step, sends one message per rep, and sets the status to notified. Batching like this follows Task Usage and Cost Control.

JS Stand-in: the daily digest

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Step 6: failure handling

  • Create a central error Zap with Zapier Manager: Zap Error that writes to an Incidents table and alerts the owner (Error Handling, Alerts and Replays).
  • Turn on auto-replay for the pipeline Zap if your plan has it.
  • Protect the hook with a shared secret header checked by a Filter (Security and Access Control). Mask personal data in chat alerts.

Testing plan

  1. Send the five test payloads from the simulator by curl or a client tool.
  2. Check each table: one Leads record for Ada, one for Bob, none for the invalid one, one Rejected row.
  3. Resend Ada: no new record, the Zap stops after the dedupe filter.
  4. Break something on purpose (wrong Slack channel id): confirm the incident appears.
  5. Watch the usage count of one run and compare with your estimate.

Extensions

Check your understanding

Quick check ยท 3 questions

of 3 answered You scored / 3 ยท perfect!

  1. 1. Why lower-case and trim the email before the dedupe lookup?

    String comparison is exact; cleaning the key first prevents false misses.
  2. 2. Where should invalid submissions go?

    Logging keeps problems visible without polluting real leads or spamming chat.
  3. 3. Why send low-score leads in a daily digest?

    One summary message replaces many single notifications.

Summary

  • The pipeline: webhook, validate, find or create, score, lookup, notify or digest, error alerts.
  • Tables hold leads, reps (lookup) and rejected items; keys are cleaned before comparing.
  • Simulate rules first, then build, then test with good, bad and duplicate data.
  • Add alerting, a secret on the hook and masked notifications before going live.

Next: Project: Support Ticket Triage