Skip to content
NEWMarketplace and the trig8n Agent: sell what you build, and get plans and changes that are tested before you see them. See what is new

Library / Email Automation

Email Automation

Score and route inbound leads with Gemini, website enrichment, Slack and Sheets

When an API call/webhook arrives, it handles email with Google Gemini using Google Sheets, Slack.

What it does

## Score and route inbound form leads to Slack and Google Sheets with Gemini ### Who it's for Founders, sales and RevOps teams who get demo requests and contact-form leads and want the good ones answered first, without a lead-routing tool. ### How it works 1. Receive & clean: a webhook takes the form post and answers 200 at once. Normalize & Validate Lead cleans the fields and flags junk (disposable addresses, SEO pitches, honeypot, test entries). A free email-check API also catches burner and invalid addresses (green note). 2. Spam & duplicates: junk goes to the Spam tab. The Leads tab is read once per run; an email already there is a returning lead: its row gets submissions, last_seen_at and the latest message, and nobody is alerted twice. 3. Enrich: the company homepage is fetched (10s timeout). If it fails, the lead is marked enrichment = failed and scored on the form alone; the run never stops. 4. Score: Gemini scores the lead 0-100 against the Ideal Customer Profile in Config and returns industry, size, reasons and a next step as strict JSON. If Gemini fails, simple rules score it instead (title seniority, free mail, buying-intent words) and the row says scored_by = rules. 5. Save & route: every new lead is saved to Leads. Tiers use your thresholds: hot → Slack alert, warm → short Slack note (switch off with notifyWarmInSlack), cold → Nurture tab. 6. Errors: if a Sheets or Slack step fails, the error goes to the Errors tab and a Slack warning, and the other leads carry on. ### Setup (about 10 minutes) 1. Create a Google Sheet with four tabs: Leads, Spam, Nurture, Errors (headers are written on the first run). 2. Open Config: paste the sheet ID into sheetId, the Slack channel ID into slackChannelId, and describe your buyer in icpDescription. Adjust hotThreshold (75) and warmThreshold (45) if you like. 3. Add credentials: Google Gemini (key from Google AI Studio), Google Sheets OAuth2, Slack OAuth2 (chat:write). 4. Copy the Production URL from Receive Lead Webhook into your form's webhook settings and activate. Test with: curl -X POST -H 'Content-Type: application/json' -d '{"name":"Dana Whitfield","email":"dana@example.com","company":"Example Co","website":"example.com","job_title":"VP Revenue","message":"Can we get a demo?"}' ### Requirements n8n 2.x (tested on 2.43.7), a Google Gemini API key, Google Sheets, Slack. ### Customize Typeform, Tally o

The steps

  1. Receive Lead Webhook
  2. Config
  3. Normalize & Validate Lead
  4. Respond 200 to Form
  5. Check Email with Demo API?
  6. Score Email (Free Demo API)
  7. Apply Email Verdict
  8. Is Valid Lead?
  9. Log Spam to Sheet
  10. Read Existing Leads
  11. Check Duplicates
  12. New or Returning?
  13. Update Returning Lead in Sheet
  14. Fetch Company Homepage

32 steps in total.

Similar automations