Back to Catalog

Personalized outreach for lawyers with LinkedIn scraping, GPT-4o, Google Sheets

Ibrahim MalickIbrahim Malick
2371 views
2/3/2026
Official Page

Screenshot 20250612 120714.png ⚠️ This template uses only official n8n nodes. No community nodes required.

πŸ§‘β€πŸ’Ό Who is this for?

This workflow is designed for:

  • Legal tech founders
  • Marketing freelancers or consultants
  • Agencies supporting lawyers and small law firms
  • Anyone doing outbound outreach in the legal niche

❓ What problem is this solving?

LinkedIn is a goldmine for targeting legal professionals β€” but scraping and personalizing outreach is tedious and expensive. Most tools either:

  • Require paid LinkedIn Sales Navigator
  • Can’t personalize at scale
  • Violate LinkedIn’s TOS

This workflow solves that by using free Google Search, OpenRouter AI, and GPT-4o to find, enrich, and message up to 1,000 solo lawyers per day β€” without using browser automation or scrapers.


βš™οΈ What this workflow does

  1. Uses Google Programmable Search to find solo lawyers and small firm founders on LinkedIn
  2. Parses each profile’s name, title, profile URL, and snippet
  3. Saves raw lead data to Google Sheets
  4. Uses OpenRouter Sonar Pro to enrich each profile with external content
  5. Generates a personalized, 1-line message using GPT-4o
  6. Appends the final message into Google Sheets for outreach

πŸ› οΈ Setup

Estimated time: 15–20 minutes

βœ… Google Programmable Search

  • Enable the Custom Search API on Google Cloud
  • Create a programmable search engine set to search the full web
  • Copy your API key and CX ID

βœ… Google Sheets

  • Create a sheet with columns: Name, Title, Profile URL, Outreach Message
  • Share the sheet with your OAuth-connected Google account

βœ… OpenRouter

  • Sign up at openrouter.ai
  • Fund with at least $5 and generate your API key
  • Use the model perplexity/sonar-pro for real-time research

βœ… GPT-4o (optional)

  • You can use your OpenAI key or route GPT-4o via OpenRouter

All setup-specific values are marked clearly in sticky notes and placeholders.


πŸ› οΈ How to customize this workflow to your needs

  • Change the Google search query to match your industry (e.g., "founder" AND "therapist" site:linkedin.com/in)
  • Modify the AI prompt to match your tone (formal, casual, humorous)
  • Connect the final output to your CRM (like HubSpot, Airtable, etc.)
  • Add a second outreach message variant to A/B test performance

πŸ“Œ Sticky Notes & Annotations

  • All nodes are clearly renamed for understandability (e.g., Find Lawyer Profiles, Parse LinkedIn Search Results)
  • Color-coded sticky notes explain:
    • Setup instructions
    • Required credentials
    • Use caseScreenshot 20250612 113505.png

πŸ—‚ Category

  • AI
  • Sales
  • Marketing

n8n Workflow: Personalized Outreach for Lawyers with LinkedIn Scraping & AI

This n8n workflow automates the process of generating personalized outreach messages for lawyers by scraping LinkedIn profiles, enriching data with AI, and storing the results in Google Sheets. It's designed to streamline lead generation and outreach efforts, making them more targeted and efficient.

What it does

