← All N8N workflows
AI & researchAgentAirtableCodeFilterGmail

mails2notion V2

Configured with Agent, Airtable, Filter, Gmail, and additional nodes. Review the connections and setup before adapting this template.

Workflow preview
AI & modelsOpenAI Chat ModelOpenAI Chat ModelIntegrationCalculatorTool CalculatorTransformStructured OutputParserOutput Parser StructuredMessagingAdd Label "Processed"GmailRoutingActive Routes OnlyFilterTransformExtract Route IDEdit FieldsData storeDeactivate RouteAirtableMessagingAdd Label "Error"GmailMessagingSend notification aboutdeactivated routeGmailMessagingSend notification aboutmissing routeGmailData storeGet Route by IDAirtableWeb / APICreate Notion PageHTTP RequestTriggerGmail TriggerGmail TriggerRoutingFilter for unprocessedmailsFilterTriggerWhen clicking ‘Testworkflow’Manual TriggerRoutingRequired labelsFilterTransformGlobalsEdit FieldsRoutingNo Operation, donothingNo OpCodeFormat Notion PageBlocksCodeMessagingGet all labelsGmailTransformStructured OutputParser1Output Parser StructuredIntegrationCalculator1Tool CalculatorAI & modelsOpenAI Chat Model1OpenAI Chat ModelAI & modelsGenerate ActionableTaskAgentAI & modelsGet Summary & Meta DataAgent

Node categories in this workflow

  • AI & models
  • Integration
  • Transform
  • Messaging
  • Routing
  • Data store
  • Web / API
  • Trigger
  • Code

Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.

Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.

How it works

The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.

Workflow node names, types, and operations
NodeCategoryTypeOperation
OpenAI Chat ModelAI & modelsOpenAI Chat ModelSee node parameters
CalculatorIntegrationTool CalculatorSee node parameters
Structured Output ParserTransformOutput Parser StructuredSee node parameters
Add Label "Processed"MessagingGmailaddLabels
Active Routes OnlyRoutingFilterSee node parameters
Extract Route IDTransformEdit FieldsSee node parameters
Deactivate RouteData storeAirtableupdate
Add Label "Error"MessagingGmailaddLabels
Send notification about deactivated routeMessagingGmailSee node parameters
Send notification about missing routeMessagingGmailSee node parameters
Get Route by IDData storeAirtableget
Create Notion PageWeb / APIHTTP RequestPOST
Gmail TriggerTriggerGmail TriggerSee node parameters
Filter for unprocessed mailsRoutingFilterSee node parameters
When clicking ‘Test workflow’TriggerManual TriggerSee node parameters
Required labelsRoutingFilterSee node parameters
GlobalsTransformEdit FieldsSee node parameters
No Operation, do nothingRoutingNo OpSee node parameters
Format Notion Page BlocksCodeCodeSee node parameters
Get all labelsMessagingGmaillabel
Structured Output Parser1TransformOutput Parser StructuredSee node parameters
Calculator1IntegrationTool CalculatorSee node parameters
OpenAI Chat Model1AI & modelsOpenAI Chat ModelSee node parameters
Generate Actionable TaskAI & modelsAgentSee node parameters
Get Summary & Meta DataAI & modelsAgentSee node parameters

Setup

  1. Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
  2. Connect your own credentials through n8n’s credential store. Replace REPLACE_WITH_* values with your resource identifiers.
  3. Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
  4. Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.

Requirements

An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.

Credential types declared in the source

  • airtableTokenApi
  • gmailOAuth2
  • openAiApi

Workflow notes

Setup

Setup

  • Disable the Gmail Trigger and enable the manual trigger here
  • Execute the workflow once
  • Copy the Gmail Label IDs from the output of the "Required labels" node to the "Globals" node
  • Disable the manual trigger here and and enable the Gmail Trigger again
  • Activate the workflow, so it runs automatically in the background
Set Globals

Set Globals

Use the setup instructions below to retrieve the values for both errorLabelID and processedLabelID

Select Base

Select Base

Select the database and the table where the "Routes" are defined

Sticky Note3

The Gmail inbox is checked every minute for new entries

Sticky Note4

Extract the Airtable Row ID from the Email address

Sticky Note5

Filter by labels to prohibit double-processing

Sticky Note6

Dynamically build request body for Notion, since dynamic auth, and content with optional fields require a custom request

Sticky Note7

The custom built request including the user specific authentication is sent to Notion to create a new Page inside of a database

Sticky Note8

The Email is processed in multiple ways:

  • An actionable task is being generated based on the content, consisting of a short title, a short description and optionally a few details as bullet points
  • A detailed Email summary is being generated
  • Meta data is being extracted - so the user has a reference to find the original Email again
  • To get more stable results, the tasks are devided between two Agents
Sticky Note9

Skip disabled routes (determined by a checkbox attribute in Airtable)

Sticky Note10

Send custom Email notifications back to sender, containing an error message and suggestions to fix it

Sticky Note11

Add labels which prevent from double-processing

Sticky Note12

Disable a checkbox attribute in Airtable which determines if a route is active

mails2notion V2

mails2notion V2

Purpose and structure

This folder contains the mails2notion V2 workflow. Its executable nodes use agent, airtable, code, filter, gmail, gmailTrigger, httpRequest, lmChatOpenAi, manualTrigger, noOp, outputParserStructured, set, toolCalculator. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.

Setup

Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.

Entry points

Gmail Trigger, When clicking ‘Test workflow’

Verification

Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.

Attribution

https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Code/1921_Code_Filter_Automation_Webhook.json MIT; preserve source notices.

More in AI & research