Skip to main content

Smart CSM assignment & AI welcome emails for HubSpot deal wins with Gmail

Workflow preview

Workflow preview
100%
Smart CSM assignment & AI welcome emails for HubSpot deal wins with Gmail preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Who's it for This template is for Customer Success and Sales teams who use HubSpot. It automates the critical handoff from sales to success, ensuring every new customer gets a fast, personalized we...

Best for

  • CRM automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.outputparserstructured, n8n-nodes-base.stickynote, n8n-nodes-base.if, n8n-nodes-base.set, n8n-nodes-base.hubspot, n8n-nodes-base.code, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatopenai

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by PollupAI.

Original n8n.io source

1.1 Workflow description

Title
Smart CSM assignment & AI welcome emails for HubSpot deal wins with Gmail
Workflow name
Smart CSM assignment & AI welcome emails for HubSpot deal wins with Gmail

Who's it for

This template is for Customer Success and Sales teams who use HubSpot. It automates the critical handoff from sales to success, ensuring every new customer gets a fast, personalized welcome. It's perfect for anyone looking to standardize their onboarding process, save time on manual tasks, and improve the new customer experience using AI.

What it does

This workflow triggers when a deal's "Is closed won" property is set to True in HubSpot. It assigns a Customer Success Manager (CSM) by querying an n8n Data Table to find the 'least busy' CSM (based on a deal count) and fetches the deal's details to find all associated contacts.

It then loops to identify the "Champion" contact by checking their "Buying Role" (hs_buying_role). An AI agent (in the AI: Write Welcome Email node) generates a personalized welcome email, which is converted to HTML and sent via Gmail. Finally, the workflow updates the Champion's contact record in HubSpot and updates the CSM's deal count in the Data Table to keep the logic in sync.

How to set up

  1. Create and Populate Data Table: This template requires an n8n Data Table to manage CSM assignments.
    • Create a Data Table named csm_assignments.
    • Add two columns: csm_id (String) and deal_count (Number).
    • Add one row for each CSM with their HubSpot Owner ID and a starting deal_count of 0.
  2. Link Data Table Nodes: Open the Get CSM List and Increment CSM Deal Count nodes and select the csm_assignments table you just created from the Table dropdown.
  3. Configure Variables: In the Configure Template Variables node, you must set your sender info (company_name, sender_name, and sender_email).
  4. Customize AI Prompt: In the AI: Write Welcome Email node, update the placeholder [Link to Your Video] and [Link to Your Help Doc] links with your own URLs.
  5. Check HubSpot Property: This workflow assumes you use the "Buying Role" (hs_buying_role) contact property to identify your "Champion". If you use a different property, you must update the HubSpot: Get Contact Details and If Role is 'Champion' nodes.

Requirements

  • Access to n8n Data Tables.
  • HubSpot (Developer API): A credential for the Trigger: Deal Is 'Closed Won' node.
  • HubSpot (OAuth2): A credential for all other HubSpot nodes (Get Deal Details, Get Contact Details, Assign Contact Owner).
  • AI Credentials: (e.g., OpenAI) Credentials for the AI Model node (the node connected to AI: Write Welcome Email).
  • Email Credentials: (e.g., Gmail) Credentials for the Gmail: Send Welcome Email node.

How to customize the workflow

You can easily customize this workflow to send different emails based on deal properties. Add an If node after the HubSpot: Get Deal Details node to check for the deal's value, product line, or region.

Based on these properties, you can route the flow to different AI: Write Welcome Email nodes with unique prompts. For example, you could check the contact's 'industry' or 'company size' to send them links to different, more relevant 'Getting Started' videos and documentation.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Structured Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.2

Block 2 - Sticky Note7

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - If Deal Is Won

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 4 - Configure Template Variables

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 5 - If Role is 'Champion'

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 6 - HubSpot: Get Deal Details

Type / Role
n8n-nodes-base.hubspot - hubspot
Config choices
Version 2.2

Block 7 - Split Contact IDs

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - HubSpot: Get Contact Details

Type / Role
n8n-nodes-base.hubspot - hubspot
Config choices
Version 2.2

Block 9 - AI: Write Welcome Email

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.9

Block 10 - AI Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 11 - Util: Markdown to HTML

Type / Role
n8n-nodes-base.markdown - markdown
Config choices
Version 1

Block 12 - Gmail: Send Welcome Email

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 13 - HubSpot: Assign Contact Owner

Type / Role
n8n-nodes-base.hubspot - hubspot
Config choices
Version 2.1

Block 14 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 15 - Sticky Note10

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Trigger: Deal Is 'Closed Won'

Type / Role
n8n-nodes-base.hubspotTrigger - hubspotTrigger
Config choices
Version 1

Block 17 - Sticky Note9

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 18 - Get CSM List

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 19 - Find Least Busy CSM

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 20 - Increment CSM Deal Count

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 21 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Smart CSM assignment & AI welcome emails for HubSpot deal wins with Gmail
Complexity advanced
Nodes 22
Categories CRM, Multimodal AI
Author PollupAI
Published 31 Oct 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/10398/10398.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Smart CSM assignment & AI welcome emails for HubSpot deal wins with Gmail do?

Who's it for This template is for Customer Success and Sales teams who use HubSpot. It automates the critical handoff from sales to success, ensuring every new customer gets a fast, personalized we...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your CRM, Multimodal AI use case.