Send legal AI news digests from IMAP email with OpenAI, Tavily, and Gmail
Needs changesWhat this workflow does
This AI workflow has 15 nodes and runs on a schedule (every 5 hours). Along the way it connects OpenAI Chat Model, Gmail, Imap (community) and Tavily (community).
How it runs
Trigger: On a schedule (every 5 hours).
- Imap: work with email
- Set — Extract Email Fields (Edit Fields (Set)): sets 5 fields: emailUid, emailSubject, emailFrom…
- OpenAI Agent — Score Relevance (AI Agent): runs an AI agent, with model: OpenAI — Relevance Model
- Code: runs custom JavaScript code
- Filter: keeps only the items that match a condition
- Imap: delete email
- Aggregate: combines items into one
- If: checks a condition and branches into true / false
- OpenAI Agent — Research Topics (AI Agent): runs an AI agent, with model: OpenAI — Research Model; 1 tool (Tavily — Web Search)
- Code: runs custom JavaScript code
…plus 1 more step. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:
- AI Agent v1 (old agent modes) in OpenAI Agent — Score Relevance (v1.9), OpenAI Agent — Research Topics (v1.9): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) OpenAI Agent — Score Relevance (v1.9), OpenAI Agent — Research Topics (v1.9) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (11)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Imap
n8n-nodes-imap.imap - Edit Fields (Set)
n8n-nodes-base.set - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Code
n8n-nodes-base.code - Filter
n8n-nodes-base.filter - Aggregate
n8n-nodes-base.aggregate - If
n8n-nodes-base.if - Tavily Tool
@tavily/n8n-nodes-tavily.tavilyTool - Gmail
n8n-nodes-base.gmail
From the author
Quick overview Monitor an inbox, keep only emails about AI in the legal industry (or any topic), research each topic with web search, and email a branded HTML digest. How it works 1. A schedule trigger polls an IMAP mailbox every few hours for unread emails.…