

How to Log Gmail Activity to HubSpot CRM with N8n
Automatically log sent and received Gmail emails to HubSpot contact timelines when they match existing CRM contacts.
Steps and UI details are based on platform versions at time of writing — check each platform for the latest interface.
HubSpot Gmail extension exists as a native integration, but it requires manual setup per user and doesn't create contacts automatically. This guide uses an automation platform for full control. View native option →
Best for
Teams that need custom email filtering, handle 200+ emails daily, or want to parse email content for lead intelligence.
Not ideal for
HubSpot Sales Hub Professional users who can use native Gmail integration or teams wanting zero-code setup.
Sync type
pollingUse case type
syncReal-World Example
A 25-person B2B consulting firm uses this to automatically log client emails to HubSpot deal records, but only emails containing 'proposal' or 'contract' in the subject. Before automation, account managers manually copied important emails to CRM, missing 40% of client communications. Now every proposal discussion appears on the deal timeline within 5 minutes.
What Will This Cost?
Drag the slider to your expected monthly volume.
Each platform counts differently — Zapier: 1 task per trigger. Make: 1 operation per module per record. n8n: 1 execution per run.





Prices shown for annual billing. Based on published pricing as of April 2026.
Estimated ROI
1000
min saved/mo
$583
labor value/mo
Free
no platform cost
Based on ~2 min manual effort per operation at $35/hr fully loaded labor cost.
Implementation
Import this workflow directly into n8n
Copy the pre-built n8n blueprint and paste it straight into n8n. All modules, filters, and field mappings are already configured — you just need to connect your accounts.
Before You Start
Make sure you have everything ready.
Field Mapping
Map these fields between your apps.
| Field | API Name | |
|---|---|---|
| Required | ||
| Email Subject | subject | |
| Email Body Preview | snippet | |
| Sender Email | from[0].email | |
| Email Timestamp | internalDate | |
3 optional fields▸ show
| Message ID | id |
| Thread ID | threadId |
| Email Direction | labelIds |
Step-by-Step Setup
Dashboard > New Workflow
Create New N8n Workflow
Start a blank workflow in N8n. This will be a polling workflow that checks for new emails and logs them to HubSpot.
- 1Click 'New Workflow' from the N8n dashboard
- 2Name it 'Gmail to HubSpot Email Logger'
- 3Click 'Save' to create the empty workflow
Add Node > Gmail > Get Messages
Add Gmail Trigger Node
Set up the Gmail node to watch for new emails. This will poll Gmail every 5 minutes for messages sent or received.
- 1Click the '+' button and search for 'Gmail'
- 2Select the Gmail node from the results
- 3Choose 'Get Messages' as the operation
- 4Set Query to 'is:sent OR is:unread' to capture sent and received emails
Gmail Node > Credentials > Create New
Connect Gmail Account
Authenticate your Gmail account with N8n. You'll need Gmail API access enabled in Google Cloud Console.
- 1Click 'Create New' next to Gmail credentials
- 2Select 'OAuth2 API' authentication method
- 3Enter your Google Client ID and Client Secret
- 4Click 'Connect my account' and complete OAuth flow
Add Node > Schedule Trigger
Add Schedule Trigger
Connect a Schedule Trigger before Gmail to poll for new emails every 5 minutes. This ensures the workflow runs automatically.
- 1Click '+' before the Gmail node
- 2Search for and select 'Schedule Trigger'
- 3Set Trigger Interval to 'Every 5 minutes'
- 4Connect the Schedule output to Gmail input
Add Node > IF
Filter for Contact Emails
Add an IF node to only process emails from addresses that exist in HubSpot. This prevents logging irrelevant emails.
- 1Add an IF node after Gmail
- 2Set condition to check if sender email exists
- 3Use expression: {{ $json.from[0].email }}
- 4Connect to next step only on 'true' branch
Add Node > HubSpot > Get Contact by Email
Add HubSpot Contact Search
Search HubSpot to verify the email sender exists as a contact before logging the email activity.
- 1Add HubSpot node after IF (true branch)
- 2Select 'Get Contact by Email' operation
- 3Map Email field to Gmail sender: {{ $node['Gmail'].json.from[0].email }}
- 4Set 'Continue on Fail' to true
HubSpot Node > Credentials > Create New
Connect HubSpot Account
Authenticate with HubSpot using your API key. You need at least Marketing Hub Starter for timeline events API access.
- 1Click 'Create New' next to HubSpot credentials
- 2Select 'API Key' authentication
- 3Paste your HubSpot API key from Settings > Integrations
- 4Click 'Save' to test connection
Add Node > IF
Add Second IF for Contact Check
Check if the contact search returned results before attempting to log the email. This prevents errors when emailing non-contacts.
- 1Add another IF node after HubSpot contact search
- 2Set condition: {{ $json.id !== undefined }}
- 3This checks if contact ID exists in the response
- 4Connect true branch to next step
Add Node > HubSpot > Create Timeline Event
Create Timeline Event
Add another HubSpot node to create the email timeline event on the contact record with email details.
- 1Add new HubSpot node after second IF (true branch)
- 2Select 'Create Timeline Event' operation
- 3Set Event Type ID to email event type
- 4Map Object ID to contact ID from previous step
HubSpot Timeline Node > Properties
Map Email Data Fields
Configure the timeline event properties with email subject, body preview, and timestamp from Gmail.
- 1In Properties section, click 'Add Property'
- 2Map 'subject' to {{ $node['Gmail'].json.subject }}
- 3Map 'email_body' to {{ $node['Gmail'].json.snippet }}
- 4Map 'timestamp' to {{ $node['Gmail'].json.internalDate }}
Toolbar > Test Workflow
Test the Workflow
Run a test execution to verify emails are found in Gmail and logged to the correct HubSpot contact.
- 1Click 'Test workflow' button in top toolbar
- 2Check each node for green success indicators
- 3Verify timeline event appears in HubSpot contact record
- 4Check execution logs for any errors
Workflow > Active Toggle
Activate Workflow
Turn on the workflow to start automatically logging emails every 5 minutes. Monitor the first few runs for issues.
- 1Click the toggle switch in top right to 'Active'
- 2Confirm activation in the popup dialog
- 3Check Executions tab after 10 minutes for first run
- 4Verify no error notifications appear
Drop this into an n8n Code node.
JavaScript — Code Node// Extract meeting times from email body▸ Show code
// Extract meeting times from email body
const emailBody = $node['Gmail'].json.snippet;
const timeRegex = /(\d{1,2}:\d{2}\s?(AM|PM|am|pm))/g;... expand to see full code
// Extract meeting times from email body
const emailBody = $node['Gmail'].json.snippet;
const timeRegex = /(\d{1,2}:\d{2}\s?(AM|PM|am|pm))/g;
const meetingTimes = emailBody.match(timeRegex);
return [{
json: {
...items[0].json,
meeting_time_detected: meetingTimes ? meetingTimes[0] : null,
contains_meeting: meetingTimes !== null
}
}];Scaling Beyond 300+ emails/day+ Records
If your volume exceeds 300+ emails/day records, apply these adjustments.
Switch to Webhook Trigger
Replace polling with Gmail Push API webhooks to get real-time email notifications. Set up Cloud Pub/Sub topic in Google Cloud and configure Gmail to push new message events directly to N8n.
Batch Timeline Events
Group multiple emails into single HubSpot API calls using the batch timeline endpoint. Process up to 100 timeline events per request instead of individual calls for each email.
Add Redis Caching
Cache HubSpot contact lookups in Redis to avoid repeated API calls for the same email addresses. Set 24-hour TTL to balance freshness with API quota savings.
Going live
Production Checklist
Before you turn this on for real, confirm each item.
Troubleshooting
Common errors and how to fix them.
Frequently Asked Questions
Common questions about this workflow.
Analysis
Use N8n for this if you need custom email filtering logic or handle high email volumes (500+ per day). The code nodes let you parse email headers, detect signatures, or extract meeting times that Zapier can't handle. You also get unlimited executions on self-hosted N8n. Skip N8n if you just want basic email logging with zero setup - HubSpot's native Gmail integration does this automatically for Sales Hub Professional users.
This workflow uses 4 executions per email logged (schedule trigger, Gmail fetch, contact search, timeline creation). At 200 emails/month, that's 800 executions total. N8n cloud starts at $20/month for 5,000 executions, so you have plenty of headroom. Make would cost $29/month for the same operations. Zapier charges $30/month for their Professional plan to handle the multi-step logic. N8n cloud is cheapest here by $9/month.
Make has better built-in Gmail parsing - it automatically splits sender name from email address and handles thread detection. Zapier offers a pre-built HubSpot email logging template that works in 3 clicks. But N8n wins on customization - you can add lead scoring based on email content, detect out-of-office replies, or route different email types to different HubSpot properties. The code flexibility matters more than convenience once you want email intelligence.
HubSpot's timeline events API is picky about data types - send numbers as strings or they'll reject. Gmail's internalDate comes as epoch milliseconds but HubSpot wants ISO format, so add a date conversion node. The Gmail API paginates at 100 messages, but most polling intervals won't hit that limit. Watch for OAuth token expires every 7 days - N8n cloud handles refresh automatically but self-hosted needs manual token management.
Ideas for what to build next
- →Add Email Sentiment Analysis — Connect a sentiment analysis API to score email tone and add positive/negative flags to HubSpot timeline events for sales context.
- →Create Deal Stage Triggers — Set up additional workflows that trigger specific email templates when HubSpot deals change stages, creating two-way email automation.
- →Build Email Response Tracking — Extend the workflow to track email open rates and responses by parsing Gmail thread conversations and updating HubSpot engagement scores.
Related guides
How to Share Notion Meeting Notes to Slack with Pipedream
~15 min setup
How to Share Notion Meeting Notes to Slack with Power Automate
~15 min setup
How to Share Notion Meeting Notes to Slack with n8n
~20 min setup
How to Send Notion Meeting Notes to Slack with Zapier
~8 min setup
How to Share Notion Meeting Notes to Slack with Make
~12 min setup
How to Create Notion Tasks from Slack with Pipedream
~15 min setup