This workflow performs the following key steps:

  1. Triggers on Schedule: The workflow starts on a predefined schedule, ensuring regular execution.
  2. Reads Data from Google Sheets: It fetches a list of potential lawyer leads from a specified Google Sheet. This sheet is expected to contain LinkedIn profile URLs.
  3. Extracts LinkedIn Profile IDs: A Code node processes the LinkedIn URLs to extract the unique profile ID for each lawyer.
  4. Scrapes LinkedIn Profile Data: For each profile ID, an HTTP Request node is used to interact with a LinkedIn scraping API (likely a third-party service, given the HTTP Request node's configuration). This step retrieves detailed information from the LinkedIn profiles.
  5. Filters for Valid Profiles: An If node checks if the LinkedIn scraping was successful and if valid data was returned. Profiles that failed to scrape or returned empty data are filtered out.
  6. Generates Personalized Outreach with AI: For successful scrapes, an AI Agent node (likely leveraging OpenAI or OpenRouter) is used to generate a personalized outreach message based on the scraped LinkedIn profile data. This agent is configured to use either an OpenAI Chat Model or an OpenRouter Chat Model.
  7. Updates Google Sheets: The generated personalized outreach message, along with the scraped data, is written back to the Google Sheet, enriching the lead list.
  8. Handles Errors/Invalid Profiles: Profiles that failed the scraping or AI generation steps are also processed, allowing for potential logging or further action (though not explicitly shown in this simplified connection).

Prerequisites/Requirements

To use this workflow, you will need:

  • n8n Instance: A running n8n instance.
  • Google Sheets Account: A Google account with access to Google Sheets. You'll need to create a spreadsheet with your initial lawyer leads (at least LinkedIn profile URLs).
  • LinkedIn Scraping API: Access to a LinkedIn scraping API. The HTTP Request node will need to be configured with the appropriate endpoint, API key, and parameters for your chosen service.
  • OpenAI API Key or OpenRouter API Key: An API key for either OpenAI or OpenRouter to power the AI Agent for personalized message generation. You will need to configure the respective credentials in n8n.

Setup/Usage

  1. Import the Workflow: Download the provided JSON and import it into your n8n instance.
  2. Configure Credentials:
    • Google Sheets: Set up your Google Sheets credential.
    • OpenAI/OpenRouter: Set up your OpenAI or OpenRouter credential with your API key.
  3. Configure Google Sheets Node (ID: 18):
    • Specify the Spreadsheet ID and Sheet Name where your lawyer leads are stored and where the enriched data will be written.
    • Ensure the sheet has a column for LinkedIn profile URLs and columns to store the scraped data and the generated outreach message.
  4. Configure HTTP Request Node (ID: 19):
    • Update the URL, headers (e.g., API key), and body of the request to match your chosen LinkedIn scraping API. The current setup suggests a POST request to a specific endpoint.
  5. Configure AI Agent Node (ID: 1119):
    • Select your preferred Chat Model (OpenAI or OpenRouter) and ensure the corresponding credential is set.
    • Review and adjust the System Prompt and User Prompt to guide the AI in generating the desired personalized outreach messages based on the LinkedIn profile data.
  6. Configure Schedule Trigger Node (ID: 839):
    • Adjust the schedule (e.g., daily, weekly) according to your needs for running the outreach process.
  7. Activate the Workflow: Once all configurations are complete, activate the workflow. It will then run automatically based on the defined schedule.

Related Templates

Auto-create TikTok videos with VEED.io AI avatars, ElevenLabs & GPT-4

πŸ’₯ Viral TikTok Video Machine: Auto-Create Videos with Your AI Avatar --- 🎯 Who is this for? This workflow is for content creators, marketers, and agencies who want to use Veed.io’s AI avatar technology to produce short, engaging TikTok videos automatically. It’s ideal for creators who want to appear on camera without recording themselves, and for teams managing multiple brands who need to generate videos at scale. --- βš™οΈ What problem this workflow solves Manually creating videos for TikTok can take hours β€” finding trends, writing scripts, recording, and editing. By combining Veed.io, ElevenLabs, and GPT-4, this workflow transforms a simple Telegram input into a ready-to-post TikTok video featuring your AI avatar powered by Veed.io β€” speaking naturally with your cloned voice. --- πŸš€ What this workflow does This automation links Veed.io’s video-generation API with multiple AI tools: Analyzes TikTok trends via Perplexity AI Writes a 10-second viral script using GPT-4 Generates your voiceover via ElevenLabs Uses Veed.io (Fabric 1.0 via FAL.ai) to animate your avatar and sync the lips to the voice Creates an engaging caption + hashtags for TikTok virality Publishes the video automatically via Blotato TikTok API Logs all results to Google Sheets for tracking --- 🧩 Setup Telegram Bot Create your bot via @BotFather Configure it as the trigger for sending your photo and theme Connect Veed.io Create an account on Veed.io Get your FAL.ai API key (Veed Fabric 1.0 model) Use HTTPS image/audio URLs compatible with Veed Fabric Other APIs Add Perplexity, ElevenLabs, and Blotato TikTok keys Connect your Google Sheet for logging results --- πŸ› οΈ How to customize this workflow Change your Avatar: Upload a new image through Telegram, and Veed.io will generate a new talking version automatically. Modify the Script Style: Adjust the GPT prompt for tone (educational, funny, storytelling). Adjust Voice Tone: Tweak ElevenLabs stability and similarity settings. Expand Platforms: Add Instagram, YouTube Shorts, or X (Twitter) posting nodes. Track Performance: Customize your Google Sheet to measure your most successful Veed.io-based videos. --- 🧠 Expected Outcome In just a few seconds after sending your photo and theme, this workflow β€” powered by Veed.io β€” creates a fully automated TikTok video featuring your AI avatar with natural lip-sync and voice. The result is a continuous stream of viral short videos, made without cameras, editing, or effort. --- βœ… Import the JSON file in n8n, add your API keys (including Veed.io via FAL.ai), and start generating viral TikTok videos starring your AI avatar today! πŸŽ₯ Watch This Tutorial --- πŸ“„ Documentation: Notion Guide Need help customizing? Contact me for consulting and support : Linkedin / Youtube

Dr. FirasBy Dr. Firas
39510

Automate invoice processing with OCR, GPT-4 & Salesforce opportunity creation

PDF Invoice Extractor (AI) End-to-end pipeline: Watch Drive ➜ Download PDF ➜ OCR text ➜ AI normalize to JSON ➜ Upsert Buyer (Account) ➜ Create Opportunity ➜ Map Products ➜ Create OLI via Composite API ➜ Archive to OneDrive. --- Node by node (what it does & key setup) 1) Google Drive Trigger Purpose: Fire when a new file appears in a specific Google Drive folder. Key settings: Event: fileCreated Folder ID: google drive folder id Polling: everyMinute Creds: googleDriveOAuth2Api Output: Metadata { id, name, ... } for the new file. --- 2) Download File From Google Purpose: Get the file binary for processing and archiving. Key settings: Operation: download File ID: ={{ $json.id }} Creds: googleDriveOAuth2Api Output: Binary (default key: data) and original metadata. --- 3) Extract from File Purpose: Extract text from PDF (OCR as needed) for AI parsing. Key settings: Operation: pdf OCR: enable for scanned PDFs (in options) Output: JSON with OCR text at {{ $json.text }}. --- 4) Message a model (AI JSON Extractor) Purpose: Convert OCR text into strict normalized JSON array (invoice schema). Key settings: Node: @n8n/n8n-nodes-langchain.openAi Model: gpt-4.1 (or gpt-4.1-mini) Message role: system (the strict prompt; references {{ $json.text }}) jsonOutput: true Creds: openAiApi Output (per item): $.message.content β†’ the parsed JSON (ensure it’s an array). --- 5) Create or update an account (Salesforce) Purpose: Upsert Buyer as Account using an external ID. Key settings: Resource: account Operation: upsert External Id Field: taxid_c External Id Value: ={{ $json.message.content.buyer.tax_id }} Name: ={{ $json.message.content.buyer.name }} Creds: salesforceOAuth2Api Output: Account record (captures Id) for downstream Opportunity. --- 6) Create an opportunity (Salesforce) Purpose: Create Opportunity linked to the Buyer (Account). Key settings: Resource: opportunity Name: ={{ $('Message a model').item.json.message.content.invoice.code }} Close Date: ={{ $('Message a model').item.json.message.content.invoice.issue_date }} Stage: Closed Won Amount: ={{ $('Message a model').item.json.message.content.summary.grand_total }} AccountId: ={{ $json.id }} (from Upsert Account output) Creds: salesforceOAuth2Api Output: Opportunity Id for OLI creation. --- 7) Build SOQL (Code / JS) Purpose: Collect unique product codes from AI JSON and build a SOQL query for PricebookEntry by Pricebook2Id. Key settings: pricebook2Id (hardcoded in script): e.g., 01sxxxxxxxxxxxxxxx Source lines: $('Message a model').first().json.message.content.products Output: { soql, codes } --- 8) Query PricebookEntries (Salesforce) Purpose: Fetch PricebookEntry.Id for each Product2.ProductCode. Key settings: Resource: search Query: ={{ $json.soql }} Creds: salesforceOAuth2Api Output: Items with Id, Product2.ProductCode (used for mapping). --- 9) Code in JavaScript (Build OLI payloads) Purpose: Join lines with PBE results and Opportunity Id ➜ build OpportunityLineItem payloads. Inputs: OpportunityId: ={{ $('Create an opportunity').first().json.id }} Lines: ={{ $('Message a model').first().json.message.content.products }} PBE rows: from previous node items Output: { body: { allOrNone:false, records:[{ OpportunityLineItem... }] } } Notes: Converts discount_total ➜ per-unit if needed (currently commented for standard pricing). Throws on missing PBE mapping or empty lines. --- 10) Create Opportunity Line Items (HTTP Request) Purpose: Bulk create OLIs via Salesforce Composite API. Key settings: Method: POST URL: https://<your-instance>.my.salesforce.com/services/data/v65.0/composite/sobjects Auth: salesforceOAuth2Api (predefined credential) Body (JSON): ={{ $json.body }} Output: Composite API results (per-record statuses). --- 11) Update File to One Drive Purpose: Archive the original PDF in OneDrive. Key settings: Operation: upload File Name: ={{ $json.name }} Parent Folder ID: onedrive folder id Binary Data: true (from the Download node) Creds: microsoftOneDriveOAuth2Api Output: Uploaded file metadata. --- Data flow (wiring) Google Drive Trigger β†’ Download File From Google Download File From Google β†’ Extract from File β†’ Update File to One Drive Extract from File β†’ Message a model Message a model β†’ Create or update an account Create or update an account β†’ Create an opportunity Create an opportunity β†’ Build SOQL Build SOQL β†’ Query PricebookEntries Query PricebookEntries β†’ Code in JavaScript Code in JavaScript β†’ Create Opportunity Line Items --- Quick setup checklist πŸ” Credentials: Connect Google Drive, OneDrive, Salesforce, OpenAI. πŸ“‚ IDs: Drive Folder ID (watch) OneDrive Parent Folder ID (archive) Salesforce Pricebook2Id (in the JS SOQL builder) 🧠 AI Prompt: Use the strict system prompt; jsonOutput = true. 🧾 Field mappings: Buyer tax id/name β†’ Account upsert fields Invoice code/date/amount β†’ Opportunity fields Product name must equal your Product2.ProductCode in SF. βœ… Test: Drop a sample PDF β†’ verify: AI returns array JSON only Account/Opportunity created OLI records created PDF archived to OneDrive --- Notes & best practices If PDFs are scans, enable OCR in Extract from File. If AI returns non-JSON, keep β€œReturn only a JSON array” as the last line of the prompt and keep jsonOutput enabled. Consider adding validation on parsing.warnings to gate Salesforce writes. For discounts/taxes in OLI: Standard OLI fields don’t support per-line discount amounts directly; model them in UnitPrice or custom fields. Replace the Composite API URL with your org’s domain or use the Salesforce node’s Bulk Upsert for simplicity.

