Quick overview
Youtube Video:https://youtu.be/NGruDecKxAg?si=ot9pj6IN4IoLstow
This workflow takes a chat-based search request, scrapes matching businesses from Google Maps using Apify, scores and ranks them with Google Gemini, deduplicates against an existing Google Sheet by placeId, saves new leads to the sheet, and returns a formatted results message to the chat.
How it works
- Receives a message from an n8n chat trigger containing the user’s Google Maps lead search request.
- Sends the request to Google Gemini to extract structured search parameters (business type, location, max results, and output mode).
- Calls an Apify Google Maps scraping actor with the extracted parameters and selects a clean set of lead fields from the results.
- Removes duplicate businesses based on Google Maps placeId and batches the remaining leads into a single list.
- Sends the lead list to Google Gemini to add a 0–100 score and short reason to each lead and returns them sorted by score.
- Checks the scored leads against existing rows in Google Sheets and filters out any placeId values that are already saved.
- Appends or updates the new leads in Google Sheets and returns a formatted ranked lead list back to the chat.
Setup
- Set up Google Gemini (Google PaLM) credentials for the two HTTP requests that parse intent and score/rank leads.
- Add an Apify API token as an HTTP Header Auth credential and confirm the Apify actor endpoint used to scrape Google Maps.
- Connect a Google Sheets service account, and update the spreadsheet ID, sheet/tab, and column headers (including placeId) used to read and upsert leads.
- Enable the chat trigger and copy/configure the chat webhook/channel details for wherever you send user messages from.