HubSpot + Google Docs: cleaner LinkedIn URLs
Your HubSpot contacts look “complete” until you try to segment by LinkedIn URL and realize half the field is blank, wrong, or stuffed with a random company page.
Marketing ops gets stuck cleaning it up. SDR teams feel it when routing breaks. And agency folks doing lead gen get the same headache at scale. This HubSpot LinkedIn URLs automation fills the missing profile links in a repeatable way, without turning your CRM into a guessing game.
You’ll see how the workflow pulls new/updated contacts, follows a Google Docs “research playbook,” finds the most likely LinkedIn profile, then writes back a cleaned URL you can actually trust.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: HubSpot + Google Docs: cleaner LinkedIn URLs
flowchart LR
subgraph sg0["HubSpot Event Flow"]
direction LR
n0@{ icon: "mdi:robot", form: "rounded", label: "Research Orchestrator", pos: "b", h: 48 }
n1["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/hubspot.svg' width='40' height='40' /></div><br/>Update HubSpot Contact"]
n2@{ icon: "mdi:wrench", form: "rounded", label: "Search API Tool", pos: "b", h: 48 }
n3["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/hubspot.svg' width='40' height='40' /></div><br/>Fetch Recent Contacts"]
n4["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/hubspot.svg' width='40' height='40' /></div><br/>HubSpot Event Trigger"]
n5@{ icon: "mdi:play-circle", form: "rounded", label: "Manual Execution Start", pos: "b", h: 48 }
n6["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Clean Thought Output"]
n7@{ icon: "mdi:cog", form: "rounded", label: "Fetch Google Doc", pos: "b", h: 48 }
n8@{ icon: "mdi:swap-vertical", form: "rounded", label: "Map Contact Fields", pos: "b", h: 48 }
n9@{ icon: "mdi:brain", form: "rounded", label: "OpenRouter Chat Engine", pos: "b", h: 48 }
n2 -.-> n0
n0 --> n6
n8 --> n0
n4 --> n8
n7 -.-> n0
n9 -.-> n0
n6 --> n1
n5 --> n3
n3 --> n8
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n4,n5 trigger
class n0 ai
class n9 aiModel
class n2 ai
class n6 code
classDef customIcon fill:none,stroke:none
class n1,n3,n4,n6 customIcon
The Problem: Missing (and Wrong) LinkedIn URLs in HubSpot
When LinkedIn URLs are missing in HubSpot, everything downstream gets sloppy. Lead scoring rules misfire. Sales sequences can’t personalize. Reporting becomes a mess because “LinkedIn URL exists” stops being a reliable filter. The worst part is how manual the fix feels: someone Googles a name, clicks around, second-guesses the result, then pastes a link that might be for a different person with the same title. Do that for even 50 contacts, and you’ve burned a whole afternoon on work nobody wants.
It adds up fast. Here’s where it usually breaks down.
- Manual profile research takes about 5 minutes per contact when everything goes well, and longer when names are common.
- Bad matches slip in quietly, so teams build segments on top of corrupted data.
- Different people “research” differently, which means you get inconsistent URLs and inconsistent confidence.
- Even if you fix it once, new contacts arrive every day and the backlog returns.
The Solution: A Google Docs Playbook + AI Research, Written Back to HubSpot
This workflow treats LinkedIn URL enrichment like a real process, not a one-off cleanup task. It starts when a HubSpot contact is created or updated (or when you run a manual batch for older records). n8n pulls the contact’s core identifiers like first name, last name, and email, then hands them to an AI Agent. Before the Agent searches anything, it reads a Google Doc you control, which contains your “research playbook” and the exact output format you want. From there, it uses SerpAPI to run a tight Google search and returns a likely LinkedIn profile URL. Finally, the workflow cleans the output (so you don’t store hidden model formatting) and updates the HubSpot contact property (like linkedinUrl) using email as the match key.
The workflow starts with HubSpot activity, then the AI Agent applies your Doc-based rules while searching. Once it finds a fit, HubSpot gets updated automatically so your CRM stays tidy without constant policing.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say your team imports 100 leads a week and about half are missing a LinkedIn URL. If a rep spends roughly 5 minutes researching and pasting each profile, that’s about 4 hours weekly for 50 contacts. With this workflow, the “work” becomes reviewing exceptions: a contact triggers the run automatically, the Agent searches, and HubSpot gets updated in the background. Most teams spend maybe 10 minutes spot-checking a batch instead of losing a morning to copy-paste.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- HubSpot to read and update contact records.
- Google Docs to host your research playbook.
- HubSpot Private App token (create it in HubSpot settings).
- Google Service Account (create in Google Cloud and share the Doc).
- OpenRouter API key (get it from your OpenRouter dashboard).
- SerpAPI key (get it from your SerpAPI account).
Skill level: Intermediate. You’ll connect accounts, create a HubSpot property, and paste a Doc URL and API keys.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
A contact changes in HubSpot. The workflow can fire from a HubSpot event trigger when a contact is created/updated, or you can run it manually to process a recent batch.
Contact details are prepared for research. n8n maps the fields the Agent needs (typically first name, last name, and email) so every lookup starts with the same structure.
Your Google Doc becomes the rulebook. The Agent reads your Google Docs playbook first, then uses SerpAPI to search for the most likely LinkedIn profile using those rules, not whatever a random team member “usually does.” Honestly, this is what makes the automation sustainable.
HubSpot gets the cleaned LinkedIn URL. The workflow strips extra formatting from the model response and updates the contact’s LinkedIn URL property so it’s ready for segmentation, routing, and reporting.
You can easily modify the Google Docs instructions to change how strict matching is, which sources to trust, or what the Agent should output (URL only vs. URL plus a short note). See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the HubSpot Trigger
Set up the workflow entry point so HubSpot events can initiate contact enrichment, and optionally allow manual runs for testing.
- Add the HubSpot Event Trigger node and keep the default event configuration unless you need specific event types.
- Credential Required: Connect your hubspotDeveloperApi credentials in HubSpot Event Trigger.
- Add Manual Execution Start to allow ad-hoc testing without HubSpot events.
- Connect Manual Execution Start to Fetch Recent Contacts and HubSpot Event Trigger to Map Contact Fields as shown in the workflow.
Step 2: Connect HubSpot Data Sources
Configure HubSpot nodes to pull recent contacts and prepare data for enrichment.
- In Fetch Recent Contacts, set Operation to
getRecentlyCreatedUpdatedand Authentication toappToken. - Credential Required: Connect your hubspotAppToken credentials in Fetch Recent Contacts.
- In Map Contact Fields, map the fields using these expressions: First Name to
{{ $json.properties.firstname.value }}, Last Name to{{ $json.properties.lastname.value }}, and Email to{{ $json['identity-profiles'][0].identities[0].value }}. - Ensure both Fetch Recent Contacts and HubSpot Event Trigger feed into Map Contact Fields.
identity-profiles, the Email mapping may return empty values—adjust the expression to match your account’s schema.Step 3: Set Up the AI Research Engine
Configure the AI agent to read a Google Doc for guidance, research the contact via search, and produce structured output.
- Open Research Orchestrator and set the Prompt to the provided text, keeping the embedded expressions like
{{ $json['First Name'] }},{{ $json['Last Name'] }}, and{{ $json.Email }}. - Connect OpenRouter Chat Engine as the language model for Research Orchestrator; Credential Required: Connect your openRouterApi credentials in OpenRouter Chat Engine.
- Connect Search API Tool as an AI tool for Research Orchestrator; Credential Required: Connect your serpApi credentials in Search API Tool.
- Connect Fetch Google Doc as an AI tool for Research Orchestrator and set Document URL to
Replace_With_URL. - Credential Required: Connect your googleApi credentials in Fetch Google Doc and keep Authentication set to
serviceAccount.
Step 4: Clean AI Output and Update HubSpot
Normalize the AI output and push the enriched data back to HubSpot.
- In Clean Thought Output, keep Mode set to
runOnceForEachItemand retain the provided JavaScript to remove<think>...</think>and code fences. - Connect Research Orchestrator to Clean Thought Output, then to Update HubSpot Contact.
- In Update HubSpot Contact, set Email to
{{ $('Map Contact Fields').item.json.Email }}. - In Update HubSpot Contact, set Additional Fields → linkedinUrl to
{{ $json.cleanText }}. - Credential Required: Connect your hubspotAppToken credentials in Update HubSpot Contact.
Step 5: Test and Activate Your Workflow
Validate the workflow end-to-end, then turn it on for production use.
- Click Execute Workflow and start from Manual Execution Start to process recent contacts.
- Confirm that Map Contact Fields outputs First Name, Last Name, and Email values.
- Verify Clean Thought Output returns a cleaned
cleanTextfield and that Update HubSpot Contact updates the contact’s linkedinUrl. - Once successful, toggle the workflow to Active so HubSpot Event Trigger runs automatically.
Common Gotchas
- HubSpot credentials can expire or your Private App token may lack scopes. If updates stop, check the HubSpot Private App settings and confirm the contact property permissions first.
- If you run batch mode with Split in Batches or add Wait logic, processing times can vary. Bump up any wait duration if downstream nodes act like the Agent “returned nothing.”
- OpenRouter prompts and default Agent instructions can be generic. Add your matching rules and brand-safe output format in the Google Doc early, or you’ll be cleaning results by hand later.
Frequently Asked Questions
About 45 minutes if you already have your API keys and the HubSpot linkedinUrl property ready.
No. You’ll mostly be connecting accounts and pasting credentials. The only “code” part is already included to clean the model output.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenRouter and SerpAPI usage, which is usually a small cost per lookup.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, and you’ll do most of it in Google Docs. Update the playbook to require signals like company name, location, or an email-domain hint, then have the Agent output “no match” when confidence is low. If you want to go further, you can swap the search settings in the SerpAPI tool (like limiting results) and adjust the Agent’s memory so it stays consistent across a batch run.
Usually it’s an expired or rotated Private App token, or the token doesn’t have the right scopes to update contacts. Double-check that the linkedinUrl property exists and that your HubSpot account allows updates through the API. If you’re using the HubSpot Trigger version, OAuth subscriptions to contact create/update events can also get disconnected and need reconnecting.
A few thousand a month is realistic for most small teams, and you can scale higher if you self-host and keep an eye on SerpAPI rate limits.
Often, yes, because this workflow benefits from branching logic, batch processing, and a more flexible AI Agent setup. Zapier and Make can do enrichment too, but the moment you need “read a Google Doc playbook, run a controlled search, clean the output, then update HubSpot,” the scenario gets expensive or brittle. n8n also gives you the self-host option, which matters when you want lots of runs without paying per task. If you only enrich a handful of contacts and want the simplest UI, Zapier or Make might be fine. Talk to an automation expert if you want help choosing.
Once this is running, “missing LinkedIn URLs” stops being a recurring project and becomes a background task you barely think about. Your HubSpot data stays cleaner, and your team finally trusts the field again.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.