March 27, 2026
6 min read
Share article

How to Build a CRM Automation Workflow in n8n From Scratch

Build a CRM automation workflow in n8n from scratch

CRM automation is where AI agencies make the most recurring revenue. Every small and medium business has a CRM — or desperately needs one — and virtually none of them are using it effectively. Manual data entry, forgotten follow-ups, stale deal stages, and missed touchpoints cost these businesses real revenue every day. Building a CRM automation workflow in n8n solves all of these problems at once.

In this guide, we'll build a comprehensive CRM automation system that automatically captures and enriches contacts, moves deals through the pipeline based on behavior, triggers timely follow-ups, and keeps your team informed through Slack notifications. While we'll use HubSpot as the primary CRM in examples, the patterns apply equally to Pipedrive, GoHighLevel, Salesforce, and others.

If you haven't yet built your first n8n workflow, start with our beginner's guide to building AI agents with n8n first.

The Four Core CRM Automation Workflows

A complete CRM automation system typically includes four interconnected workflows:

  1. Lead Capture & Enrichment: Automatically captures new contacts and enriches their data
  2. Deal Stage Automation: Moves deals through pipeline stages based on actions and time triggers
  3. Follow-Up Sequences: Triggers outreach at the right time based on deal stage and contact behavior
  4. Activity Logging: Automatically logs calls, emails, and meetings to the CRM without manual input

We'll build all four and show you how they connect.

Workflow 1: Lead Capture and Enrichment

This workflow triggers whenever a new contact is created in HubSpot and automatically enriches their profile with company data.

Trigger: HubSpot — New Contact

Use the HubSpot Trigger node with:

  • Trigger On: Contact Created

This fires instantly when a new contact appears in HubSpot from any source — form submissions, manual entry, imported lists, or other integrations.

Company Enrichment via Clearbit

Use the HTTP Request node to call the Clearbit Enrichment API:

  • URL: https://person.clearbit.com/v2/combined/find?email={{$json.email}}
  • Method: GET
  • Headers: Authorization: Bearer {{$credentials.clearbitKey}}

Clearbit returns company name, size, industry, website, LinkedIn URL, and more. If Clearbit returns a 404 (email not found), handle this gracefully with an IF node that checks the response status code.

AI-Powered Lead Scoring

Pass the enriched data to an OpenAI node (gpt-4o-mini, temperature 0) with a lead scoring prompt:

Score this lead for an AI automation agency on a scale of 1-10.
Return JSON: {"score": number, "tier": "hot|warm|cold", "reasoning": "string"}

Lead data: {{JSON.stringify($json)}}

Update HubSpot Contact

Use the HubSpot node to update the contact with enriched data:

  • Resource: Contact
  • Operation: Update
  • Contact ID: From trigger data
  • Properties to update: company, jobtitle, company_size, linkedin_url, lead_score (custom property), lead_tier (custom property)

Create Deal in Pipeline

For contacts above a certain lead score, automatically create a deal:

  • HubSpot node: Resource = Deal, Operation = Create
  • Deal Name: {{$json.contact_name}}{{$json.company_name}}
  • Pipeline Stage: "New Lead" stage ID
  • Associated Contact: Contact ID from trigger
  • Deal Value: Estimated based on company size from enrichment

Workflow 2: Deal Stage Automation

This workflow automatically advances and manages deals in your pipeline based on specific triggers and time-based rules.

Trigger Pattern: Webhook from HubSpot

Configure a HubSpot webhook to notify n8n when specific deal properties change. In HubSpot settings, add a webhook subscription for "Deal Property Change" events pointing to your n8n webhook URL.

The n8n Webhook node receives:

{
  "subscriptionType": "deal.propertyChange",
  "objectId": 12345,
  "propertyName": "dealstage",
  "propertyValue": "presentationscheduled"
}

Stage-Based Action Routing

Use a Switch node to route based on the new deal stage:

  • New Lead: Enroll in initial contact sequence, assign owner, send Slack notification
  • Meeting Scheduled: Send meeting prep email with agenda template, create calendar event via Google Calendar node
  • Proposal Sent: Start proposal follow-up sequence, set 3-day reminder
  • Negotiation: Alert sales manager via Slack, pause automated emails
  • Closed Won: Trigger onboarding workflow, send congratulations email, update revenue tracking sheet
  • Closed Lost: Log reason, add to re-engagement campaign in 90 days, request feedback via email

Stale Deal Detection (Scheduled Workflow)

