# What You'll Build (and Why It Matters)#
This guide shows a practical approach to CRM automation n8n for HubSpot or Pipedrive: lead scoring, automated follow-ups, and lightweight reporting. The goal is simple—reduce manual CRM admin while improving speed-to-lead and consistency.
Responding quickly matters. Harvard Business Review’s often-cited analysis found that companies responding to leads within 1 hour are far more likely to qualify them than those responding later (and the drop-off worsens after a few hours). Automation is the cheapest way to get “fast response” without hiring more headcount.
If you’re unsure whether you’re ready, check 5 signs your business needs automation. If you want help scoping or implementing this end-to-end, see our automation services.
# Prerequisites#
| Requirement | Recommended | Notes |
|---|---|---|
| n8n | Latest stable | Cloud or self-hosted; self-host for maximum control |
| HubSpot or Pipedrive account | Admin access | Needed for API tokens/apps and custom fields |
| Email provider | SMTP / SendGrid / Gmail | For follow-ups; or use CRM email sequences |
| Slack or Teams (optional) | — | For instant sales notifications |
| Basic CRM hygiene | Unique IDs + required fields | Email as unique identifier is typical |
Data model you should add to your CRM#
Create (or confirm) these properties/fields. This prevents “automation spaghetti” and makes reporting reliable.
| Field | Type | Example | Used for |
|---|---|---|---|
| lead_score | number | 0–100 | Routing, prioritization |
| lead_grade | dropdown | A / B / C | Human-friendly scoring |
| automation_status | dropdown | new / scored / contacted / nurtured | Idempotency + visibility |
| last_automated_at | datetime | 2026-03-05T12:30Z | Debugging + reporting |
| next_followup_at | datetime | 2026-03-06T09:00Z | Delays/scheduling |
| source_detail | text | “Pricing page form” | Attribution |
💡 Tip: Keep scoring fields on the Contact/Person record, and “follow-up task fields” on the Deal where possible. Sales teams live in deals; marketing signals live on contacts.
# Architecture: 3 Workflows That Cover 80% of CRM Automation#
You’ll implement three workflows in n8n:
| Workflow | Trigger | Outcome |
|---|---|---|
| 1) Lead intake + scoring | Webhook / CRM event | Enrich + score + update CRM |
| 2) Follow-ups + task creation | “Scored lead” state | Create tasks, send email/Slack, schedule next step |
| 3) Reporting digest | Cron | Daily/weekly metrics pushed to Slack/email |
This separation matters because it keeps each workflow small, testable, and easier to modify without breaking everything.
# Step 1: Connect HubSpot or Pipedrive to n8n (Securely)#
HubSpot connection options#
Best option: HubSpot Private App token (simple + secure for server-to-server automation). Create a Private App in HubSpot and grant scopes like CRM objects (contacts, companies, deals) and webhook permissions if needed.
Pipedrive connection options#
Use a Pipedrive API token or OAuth app (OAuth is better when you deploy for multiple clients). You’ll typically need scopes for persons, organizations, deals, activities.
Recommended secret handling#
| Secret | Where to store | Why |
|---|---|---|
| HubSpot private app token | n8n credentials | Keeps tokens out of nodes |
| Pipedrive API token | n8n credentials | Easy rotation |
| Enrichment API keys (Clearbit, etc.) | n8n credentials + env vars | Avoid leaking in exports |
| SMTP/SendGrid keys | n8n credentials | Email reliability |
⚠️ Warning: Don’t paste API keys into Function node code or HTTP node headers directly. When workflows get duplicated/exported, keys leak into version control or tickets.
# Step 2: Workflow 1 — Lead Intake + Lead Scoring (HubSpot/Pipedrive)#
What this workflow does#
- 1Receives a new lead event (form submit, inbound email, chat lead, etc.).
- 2Enriches the lead (optional but powerful).
- 3Calculates a lead score (0–100) based on rules.
- 4Updates CRM properties and sets
automation_status = scored. - 5Notifies sales if score is above a threshold.
Trigger options (choose one)#
| Trigger | Pros | Cons | When to use |
|---|---|---|---|
| Webhook from website/form | Real-time, cheap | Needs dev work to send payload | Custom site, Next.js forms |
| HubSpot webhook | Native events | Setup requires app config | HubSpot-first stack |
| Pipedrive webhook | Native events | Setup + filtering | Pipedrive-first stack |
| Polling (Cron + “Get new”) | Simple | Not real-time | Low volume, MVP |
Example payload (from your website form)#
Keep it consistent and include a stable dedupe key (email).
{
"email": "maria@acme.com",
"firstName": "Maria",
"lastName": "Kovac",
"company": "ACME",
"role": "Head of Operations",
"source": "pricing_form",
"utm_source": "google",
"utm_campaign": "crm_automation",
"page": "/pricing",
"message": "Need HubSpot + n8n automation"
}Scoring model (simple, effective, adjustable)#
Start with explicit scoring (firmographics + intent). You can improve later with historical conversion data.
| Signal | Rule | Points |
|---|---|---|
| Role seniority | “Head/Director/VP/C-level” in role | +15 |
| Company size | 11–50 = +10, 51–200 = +15, 200+ = +20 | +10 to +20 |
| Source intent | Pricing page / demo request | +20 |
| Email domain | Free email provider (gmail/yahoo) | -15 |
| Message contains | “integration”, “automation”, “API”, “n8n” | +10 |
| Geography | EU/UK/US (if you sell there) | +5 |
n8n node outline (HubSpot example)#
Use these nodes in order:
- 1Webhook (lead intake)
- 2Set (normalize fields)
- 3HubSpot → Search contact by email
- 4HubSpot → Create/Update contact (upsert)
- 5Function (calculate score)
- 6HubSpot → Update contact properties (
lead_score,lead_grade,automation_status) - 7IF (score >= threshold)
- 8Slack (notify) or HubSpot (create task)
Lead scoring Function node (copy-paste starter)
Keep this under 20 lines and treat it as a baseline.
const lead = $json;
let score = 0;
const role = (lead.role || '').toLowerCase();
const page = (lead.page || '').toLowerCase();
const email = (lead.email || '').toLowerCase();
const msg = (lead.message || '').toLowerCase();
if (/(head|director|vp|chief|cto|ceo|cfo|coo)/.test(role)) score += 15;
if (page.includes('pricing') || msg.includes('demo')) score += 20;
if (/(automation|integration|api|n8n)/.test(msg)) score += 10;
if (/@(gmail|yahoo|outlook)\./.test(email)) score -= 15;
score = Math.max(0, Math.min(100, score));
const grade = score >= 70 ? 'A' : score >= 40 ? 'B' : 'C';
return [{ ...lead, lead_score: score, lead_grade: grade }];Pipedrive variant (what changes)#
The logic stays the same; only the nodes differ:
- Search Person by email
- Upsert Person
- Update custom fields (you must create fields and map their IDs)
- Optionally create a Deal and an Activity (task)
ℹ️ Note: Pipedrive custom fields often require referencing field IDs (e.g.,
custom_field_hash). Document these in a table in your project README to avoid breaking changes when fields are renamed.
# Step 3: Workflow 2 — Automated Follow-ups (Tasks, Email, and SLA Control)#
Why follow-ups should be automated#
Most teams don’t lose deals because their product is weak—they lose them because follow-up is inconsistent. Automation enforces a service-level agreement (SLA): “Every A lead gets touched within 15 minutes; every B lead within 4 hours.”
Follow-up strategy (practical defaults)#
| Lead grade | Response time target | Action | Owner |
|---|---|---|---|
| A (70–100) | 15 min | Slack alert + task + email | Assigned sales rep |
| B (40–69) | 4 hours | Task + email (optional) | Round-robin |
| C (0–39) | 24 hours | Add to nurture / newsletter | Marketing |
Node outline (works for HubSpot or Pipedrive)#
- 1Trigger: CRM event (“contact updated” where
automation_status = scored) or a Cron that searches forautomation_status = scored AND lead_score >= X. - 2IF: Grade A/B/C
- 3Assign owner: round-robin via n8n Data Store / Google Sheet / simple static mapping
- 4Create task/activity in CRM
- 5Send email (optional) with a personalized template
- 6Update CRM:
automation_status = contacted,next_followup_at,last_automated_at
Round-robin assignment (simple, reliable)#
If you don’t have a router already, use an n8n Data Store key like rr_index.
| Sales rep | CRM owner ID | Weight |
|---|---|---|
| Ana | 104839 | 1 |
| Marko | 204128 | 1 |
| Ivana | 998123 | 1 |
Increment rr_index each run and pick index % reps.length. Keep it deterministic so you can debug assignments.
Example: create a HubSpot task with an SLA#
In HubSpot, tasks are typically Engagements. Use the HubSpot node to create a task associated with the contact/deal.
{
"subject": "Follow up with {{firstName}} (Lead grade {{lead_grade}})",
"body": "Source: {{source_detail}}\nMessage: {{message}}\nLead score: {{lead_score}}",
"dueDate": "{{ $now.plus({ minutes: lead_grade === 'A' ? 15 : 240 }).toISO() }}"
}Example: send an immediate email for Grade A leads#
Use an email node (SMTP/SendGrid). Keep it short and contextual.
Subject: Quick question about your CRM automation
Hi {{firstName}},
I saw your request about {{source_detail}}. Are you using HubSpot or Pipedrive today, and what’s the #1 workflow you want to automate first (scoring, follow-ups, reporting)?
— {{ownerName}}💡 Tip: If compliance is a concern (GDPR/opt-in), don’t send automated sales emails to cold leads. Instead, create tasks and notify reps, or use CRM’s built-in consent-aware sequences.
# Step 4: Workflow 3 — Reporting Digest (Daily/Weekly, No BI Required)#
What to report (metrics that change behavior)#
Avoid vanity metrics. Track numbers that improve pipeline quality and response speed.
| Metric | How to compute | Why it matters |
|---|---|---|
| New leads | Count created in last 24h | Volume trend |
| A/B/C distribution | Group by lead_grade | Lead quality |
| Speed-to-lead | first_contacted_at - created_at | Conversion lever |
| Task completion rate | Completed tasks / created tasks | Follow-through |
| Source performance | Leads by source_detail + grade | Budget allocation |
Node outline#
- 1Cron (every weekday 08:00)
- 2HubSpot/Pipedrive search: leads created yesterday
- 3Aggregate: totals, grade distribution
- 4Format: Markdown message
- 5Slack or Email
- 6(Optional) Google Sheets append row for historical trend
Slack digest message (example)#
Daily CRM Digest ({{date}})
New leads: 34
Grade A: 6 | Grade B: 14 | Grade C: 14
Median speed-to-lead: 42 min (target: < 60 min)
Top sources:
- pricing_form: 12 (A: 4)
- webinar_signup: 9 (A: 1)
- contact_page: 7 (A: 0)🎯 Key Takeaway: A daily digest only works if it includes one metric the team is accountable for (usually speed-to-lead). Everything else is supporting context.
# Implementation Details That Prevent Pain Later#
1) Idempotency and deduplication#
Automation fails silently when you create duplicates and everyone stops trusting the CRM. Apply these rules:
| Object | Dedupe key | Action |
|---|---|---|
| Contact/Person | Search → update; create only if missing | |
| Company/Org | domain | Search by domain; create if missing |
| Deal | contact ID + pipeline stage + month | Avoid creating multiple “same” deals |
| Task/Activity | contact ID + type + date | Don’t spam tasks on retries |
2) Retries, rate limits, and backoff#
HubSpot and Pipedrive both enforce API limits. n8n supports retries, but you should still:
- Add a short Wait node after bursts (e.g., 200ms–500ms).
- Use batch processing for reporting.
- Handle
429responses (too many requests) with retry/backoff.
3) Logging you can actually use#
At minimum, write a log line back into the CRM:
| Log field | Example | Why |
|---|---|---|
| last_automated_at | timestamp | When did automation run? |
| automation_status | scored/contacted/nurtured | What stage is automation at? |
| automation_notes | “Scored A, notified #sales” | Quick audit trail |
If you need deeper visibility, push logs to a database or a Google Sheet. For higher-scale ops, consider a proper log sink.
# Common Pitfalls (and How to Avoid Them)#
- 1Scoring becomes a “black box” — Keep the scoring rules documented in a table and store the reasons (e.g.,
score_breakdown) if sales challenges it. - 2No owner assignment — Leads without an owner don’t get worked. Implement round-robin or deterministic mapping from day one.
- 3Workflows trigger each other endlessly — Use
automation_statusto prevent loops (e.g., only score when status isnew, only follow up whenscored). - 4You automate email without consent — If opt-in is unclear, automate tasks/notifications instead of outbound email.
- 5Reporting is disconnected from actions — If the digest doesn’t drive behavior, reduce it to 3–5 metrics and add targets.
# Key Takeaways#
- Build CRM automation n8n as three separate workflows: intake+scoring, follow-ups, and reporting—this keeps changes safe and fast.
- Use upsert + dedupe keys (email/domain) to prevent duplicate contacts, deals, and tasks.
- Start lead scoring with a simple 0–100 rule-based model, then iterate based on conversion outcomes and sales feedback.
- Enforce speed-to-lead with SLA-driven tasks and alerts (e.g., Grade A within 15 minutes).
- Make reporting actionable: send a daily digest with grade distribution and speed-to-lead, not vanity metrics.
# Conclusion#
Automating your CRM with n8n is one of the highest-ROI improvements you can make in sales ops: leads get scored consistently, follow-ups happen on time, and reporting becomes automatic instead of a weekly scramble.
If you want Samioda to help you implement a production-ready setup (HubSpot/Pipedrive + n8n + lead scoring + follow-ups + reporting), start here: https://samioda.com/en/automation.
FAQ
More in Business Automation
All →10 E-Commerce Automation Workflows That Save Hours Every Week (n8n Examples)
A practical guide to ecommerce automation workflows: 10 proven automations for order processing, inventory alerts, reviews, abandoned carts, support, and analytics — with n8n workflow examples you can copy.
Small Business Automation: Complete Guide for 2026
A practical, affordable guide to small business automation in 2026 — identify high-ROI workflows, calculate payback, and implement automations with n8n step-by-step.
How to Automate Your Invoicing Process: Step-by-Step n8n Guide (2026)
A practical, step-by-step guide to automate your invoicing process with n8n: invoice generation, email sending, payment reminders, and reconciliation with accounting-ready logs.
Need help with your project?
We build custom solutions using the technologies discussed in this article. Senior team, fixed prices.
Related Articles
10 E-Commerce Automation Workflows That Save Hours Every Week (n8n Examples)
A practical guide to ecommerce automation workflows: 10 proven automations for order processing, inventory alerts, reviews, abandoned carts, support, and analytics — with n8n workflow examples you can copy.
Small Business Automation: Complete Guide for 2026
A practical, affordable guide to small business automation in 2026 — identify high-ROI workflows, calculate payback, and implement automations with n8n step-by-step.
How to Automate Your Invoicing Process: Step-by-Step n8n Guide (2026)
A practical, step-by-step guide to automate your invoicing process with n8n: invoice generation, email sending, payment reminders, and reconciliation with accounting-ready logs.