Le NguyenBy Le Nguyen
942

Tax deadline management & compliance alerts with GPT-4, Google Sheets & Slack

AI-Driven Tax Compliance & Deadline Management System Description Automate tax deadline monitoring with AI-powered insights. This workflow checks your tax calendar daily at 8 AM, uses GPT-4 to analyze upcoming deadlines across multiple jurisdictions, detects overdue and critical items, and sends intelligent alerts via email and Slack only when immediate action is required. Perfect for finance teams and accounting firms who need proactive compliance management without manual tracking. πŸ›οΈπŸ€–πŸ“Š Good to Know AI-Powered: GPT-4 provides risk assessment and strategic recommendations Multi-Jurisdiction: Handles Federal, State, and Local tax requirements automatically Smart Alerts: Only notifies executives when deadlines are overdue or critical (≀3 days) Priority Classification: Categorizes deadlines as Overdue, Critical, High, or Medium priority Dual Notifications: Critical alerts to leadership + daily summaries to team channel Complete Audit Trail: Logs all checks and deadlines to Google Sheets for compliance records How It Works Daily Trigger - Runs at 8:00 AM every morning Fetch Data - Pulls tax calendar and company configuration from Google Sheets Analyze Deadlines - Calculates days remaining, filters by jurisdiction/entity type, categorizes by priority AI Analysis - GPT-4 provides strategic insights and risk assessment on upcoming deadlines Smart Routing - Only sends alerts if overdue or critical deadlines exist Critical Alerts - HTML email to executives + Slack alert for urgent items Team Updates - Slack summary to finance channel with all upcoming deadlines Logging - Records compliance check results to Google Sheets for audit trail Requirements Google Sheets Structure Sheet 1: TaxCalendar DeadlineID | DeadlineName | DeadlineDate | Jurisdiction | Category | AssignedTo | IsActive FED-Q1 | Form 1120 Q1 | 2025-04-15 | Federal | Income | John Doe | TRUE Sheet 2: CompanyConfig (single row) Jurisdictions | EntityType | FiscalYearEnd Federal, California | Corporation | 12-31 Sheet 3: ComplianceLog (auto-populated) Date | AlertLevel | TotalUpcoming | CriticalCount | OverdueCount 2025-01-15 | HIGH | 12 | 3 | 1 Credentials Needed Google Sheets - Service Account OAuth2 OpenAI - API Key (GPT-4 access required) SMTP - Email account for sending alerts Slack - Bot Token with chat:write permission Setup Steps Import workflow JSON into n8n Add all 4 credentials Replace these placeholders: YOURTAXCALENDAR_ID - Tax calendar sheet ID YOURCONFIGID - Company config sheet ID YOURLOGID - Compliance log sheet ID C12345678 - Slack channel ID tax@company.com - Sender email cfo@company.com - Recipient email Share all sheets with Google service account email Invite Slack bot to channels Test workflow manually Activate the trigger Customizing This Workflow Change Alert Thresholds: Edit "Analyze Deadlines" node: Critical: Change <= 3 to <= 5 for 5-day warning High: Change <= 7 to <= 14 for 2-week notice Medium: Change <= 30 to <= 60 for 2-month lookout Adjust Schedule: Edit "Daily Tax Check" trigger: Change hour/minute for different run time Add multiple trigger times for tax season (8 AM, 2 PM, 6 PM) Add More Recipients: Edit "Send Email" node: To: cfo@company.com, director@company.com CC: accounting@company.com BCC: archive@company.com Customize Email Design: Edit "Format Email" node to change colors, add logo, or modify layout Add SMS Alerts: Insert Twilio node after "Is Critical" for emergency notifications Integrate Task Management: Add HTTP Request node to create tasks in Asana/Jira for critical deadlines Troubleshooting | Issue | Solution | |-------|----------| | No deadlines found | Check date format (YYYY-MM-DD) and IsActive = TRUE | | AI analysis failed | Verify OpenAI API key and account credits | | Email not sending | Test SMTP credentials and check if critical condition met | | Slack not posting | Invite bot to channel and verify channel ID format | | Permission denied | Share Google Sheets with service account email | πŸ“ž Professional Services Need help with implementation or customization? Our team offers: 🎯 Custom workflow development 🏒 Enterprise deployment support πŸŽ“ Team training sessions πŸ”§ Ongoing maintenance πŸ“Š Custom reporting & dashboards πŸ”— Additional API integrations Discover more workflows – Get in touch with us

Oneclick AI SquadBy Oneclick AI Squad
93