Create a separate workflow that runs daily at 9am to catch deals that haven't moved in too long:

  1. Cron Trigger: Daily at 9:00 AM
  2. HubSpot node: Search deals where last modified > 7 days ago AND stage is not Closed
  3. Function node: Filter to only deals stale beyond their stage's SLA (New Lead: 2 days, In Contact: 5 days, Proposal: 7 days)
  4. Slack node: Send a daily digest of stale deals to the sales channel
  5. HubSpot node: Add an activity note to each stale deal: "Automated reminder: Deal has been inactive for X days"

Workflow 3: Behavior-Triggered Follow-Ups

This is the most sophisticated workflow — triggering follow-ups based on what prospects actually do, not just time elapsed.

Email Open Tracking

Use HubSpot's native tracking or configure custom tracking pixels. When HubSpot webhooks fire for email events (open, click, reply), route them to n8n:

  • Email Opened: If opened 3+ times without reply, flag as high-interest and notify sales team
  • Link Clicked: Identify which link and trigger relevant follow-up (pricing page click → send pricing breakdown email)
  • Proposal Viewed: If proposal doc viewed via tracked link, send "had a chance to review?" email within 2 hours

Website Visit Tracking

If the client uses HubSpot tracking code, configure website visit webhooks to n8n:

  • Known contact visits pricing page → Slack alert to sales rep with context
  • Known contact visits case studies page → Queue a relevant case study email
  • Known contact hasn't visited in 30+ days → Re-engagement campaign trigger

Building the Follow-Up Logic

Use a combination of Wait nodes and IF nodes to implement the follow-up logic. Before each follow-up sends, check the deal stage and email engagement status:

// Function node: Check if follow-up should send
const dealStage = items[0].json.deal_stage;
const hasReplied = items[0].json.has_replied;
const daysSinceLastTouch = items[0].json.days_since_last_touch;

if (hasReplied || dealStage === 'closed_lost' || dealStage === 'closed_won') {
  return [{ json: { should_send: false, reason: 'deal_resolved' } }];
}

return [{ json: { should_send: true } }];

Workflow 4: Automatic Activity Logging

One of the biggest CRM problems is that reps don't log their activities. This workflow does it automatically.

Gmail → HubSpot Sync

  1. Gmail Trigger node: Watch for sent emails (check sent folder)
  2. Function node: Extract recipient email addresses
  3. HubSpot node: Search for contact by email
  4. IF node: If contact found in HubSpot
  5. HubSpot node: Log email activity to contact timeline with subject, snippet, and timestamp

Calendar → HubSpot Sync

  1. Google Calendar Trigger node: Event ended
  2. Function node: Extract attendee emails from calendar event
  3. HubSpot node: Find contacts matching attendee emails
  4. HubSpot node: Log meeting activity to each contact's timeline
  5. OpenAI node: If the calendar event has notes/description, generate a meeting summary
  6. HubSpot node: Add meeting notes to the associated deal

Twilio Call Logging

If clients use Twilio for calls:

  1. Webhook node: Receive Twilio call status callback
  2. Twilio node: Fetch call recording URL
  3. HTTP Request node: Transcribe recording using Whisper API (https://api.openai.com/v1/audio/transcriptions)
  4. OpenAI node: Summarize transcript and extract action items
  5. HubSpot node: Log call activity with summary and transcript to contact and deal

Multi-CRM Pattern: When Clients Use Different CRMs

As an agency, your clients will use different CRMs. Structure your n8n workflows to be CRM-agnostic by abstracting the CRM interaction into a sub-workflow:

  • Create a "CRM Actions" sub-workflow that accepts standardized inputs (action type, contact data, deal data)
  • Use a Switch node inside the sub-workflow to route to the appropriate CRM node based on a crm_type variable
  • Main workflows call the sub-workflow, not the CRM directly
  • Switching a client from HubSpot to Pipedrive only requires updating the sub-workflow, not all your main automations

For more information on building scalable workflow architectures for multiple clients, see our AI automation agency guide. For comparing n8n against Make.com for CRM projects specifically, read our n8n vs Make for agency client projects comparison.

What to Charge for CRM Automation

CRM automation projects vary significantly in scope. Typical pricing:

  • Basic CRM automation (lead capture + follow-up): $1,500–$3,000 setup
  • Full CRM automation suite (all 4 workflows): $4,000–$8,000 setup
  • Ongoing maintenance and monitoring: $300–$600/month
  • CRM migration + automation: $5,000–$12,000 (includes data migration from old system)

Position these projects around revenue impact — a well-automated CRM typically increases close rates by 20–30% by ensuring no lead falls through the cracks and follow-ups happen on time every time.

Want n8n templates and training? Join 215+ AI agency owners. Join the free AI Agency Sprint on Skool.
Community & Training

Join 215+ AI Agency Owners

Get free access to our LinkedIn automation tool, AI content templates, and a community of builders landing clients in days.

Access the Free Sprint
22 people joined this week