Skip to main content

Email to Notion knowledge base with IMAP, Postgres dedup and Telegram alert

Workflow preview

Workflow preview
100%
Email to Notion knowledge base with IMAP, Postgres dedup and Telegram alert preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Filter incoming emails via IMAP, extract & clean the body into plain text, normalize (title/slug/snippet/date/from/url), check for duplicates in Postgres, store as a row in a Notion database, then ...

Best for

  • Internal Wiki automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.emailreadimap, n8n-nodes-base.code, n8n-nodes-base.postgres, n8n-nodes-base.if, n8n-nodes-base.notion, n8n-nodes-base.telegram, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Ariyanto Catur Pamungkas.

Original n8n.io source

1.1 Workflow description

Title
Email to Notion knowledge base with IMAP, Postgres dedup and Telegram alert
Workflow name
Email to Notion knowledge base with IMAP, Postgres dedup and Telegram alert

Filter incoming emails via IMAP, extract & clean the body into plain text, normalize (title/slug/snippet/date/from/url), check for duplicates in Postgres, store as a row in a Notion database, then send a Telegram notification. Perfect for building a knowledge base or inbox triage automation without duplicate noise.

Key Features

IMAP polling (Only UNSEEN).

Extract & clean HTML → plain text.

Normalization: title, snippet, bodyText, slug, messageId, sentAt, fromAddress, sourceUrl.

Deduplication via Postgres (SELECT EXISTS).

Create page in Notion database (property mapping).

Telegram success notification.

Tags: email, imap, notion, postgres, deduplication, telegram, automation, knowledge-base

Prerequisites

IMAP access (Gmail/Outlook/Custom).

Gmail: enable IMAP + App Password if using 2FA.

Notion Integration Token & Database ID (database must be shared with the integration).

PostgreSQL accessible from n8n.

(Optional) Telegram Bot Token & Chat ID.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Email Trigger (IMAP)

Type / Role
n8n-nodes-base.emailReadImap - emailReadImap
Config choices
Version 2.1

Block 2 - Code

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 3 - Execute a SQL query

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 4 - If

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 5 - Create a database page

Type / Role
n8n-nodes-base.notion - notion
Config choices
Version 2.2

Block 6 - Send a text message

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 7 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Email Trigger (IMAP)1

Type / Role
n8n-nodes-base.emailReadImap - emailReadImap
Config choices
Version 2.1

Block 10 - Code1

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - Execute a SQL query1

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 12 - If1

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 13 - Create a database page1

Type / Role
n8n-nodes-base.notion - notion
Config choices
Version 2.2

Block 14 - Send a text message1

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 15 - Email Trigger (IMAP)2

Type / Role
n8n-nodes-base.emailReadImap - emailReadImap
Config choices
Version 2.1

Block 16 - Code2

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 17 - Execute a SQL query2

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 18 - If2

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 19 - Create a database page2

Type / Role
n8n-nodes-base.notion - notion
Config choices
Version 2.2

Block 20 - Send a text message2

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 21 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Email Trigger (IMAP)3

Type / Role
n8n-nodes-base.emailReadImap - emailReadImap
Config choices
Version 2.1

Block 24 - Code3

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Showing the first 24 of 28 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Email to Notion knowledge base with IMAP, Postgres dedup and Telegram alert
Complexity advanced
Nodes 28
Categories Internal Wiki, Multimodal AI
Author Ariyanto Catur Pamungkas
Published 14 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7385/7385.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Email to Notion knowledge base with IMAP, Postgres dedup and Telegram alert do?

Filter incoming emails via IMAP, extract & clean the body into plain text, normalize (title/slug/snippet/date/from/url), check for duplicates in Postgres, store as a row in a Notion database, then ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Internal Wiki, Multimodal AI use case.