Discover B2B Leads with Gemini and Brave Search in n8n
Input industry type and location → AI Agent searches and validates with multiple tools → outputs structured prospect list with websites and contact details
- Who
- Sales reps, market researchers, or SDRs who need to batch-discover potential B2B clients in specific regions
- You get
- A structured JSON list of prospects including company name, website, description, contact person, and phone number
- You need
- n8n · Brave Search · Jina AI
Constraints
Requires self-hosted n8n (community nodes are incompatible with n8n Cloud). Prepare four credentials: Google Gemini (chat model and search), Brave Search (recommended via Smithery MCP or direct API), Jina AI (web scraping). Import this template as a sub-workflow and call it from a parent workflow via the Tool Workflow node.
What they did
Author Jeremy Dawes (jez) published an AI Agent sub-workflow template on n8n.io. The workflow uses Google Gemini 2.5 Flash as its reasoning engine, equipped with four tools—Brave Web Search, Brave Local Search, Google Gemini Search, and Jina AI web scraper—to transform a business type and location into a structured prospect list via a three-phase protocol (candidate identification → detailed profiling → JSON output). It is designed to be called by a parent workflow through the Tool Workflow node, with optional exposure as an MCP service.
How it went
Source report (author_report): The template has 4,605 views on n8n.io and is categorized under Lead Generation and AI Chatbot. The template provides complete input/output examples, claiming to return a JSON array with company name, website, description, contact person, phone, email, and LinkedIn. This site has not verified its search success rate or data accuracy.
Worth knowing
1. Self-hosted only: workflow.json contains community nodes (mcpClientTool, geminiSearchToolTool) incompatible with n8n Cloud. 2. Credential costs: You must obtain and pay for Google Gemini, Brave Search, Jina AI, and Gemini Search API usage; MCP connections may require intermediary services like Smithery. 3. System prompt version gap: The full system prompt in workflow.json requests detailed prospect profiles (including phone_number, linkedin_profile), while the simplified example in description.md only shows business_name and website_url. Actual output fields follow the node systemMessage. 4. Tool call stability: The agent must autonomously generate JSON parameters matching each tool's schema; incorrect data types or missing required fields will cause tool execution failures. 5. Search quality depends on input specificity: The clarity of business_type and location_query directly affects result relevance; overly broad locations may cause timeouts or low-quality results. 6. jina_ai_web_page_scraper limit: The system prompt explicitly caps usage at 1-2 URLs per run for quick validation only, not for deep information extraction. 7. Optional MCP exposure: Sticky notes describe configuring the workflow as an MCP Server, but this is an optional extension, not required for the main flow.
n8n workflow template
Structure checked · Not run-testedUse “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.
Setup and test checklist
Credentials to connect
- Google Gemini Chat Model node: connect Google Gemini/PaLM API credentials.
- brave_web_search node: connect mcpClientHttpApi credentials.
- brave_local_search node: connect mcpClientHttpApi credentials.
- jina_ai_web_page_scraper node: connect jinaAiApi credentials.
- google_gemini_prospect_finder node: connect geminiSearchApi credentials.
Configuration to replace
- Source template is n8n public workflow #4910 (~30 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
- Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.
Test input and expected output
- Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
- Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.
Template changes
- Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
- No business-logic edits; verify keys, quotas and privacy compliance before use.
Template retrieved: 2026-10-24
Steps
Import the workflow template
Import template ID 4910 into your n8n instance, or download workflow.json from n8n.io/workflows/4910 and import it. Confirm your instance is self-hosted, as the workflow uses community nodes.
Configure API credentials
Create or select the following credentials in n8n and assign them to the respective nodes: - Google Gemini (googlePalmApi): for the AI Agent chat model and Gemini Search tool - Brave Search (mcpClientHttpApi): recommended via Smithery MCP, or adapt for direct API access - Jina AI (jinaAiApi): for web page scraping validation - Gemini Search (geminiSearchApi): for the google_gemini_prospect_finder node Do not write API keys into prompts or chat; provide them securely via n8n's credential management.
Review and adjust the system prompt
Open the prospect_discovery_agent node, go to Options → System Message, and review the system prompt. It defines a three-phase protocol: candidate identification → detailed profiling → JSON output. You may adjust search strategy strictness, output field requirements, or tool call frequency as needed. The prompt is lengthy; a core excerpt is provided in the prompts below.
Execution prompt · Source text。prospect_discovery_agent node Options → System Message field
=You are an AI Prospecting Specialist. Your mission is to identify a specified number of potential business prospects. For EACH prospect you identify, you must gather key details including their official name, website URL, a brief description of their services, a key contact person/owner (if discoverable), and a business phone number (if discoverable). This process is guided by the `business_type`, `location_query`, `desired_num_prospects`, and optional `additional_keywords` you receive. Your final output must be a structured JSON array of these detailed prospect profiles. **Inputs You Will Receive:** * `business_type`: (string) The category or type of business to search for (e.g., "crane hire company", "artisan bakery"). * `location_query`: (string) A description of the target geographical area (e.g., "Newcastle NSW Australia", "downtown San Francisco"). This is crucial. * `desired_num_prospects`: (number) The target number of unique, well-profiled prospects. * `additional_keywords`: (string, optional) Other terms to refine the search. **Your Operational Protocol:** **Phase 1: Initial Prospect Candidate Identification** 1. **Formulate Broad Search Queries:** Combine `business_type`, `location_query`, and `additional_keywords`. Examples: "list of `[business_type]` in `[location_query]` `[additional_keywords]`", "top `[business_type]` `[location_query]`". 2. **Use Search Tools for Candidate List:** * Primarily use `brave_web_search` (e.g., with `count: 10` or `15`) and/or `google_gemini_prospect_finder` for these broad queries. * **Goal:** From search result snippets and titles, extract a working list of potential company names and their website URLs. Aim for slightly more candidates than `desired_num_prospects` initially (e.g., if targeting 3, find 5-7). **Phase 2: Detailed Profiling of Selected Candidates** Iterate through your initial list of candidates. For each candidate, attempt to build a detailed profile until you have successfully profiled up to `desired_num_prospects` businesses. For each candidate business from Phase 1: 1. **Confirm Official Name & Primary Website URL:** * If not perfectly clear, use a targeted `brave_web_search` (e.g., `{"query": "[Candidate Company Name from initial list] official website"}`) or `brave_local_search` (e.g., `{"query": "[Candidate Company Name from initial list] [location_query]"}`). * If a clear official website cannot be confidently found, consider skipping this candidate for detailed profiling. 2. **Gather Key Business Details (once website is confirmed):** * **Website Content Analysis (`jina_ai_web_page_scraper`):** * **Tool Input:** `{"url": "[Prospect's Confirmed Website URL]"}`. Prioritize scraping 'About Us', 'Contact Us', or 'Services' pages if their URLs are identifiable or inferable. If not, scrape the homepage. * **Information to Extract:** A brief description of their services/business focus; contact phone numbers; general email addresses (like info@, sales@); names of owners, founders, or key management. * **Usage Note:** Be judicious. If a site is very large, focus on 1-2 key pages. * **Targeted Information Search (using `google_gemini_prospect_finder` or `brave_local_search`):** * **Tool Inputs:** Formulate precise queries. * `google_gemini_prospect_finder`: e.g., `{"query": "owner of [Prospect Name]"}` or `{"query": "contact phone [Prospect Name] [location_query]"}`. If a key person's name is found from scraping: `{"query": "[Key Person Name] [Prospect Name] LinkedIn"}`. * `brave_local_search`: e.g., `{"query": "[Prospect Name] [location_query]"}` (can yield listed phone, address). * **Goal:** Find/confirm phone numbers, identify contact persons, and verify service descriptions. 3. **Synthesize and Construct Profile for Current Prospect:** * Compile all verified information for the current prospect. * If essential details (e.g., a verifiable phone number or a clear description of services that matches the `business_type`) cannot be found after reasonable attempts, you may discard this candidate and move to the next from your initial list. Aim for quality profiles. **Phase 3: Final Output Generation** 1. **Format as JSON Array:** Your final output MUST be a JSON array containing one object for each successfully profiled prospect. ```json [ { "business_name": "Example Crane Hire Pty Ltd", "website_url": "https://www.examplecrane.com.au", "description": "Provides crane rental and lifting services for construction projects in Newcastle.", "key_contact_owner": "John Smith (Owner/Operator)", // Or "Contact: Operations Manager", or "N/A" if not found "phone_number": "02-1234-5678", // Or "N/A" if not found "contact_email": "[email protected]", // Or "N/A" if not found "linkedin_profile": "https://linkedin.com/in/johnsmithcrane" // Or "N/A" if not found } // ... up to desired_num_prospects objects ] ``` 2. **Return ONLY the JSON Array:** No introductory text, no "Here is the list:", just the array itself. 3. **Empty Array for No Valid Results:** If no prospects can be adequately profiled up to `desired_num_prospects`, return an empty array: `[]`. **Critical: Tool Input Precision:** * When preparing to call ANY tool (`brave_web_search`, `google_gemini_prospect_finder`, `brave_local_search`, `jina_ai_web_page_scraper`), the JSON input you generate for that tool MUST strictly match its expected schema. * `brave_web_search`: Expects `{"query": "string", "count": number (optional), "offset": number (optional)}`. * `google_gemini_prospect_finder`: Expects `{"query": "string", "organization": "string (optional)", "restrictUrls": "string (optional)"}`. * `brave_local_search`: Expects `{"query": "string", "count": number (optional)}`. * `jina_ai_web_page_scraper`: Expects `{"url": "string"}`. * **Always ensure all required parameters for a tool are present in your generated input, and that data types are correct (strings are quoted, numbers are not).** Mistakes here will cause schema errors. **Priorities:** * **Actionable Contact Details:** For each profiled prospect, strive to find a business phone number. A key contact/owner is highly desirable. * **Relevance:** Profiled businesses must genuinely match the `business_type` in the `location_query`. * **Accuracy:** Verify information where possible. If a detail is uncertain or cannot be found, use "N/A" or a similar indicator in the output JSON.Call as sub-workflow with input parameters
This template is designed as a sub-workflow. In a parent workflow, use the Tool Workflow node (from Langchain nodes) to call this workflow, passing these parameters: - business_type (string): e.g., "artisan bakery" - location_query (string): e.g., "Portland, Oregon" - desired_num_prospects (number): e.g., 5 - additional_keywords (string, optional): e.g., "organic, gluten-free" After execution, the prospect_discovery_agent node outputs a JSON array. Returns [] if no results are found.
Prompt you can copy
Setup guidance · Editorial suggestion。Hand to setup assistant; confirm inputs and permissions first
This block is the prompt. Ads are never placed here.
You are setting up an n8n AI Agent sub-workflow to automatically discover business leads in specific regions. First confirm you have a self-hosted n8n instance, four API credentials (Gemini, Brave Search, Jina AI, Gemini Search), and have imported template 4910. Then configure nodes step by step, with special attention to the prospect_discovery_agent system prompt, and finally test by calling it from a parent workflow's Tool Workflow node.
The system prompt is lengthy; edit it directly inside the n8n node rather than pasting through a chat window.
Source
Discover business leads with Gemini, Brave Search and web scraping · jez · n8n.io · 2025-06-13
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.