Compose reply draft in Gmail with OpenAI assistant
Ready for 3.0What this workflow does
This AI workflow has 13 nodes and runs on a schedule (every minute). Along the way it connects Gmail and OpenAI. It also calls googleapis.com over HTTP.
How it runs
Trigger: On a schedule (every minute).
- Get threads with specific labels (Gmail): work with thread
- Loop over threads (Loop Over Items (Split in Batches)): loops over the items in batches
- Get single message content (Gmail): get
- Get thread messages (Gmail): get (thread)
- Ask OpenAI Assistant (OpenAI): work with assistant
- Return last message in thread (Limit): keeps the first few items
- Map fields for further processing (Edit Fields (Set)): sets 5 fields: response, threadId, to…
- Convert response to HTML (Markdown): converts between Markdown and HTML
- Build email raw (Edit Fields (Set)): sets 1 field: raw
- Convert raw to base (Code): runs custom JavaScript code
…plus 2 more steps. See the full node list below.
Services it uses
HTTP calls to: googleapis.com
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (9)
- Gmail
n8n-nodes-base.gmail - HTTP Request
n8n-nodes-base.httpRequest - Code
n8n-nodes-base.code - Edit Fields (Set)
n8n-nodes-base.set - Markdown
n8n-nodes-base.markdown - OpenAI
@n8n/n8n-nodes-langchain.openAi - Limit
n8n-nodes-base.limit - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Schedule Trigger
n8n-nodes-base.scheduleTrigger
From the author
This workflow uses OpenAI Assistant to compose draft replies for labeled email messages. It automatically connects the drafts to Gmail threads. 💡 You can add knowledge base to your OpenAI Assistant and make your reply drafts very customized (e.g. compose…