HubSpot + Gmail: closed-won welcomes sent right
Your deal goes Closed Won, everyone celebrates… and then the follow-up gets messy. The welcome email sits in someone’s drafts, the “who owns this now?” question lingers, and a new customer waits longer than they should.
This HubSpot Gmail automation hits Customer Success Managers first, but Sales Ops and founders feel it too. You get a consistent welcome sent fast, plus an assigned CSM that’s actually balanced instead of “whoever answered last.”
Below you’ll see how the workflow routes Closed Won deals, finds the right Champion contact, writes a tailored email with AI, sends it via Gmail, and updates HubSpot so your handoff is clean.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: HubSpot + Gmail: closed-won welcomes sent right
flowchart LR
subgraph sg0["Trigger: Deal Is 'Closed Won' Flow"]
direction LR
n0@{ icon: "mdi:robot", form: "rounded", label: "Structured Output Parser", pos: "b", h: 48 }
n1@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If Deal Is Won", pos: "b", h: 48 }
n2@{ icon: "mdi:swap-vertical", form: "rounded", label: "Configure Template Variables", pos: "b", h: 48 }
n3@{ icon: "mdi:swap-horizontal", form: "rounded", label: "If Role is 'Champion'", pos: "b", h: 48 }
n4["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/hubspot.svg' width='40' height='40' /></div><br/>HubSpot: Get Deal Details"]
n5["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Split Contact IDs"]
n6["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/hubspot.svg' width='40' height='40' /></div><br/>HubSpot: Get Contact Details"]
n7@{ icon: "mdi:robot", form: "rounded", label: "AI: Write Welcome Email", pos: "b", h: 48 }
n8@{ icon: "mdi:brain", form: "rounded", label: "AI Model", pos: "b", h: 48 }
n9["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/markdown.dark.svg' width='40' height='40' /></div><br/>Util: Markdown to HTML"]
n10@{ icon: "mdi:message-outline", form: "rounded", label: "Gmail: Send Welcome Email", pos: "b", h: 48 }
n11["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/hubspot.svg' width='40' height='40' /></div><br/>HubSpot: Assign Contact Owner"]
n12["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/hubspot.svg' width='40' height='40' /></div><br/>Trigger: Deal Is 'Closed Won'"]
n13@{ icon: "mdi:cog", form: "rounded", label: "Get CSM List", pos: "b", h: 48 }
n14["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Find Least Busy CSM"]
n15@{ icon: "mdi:cog", form: "rounded", label: "Increment CSM Deal Count", pos: "b", h: 48 }
n8 -.-> n7
n13 --> n14
n1 --> n13
n5 --> n6
n14 --> n4
n3 --> n7
n9 --> n10
n7 --> n9
n0 -.-> n7
n10 --> n11
n4 --> n5
n2 --> n1
n6 --> n3
n11 --> n15
n12 --> n2
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n12 trigger
class n0,n7 ai
class n8 aiModel
class n1,n3 decision
class n5,n14 code
classDef customIcon fill:none,stroke:none
class n4,n5,n6,n9,n11,n12,n14 customIcon
The Problem: Closed-won handoffs slip through the cracks
Manual handoffs look fine on a quiet week. Then you close a handful of deals, everyone is in meetings, and the “welcome + owner assignment” becomes tribal knowledge. Someone copies an old email, forgets to personalize the links, and the new customer gets a message that feels like a template because… it is. Meanwhile the internal part is worse: HubSpot ownership isn’t updated, the Champion contact isn’t clearly flagged, and Customer Success starts the relationship by chasing context instead of delivering value.
It adds up fast. Here’s where it breaks down in real teams.
- A Closed Won deal can sit for hours before anyone notices it needs a welcome email.
- CSM assignment turns into guesswork, so your “least busy” person still gets overloaded.
- Contacts on the deal aren’t equal, but finding the real Champion means clicking through records one-by-one.
- HubSpot stays out of sync, which means reporting and onboarding checklists get unreliable.
The Solution: Automatic welcomes and balanced CSM assignment
This workflow starts the moment HubSpot marks a deal as Closed Won. n8n checks that the change is real, then pulls a simple assignment table (an n8n Data Table) that tracks each CSM and how many active deals they’re carrying. It selects the lowest-load CSM, grabs the deal details, and looks up every associated contact. From there it identifies the “Champion” contact based on HubSpot’s Buying Role property, generates a personalized welcome email with an AI agent, converts it to clean HTML, and sends it through Gmail. Finally, it updates HubSpot ownership for the Champion and increments the chosen CSM’s deal count so the next assignment stays fair.
The workflow begins with a HubSpot Closed Won trigger, then moves through CSM selection, contact discovery, and “Champion” filtering. Once the AI email is drafted and sent via Gmail, HubSpot is updated and the assignment table is kept in sync for the next deal.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you close 10 deals in a week. Manually, a decent welcome takes about 10 minutes to write, plus maybe 5 minutes to find the right contact and assign the right owner in HubSpot, so you’re at roughly 2.5 hours weekly. With this workflow, the “work” is basically zero: the trigger fires automatically, the AI drafts the email, and Gmail sends it after processing. Realistically you’ll spend maybe 10 minutes a week spot-checking messages and tweaking the prompt, not rewriting the same thing over and over.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- HubSpot to detect Closed Won and update contacts.
- Gmail to send the welcome email from your sender.
- OpenAI (or similar AI provider) for the welcome-email drafting model.
- HubSpot Developer API credential (create in HubSpot private app settings).
Skill level: Intermediate. You’ll connect accounts, create an n8n Data Table, and update a few template variables and links.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
Closed Won in HubSpot kicks it off. The workflow triggers when the deal’s “Is closed won” property is set to True. A quick validation step makes sure it’s the event you actually care about, not noise.
CSM assignment happens before the email. n8n pulls your csm_assignments Data Table and selects the lowest-load CSM (based on deal_count). That choice is carried forward so the right person is referenced in the email and recorded in HubSpot.
Deal and contact details are gathered and filtered. The workflow fetches the deal info, separates associated contact IDs, then loops through contacts to find the Champion using the HubSpot Buying Role property (hs_buying_role). If your CRM data isn’t perfect, this part is honestly where the automation earns its keep, because it applies the same rule every time.
AI drafts, Gmail sends, HubSpot updates. An AI agent writes the welcome email using your variables (company_name, sender_name, sender_email) and your onboarding links. The draft is converted from Markdown to HTML, sent via Gmail, then HubSpot is updated to assign the Champion’s owner and increment the selected CSM’s deal count for future balancing.
You can easily modify the email content to include region-specific links or product-specific onboarding steps based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the HubSpot Trigger
Set up the workflow to listen for closed-won deal updates from HubSpot.
- Add and open Closed-Won Deal Trigger.
- Set Events to
deal.propertyChangeand Property tohs_is_closed_won. - In Additional Fields, set Max Concurrent Requests to
5. - Credential Required: Connect your HubSpot OAuth2 credentials.
⚠️ Common Pitfall: If the HubSpot credential is not connected, the trigger will not register events. Make sure the OAuth2 app has access to Deals.
Step 2: Connect HubSpot and Prepare Deal Filtering
Validate the closed-won event and pull deal details and contact IDs.
- Open Set Email Template Values and set the fields: company_name to
Your Company Name, sender_name toYour Sender Name, and sender_email to[YOUR_EMAIL]. - Open Validate Closed-Won Deal and set the condition Left Value to
{{ $("Closed-Won Deal Trigger").item.json.body[0].propertyValue }}with boolean operatortrue. - Open Fetch HubSpot Deal Info and set Deal ID to
{{ $("Closed-Won Deal Trigger").item.json.body[0].objectId }}with Authentication set tooAuth2. - Open Separate Contact IDs and keep the provided JavaScript to split
associatedVidsinto individual contact items. - Credential Required: Connect your HubSpot OAuth2 credentials for Fetch HubSpot Deal Info.
Step 3: Set Up CSM Assignment Data Table
Load your CSM assignment table and select the least busy CSM for the new customer.
- Open Retrieve CSM Table and set Operation to
getwith Return All enabled. - Select a Data Table ID for Retrieve CSM Table (this field is currently empty).
- Open Select Lowest Load CSM and keep the JavaScript that sorts by
deal_count. - Open Increase CSM Deal Count and select the same Data Table ID as above.
- In Increase CSM Deal Count, keep the filter keyValue set to
{{ $("Select Lowest Load CSM").item.json.row_id_to_update }}.
Tip: Ensure your Data Table includes csm_id, deal_count, and a row id for each CSM to avoid the empty-table error thrown by Select Lowest Load CSM.
Step 4: Set Up Contact Retrieval and Role Check
Fetch contact details and filter to the champion contact before drafting the welcome email.
- Open Retrieve HubSpot Contact and set Contact ID to
{{ $json.contactId }}. - In Retrieve HubSpot Contact, add Additional Fields → properties and include
hs_buying_role. - Open Check Champion Role and set Left Value to
{{ $json.properties.hs_buying_role.value }}and Right Value toCHAMPION. - Credential Required: Connect your HubSpot OAuth2 credentials for Retrieve HubSpot Contact.
Step 5: Set Up AI Drafting and Parsing
Generate a structured welcome email using an LLM and parse the response into subject and body fields.
- Open Draft Welcome Email AI and keep the Text prompt with the embedded variables, such as
{{ $('Set Email Template Values').item.json.sender_name }}and{{ $('Retrieve HubSpot Contact').item.json.properties.firstname.value }}. - Open Structured Parse Engine and keep the Input Schema that defines
subjectandbodyas required fields. - Open OpenAI Chat Model and select the model
gpt-4o-mini. - Credential Required: Connect your OpenAI API credentials in OpenAI Chat Model.
⚠️ Common Pitfall: Structured Parse Engine is an AI sub-node. Do not add credentials there—attach OpenAI credentials to OpenAI Chat Model, which is linked to Draft Welcome Email AI.
Step 6: Configure Email Formatting and Delivery
Convert the AI draft to HTML and send it via Gmail, then assign the CSM owner in HubSpot.
- Open Convert Markdown to HTML and set Mode to
markdownToHtmlwith Markdown set to{{ $json.output.body }}. - Open Dispatch Welcome Email and set Send To to
{{ $('Retrieve HubSpot Contact').item.json.properties.email.value }}. - Set Subject to
{{ $json.output.subject }}and Message to{{ $json.data }}in Dispatch Welcome Email. - Open Assign HubSpot Owner and set Email to
{{ $('Retrieve HubSpot Contact').item.json.properties.email.value }}and Contact Owner to{{ $('Select Lowest Load CSM').item.json.csm_id }}. - Credential Required: Connect your Gmail credentials for Dispatch Welcome Email.
- Credential Required: Connect your HubSpot OAuth2 credentials for Assign HubSpot Owner.
Step 7: Test and Activate Your Workflow
Verify the full workflow runs end-to-end and then enable it for production.
- Click Execute Workflow and simulate a closed-won deal update in HubSpot.
- Confirm that Fetch HubSpot Deal Info returns the deal and Separate Contact IDs outputs one item per contact.
- Check that Draft Welcome Email AI produces
subjectandbodyin its structured output and that Dispatch Welcome Email sends successfully. - Verify Assign HubSpot Owner updates the contact owner and Increase CSM Deal Count updates the Data Table row.
- Toggle the workflow Active to enable real-time processing.
Common Gotchas
- HubSpot credentials can expire or lack the right scopes. If things break, check your private app permissions and OAuth re-auth inside n8n first.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Frequently Asked Questions
About 45 minutes if your HubSpot and Gmail credentials are ready.
No. You’ll mostly connect accounts and edit a few variables and links.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI API usage (usually a few cents per email, depending on your model and prompt size).
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, and it’s a smart move. After “Fetch HubSpot Deal Info,” add an If check for product line (or deal value, region, or industry) and route to different “AI: Write Welcome Email” prompts. Many teams keep one prompt for SMB, another for enterprise, and a third for partners. You can also swap the Champion logic if you don’t use hs_buying_role by updating the “Retrieve HubSpot Contact” field mapping and the “Check Champion Role” condition.
Usually it’s expired OAuth or the wrong HubSpot credential on the trigger versus the action nodes. Reconnect HubSpot in n8n, then confirm the trigger uses the Developer API credential while the “Get Deal Details / Get Contact Details / Assign Contact Owner” steps use OAuth2. Also check that your private app has access to CRM objects (deals and contacts) and that you aren’t hitting HubSpot rate limits when multiple deals close at once.
A typical n8n Cloud Starter plan handles thousands of executions per month, and self-hosting has no fixed execution cap (it mainly depends on your server). In practice, this workflow scales well because it’s one execution per Closed Won deal, plus a loop over that deal’s contacts.
Often, yes. This workflow has a few parts that get awkward (or expensive) in simpler tools: selecting the least-busy CSM from a table, looping through contacts to find the Champion, and generating longer-form copy with an AI agent before converting it to HTML. n8n also lets you self-host, which matters once you’re processing a lot of deals and don’t want every extra step to increase your bill. Zapier or Make can still be fine for a basic “Closed Won → send email” flow, especially if you never need the Champion filtering or load balancing. If you’re on the fence, Talk to an automation expert and describe your handoff process.
Once this is live, every Closed Won deal gets the same fast, polished start, and your CSM ownership stays accurate without anyone babysitting HubSpot. Set it up once, then get on with the real work.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.