AI Email Reply Based on HubSpot Data + Slack Approval

Go to Workflow
76 views
Built by Miha Miha
Created on June 05, 2026

Description

This n8n template drafts customer-ready email replies using Google Gemini, enriched with HubSpot context (contact, deals, companies, tickets). Each draft is routed to Slack for one-click approval before it’s sent from Gmail—so you move fast without losing control.

Ideal for support and sales teams that want speedy, personalized responses while keeping humans in the loop.

How it works

Gmail Trigger** watches for new inbound emails.
Sender filter** excludes internal domains (e.g., n8n.io) to avoid auto-replying to teammates.
HubSpot contact lookup* finds the sender and fetches associated *deals/companies/tickets** via association + batch read.
CRM context is normalized** into clean, LLM-friendly fields (no IDs or sensitive noise).
Gemini (Google AI Studio)** generates a concise, friendly reply using:

Sender name, subject, and message snippet
Safe, relevant HubSpot context (e.g., top 1–2 deals or an open ticket)
Style constraints (≤ \~150 words, single CTA, optional clarifying question)
Slack approval* posts the draft to a channel; if *approved, n8n **replies via Gmail in the original thread.

How to use

Gmail: Connect the same account for the trigger and reply nodes.
HubSpot: Connect OAuth on the search + HTTP request nodes.
Gemini: Add your Google AI Studio API key to the Google Gemini Chat Model node.
Slack: Connect and select the channel for draft approvals.
(Optional) Filter: Adjust the Allowed Sender filter before going live.
(Optional) Prompt: Edit “Draft Reply (AI Agent)” tone/length or how much CRM detail to include.
Activate the workflow. New emails will produce Slack-approved replies automatically.

Requirements

Gmail** (trigger + send)
HubSpot** (OAuth2) for contact + associations
Slack** for approval step
Google Gemini** (Google AI Studio API key)

Notes & customization

Safety rails:** The prompt avoids exposing IDs/raw JSON and caps CRM details to what’s useful.
Auto-send mode:** Skip Slack if you want fully automated replies for specific senders/labels.
Richer context:** Extend the batch read to pull more properties (e.g., next step, renewal date).
Triage:** Branch on subject/labels to route billing vs. technical requests to different prompts.
QA queue:* If the model asks a clarifying question, keep it to *one**—the node enforces that.

Nodes Used (7)

AI Agent
@n8n/n8n-nodes-langchain.agent
Code
n8n-nodes-base.code
Gmail
n8n-nodes-base.gmail
Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini
HTTP Request
n8n-nodes-base.httpRequest
HubSpot
n8n-nodes-base.hubspot
Slack
n8n-nodes-base.slack