# Smart CSM assignment & AI welcome emails for HubSpot deal wins: n8n workflow

> Started by an event in a connected app, and works across Gmail, HubSpot and n8n data table. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/smart-csm-assignment-and-ai-welcome-emails-for-hubspot-deal- (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [CRM](https://millionrounds.com/workflows?category=CRM#library)

# Smart CSM assignment & AI welcome emails for HubSpot deal wins

Started by an event in a connected app, and works across Gmail, HubSpot and n8n data table. It hands the judgement calls to OpenAI. 16 steps, 2 branches: a working afternoon to understand properly.

Medium Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fsmart-csm-assignment-and-ai-welcome-emails-for-hubspot-deal-)

**16 steps** Medium: a working afternoon

**2** Branches: places the flow splits

**0** Loops or waits

**3** Services it connects to

## The flow

Starts it 1 Model 3 Logic 6 Service 6

The steps in the order they run, from what starts it.

- 1 **Structured Output Parser** Output Parser Structured *Model*
- 2 **AI Model** Lm Chat Open Ai *Model*
- 3 **Trigger: Deal Is 'Closed Won'** Hubspot trigger *Starts it*
- 4 **AI: Write Welcome Email** Agent *Model*
- 5 **Configure Template Variables** Set *Logic*
- 6 **Util: Markdown to HTML** Markdown *Logic*
- 7 **If Deal Is Won** If *Logic*
- 8 **Gmail: Send Welcome Email** Gmail *Service*
- 9 **Get CSM List** Data Table *Service*
- 10 **HubSpot: Assign Contact Owner** Hubspot *Service*
- 11 **Find Least Busy CSM** Code *Logic*
- 12 **Increment CSM Deal Count** Data Table *Service*
- 13 **HubSpot: Get Deal Details** Hubspot *Service*
- 14 **Split Contact IDs** Code *Logic*
- 15 **HubSpot: Get Contact Details** Hubspot *Service*
- 16 **If Role is 'Champion'** If *Logic*

## How it's built

- **Starts on:** An event in a connected app
- **Steps:** 16, with 2 branches
- **Size:** Medium: a working afternoon
- **Connects to:** Gmail, HubSpot, n8n data table
- **Model:** OpenAI

## Questions

What does it need to run?

An n8n account, plus your own Gmail and HubSpot accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an event in a connected app.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Plan an afternoon. 16 steps is enough that you should read each one before running it.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 16 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fsmart-csm-assignment-and-ai-welcome-emails-for-hubspot-deal-)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Gmail](https://millionrounds.com/workflows?service=Gmail#library)[HubSpot](https://millionrounds.com/workflows?service=HubSpot#library)[n8n data table](https://millionrounds.com/workflows?service=n8n+data+table#library)

## Workflows like it

Also crm, with the same services where possible, closest in size first.

- [**Analyze lost HubSpot deals and generate revival strategies** 16 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/analyze-lost-hubspot-deals-and-generate-revival-strategies)
- [**Find and add lookalike influencers to HubSpot with OpenAI** 16 steps · calls a model · HubSpot](https://millionrounds.com/workflow/find-and-add-lookalike-influencers-to-hubspot-with-openai)
- [**Forecast sales trends and weekly reports with Stripe** 16 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/forecast-sales-trends-and-weekly-reports-with-stripe)
- [**Generate sales deal follow-up actions from GoHighLevel** 16 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/generate-sales-deal-follow-up-actions-from-gohighlevel)
- [**QBR Auto-Prep: AI-Generated Quarterly Business Review Decks** 16 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/qbr-auto-prep-ai-generated-quarterly-business-review-decks)
- [**Auto-assign deals in HubSpot to fitting sales reps based** 16 steps · HubSpot](https://millionrounds.com/workflow/auto-assign-deals-in-hubspot-to-fitting-sales-reps-based)
