## Introduction
In a fast-paced startup environment, timely communication between sales and marketing teams is critical. One common scenario is keeping the marketing team updated whenever a lead or contact’s stage in the CRM changes — for example, from ‘Lead’ to ‘Qualified’, or from ‘Negotiation’ to ‘Customer’. Automated notifications help marketing proactively prepare campaigns, personalize messaging, and coordinate follow-ups without manual monitoring.
This article presents a step-by-step tutorial on building an automated workflow using the open-source automation tool n8n. We will integrate a CRM system (using HubSpot as a concrete example), Slack for team notifications, and Google Sheets to log changes for auditing and analysis.
The readers: startups, automation engineers, and marketing operations specialists aiming to streamline cross-department collaboration.
—
## What Problem This Solves
– Eliminates manual updates and reduces human error in cross-team communication.
– Accelerates marketing response times to changes in lead/customer stages.
– Provides a centralized logging solution for CRM stage changes.
– Benefits sales, marketing managers, and automation specialists by fostering transparency and agile campaign design.
—
## Tools and Services Integrated
– **HubSpot CRM** – source of contact/lead data and stage changes.
– **n8n** – the automation workflow builder.
– **Slack** – team communication platform where notifications are sent.
– **Google Sheets** – used here as a simple logging tool for record-keeping.
Note: While HubSpot and Slack are used here, similar integrations can be built with other CRMs and messaging tools supported by n8n.
—
## Automation Workflow Overview
### Trigger
– An incoming webhook from HubSpot that fires when a contact’s lifecycle or deal stage changes.
### Processing Steps
1. Parse the incoming webhook payload.
2. Validate the stage change event (ignore irrelevant updates).
3. Prepare a Slack message with contact details and new stage info.
4. Post the message into a designated Slack channel.
5. Append the change details into a Google Sheet for logging.
### Output
– Slack message notifying marketing team.
– Updated Google Sheet record.
—
## Step-by-Step Tutorial
### Prerequisites
– Access to **n8n**, running on your server or n8n.cloud.
– HubSpot account with API access & webhook subscription.
– Slack workspace & a channel for marketing notifications.
– Google account with Google Sheets created for logging.
### 1. Set Up HubSpot Webhook
HubSpot can send webhooks for various events; to trigger on lifecycle or deal stage changes:
– Go to your HubSpot developer portal, create an app if not present.
– In your app, set up **Subscriptions** for contact or deal property changes:
– Select `lifecycle_stage` or `dealstage` as monitored properties.
– Provide the webhook URL from your n8n webhook node (we’ll create next).
### 2. Create n8n Workflow
#### a. Add Webhook Trigger Node
– In n8n, create a new workflow.
– Add a **Webhook** node:
– Set HTTP Method to POST.
– The webhook URL will be auto-generated. Copy this URL and use it in HubSpot app webhook subscription.
#### b. Test Webhook
– Send a test payload from HubSpot or via curl/Postman to verify n8n receives data.
#### c. Add IF Node to Filter Relevant Changes
– Add an **IF** node connected to the webhook node.
– Set the condition to check if the changed property is one of the stages you are interested in.
– Example condition: `{{$json[“propertyName”]}}` equals `lifecycle_stage` or `dealstage`.
#### d. Extract and Format Notification Message
– Add a **Set** node after the IF ‘true’ branch to construct a readable message.
– Use expressions to include:
– Contact/deal name
– Old stage
– New stage
– Link to the HubSpot record
– Timestamp
Example:
“`
Lead “{{$json[“contactName”]}}” has changed stage from “{{$json[“previousStage”]}}” to “{{$json[“currentStage”]}}”. <{{ $json["recordUrl"] }}|View in HubSpot>
“`
#### e. Post Notification to Slack
– Add the **Slack** node [‘Post a Message’]
– Connect it to the Set node output.
– Select or create a Slack credential with a bot token.
– Choose the marketing channel for notifications.
– Use the formatted message from the Set node.
#### f. Log to Google Sheets
– Add a **Google Sheets** node.
– Connect to Slack node (or parallel path).
– Use credentials to connect.
– Select the spreadsheet and worksheet.
– Map columns for timestamp, contact/deal name, previous stage, current stage, and URL.
—
## Common Errors & Tips
– **Webhook Not Triggering:** Confirm the webhook URL is publicly accessible and correctly entered in HubSpot.
– **Authentication Issues:** Double-check Slack and Google Sheets OAuth tokens; ensure scopes include posting & sheet editing.
– **Filtering Wrong Updates:** Property names in HubSpot webhook may vary; inspect raw JSON payloads to verify.
– **Handling Rate Limits:** Slack and HubSpot APIs have rate limits; implement exponential backoff or queues if volume is high.
—
## Adapting and Scaling This Workflow
– Add more communication channels (e.g., email, MS Teams, SMS) by inserting corresponding nodes.
– Use additional filters to notify different marketing subteams based on region, product interest, or priority.
– Extend logging for analytics by pushing data into a database or BI tool instead of Google Sheets.
– Implement error handling nodes to capture failures and notify system admins.
—
## Summary and Bonus Tip
By automating CRM stage change notifications with n8n, your marketing team gains real-time visibility into lead lifecycle events without manual overhead. This targeted communication empowers timely marketing action, from triggered campaigns to personalized outreach, enhancing overall sales-marketing alignment.
**Bonus Tip:** To enhance context, enrich notifications by fetching additional data from HubSpot (like recent activities or contact owner) using the **HTTP request node** before sending to Slack. This creates richer messages that help marketing tailor their strategies instantly.
—
With this detailed tutorial, you can quickly deploy a robust, scalable solution that bridges your CRM and marketing communication channels effectively.