Build a support knowledge base from historical Gmail emails with OpenAI and PostgreSQL
Ready for 3.0What this workflow does
This AI workflow has 16 nodes and runs manually, when you click “Execute workflow”. Along the way it connects Gmail, Postgres and OpenAI Chat Model.
How it runs
Trigger: Manually, when you click “Execute workflow”.
- Fetch Emails (Gmail): get many
- Parse and Filter (Code): runs custom JavaScript code
- Is Customer Email (If): checks a condition and branches into true / false
- Check Duplicate in DB (Postgres): run a query
- Merge Duplicate Result (Code): runs custom JavaScript code
- Not Already Processed (If): checks a condition and branches into true / false
- Assemble Thread (Code): runs custom JavaScript code
- AI Extract KB Entries (AI Agent): runs an AI agent, with model: OpenAI Chat Model
- Parse KB Entries (Code): runs custom JavaScript code
- Has KB Entries (If): checks a condition and branches into true / false
…plus 4 more steps. See the full node list below.
Services it uses
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 (7)
- Manual Trigger
n8n-nodes-base.manualTrigger - Gmail
n8n-nodes-base.gmail - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - Postgres
n8n-nodes-base.postgres - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - AI Agent
@n8n/n8n-nodes-langchain.agent
From the author
KB Builder — Historical Emails n8n Workflow Template --- 📘 Description This workflow automates the process of building a structured Knowledge Base (KB) from your existing Gmail inbox by processing historical email threads, extracting customer-support…