Skip to main content

Poll multiple Gmail accounts with unified data table storage & Discord notifications

Workflow preview

Workflow preview
100%
Poll multiple Gmail accounts with unified data table storage & Discord notifications preview
Open on n8n.io

Important notice

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

1. Workflow Overview

This template lets you poll multiple Gmail accounts from a single workflow using n8n’s credential aware execution. Instead of creating separate workfl...

Best for

  • Ticket Management automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-run-node-with-credentials-x.runnodewithcredentialsx, n8n-nodes-base.scheduletrigger, n8n-nodes-base.code, n8n-nodes-base.datatable, n8n-nodes-base.splitinbatches, n8n-nodes-base.set, n8n-nodes-base.discord, 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 Jatin Khatri.

Original n8n.io source

1.1 Workflow description

Title
Poll multiple Gmail accounts with unified data table storage & Discord notifications
Workflow name
Poll multiple Gmail accounts with unified data table storage & Discord notifications

This template lets you poll multiple Gmail accounts from a single workflow using n8n’s credential-aware execution. Instead of creating separate workflows for every inbox, this setup loops through all accounts stored in your data table and runs Gmail operations dynamically using the correct OAuth2 credential.

It’s built for cases like cold-email systems, multi-client mail monitoring, or anything that needs centralized polling and logging.

### What It Does

  1. Pulls all email account records from the cold_email_accounts table.

  2. For every account, the workflow:

  3. Runs the Gmail “Get Many Messages” node for that account using "Run Node With Credentials X" community node.

  4. Messages are reformatted into a clean JSON object (from, subject, preview text, body, labels, attachments, etc.).

  5. Saved into the All Emails table using an upsert (avoids duplicates).

  6. Sends a Discord notification like “15 new emails arrived”.

### How to Set It Up

  1. Create Gmail OAuth2 credentials in n8n, one for each email account you want to poll.

  2. Add those credentials into a Data Table named cold_email_accounts with columns: cred_id credentials_name email last_polled (datetime)

  3. Import this workflow template into n8n.

  4. Update: DataTable references (if your names/IDs differ) Discord channel/server IDs Any domain filters inside the Gmail search query

  5. Activate the workflow and it will automatically: Poll each Gmail inbox every hour Save all new emails Notify you on Discord Keep everything synced via last_polled.

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 - Run Node With Credentials X

Type / Role
n8n-nodes-run-node-with-credentials-x.runNodeWithCredentialsX - runNodeWithCredentialsX
Config choices
Version 1

Block 2 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.3

Block 3 - Code in JavaScript

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

Block 4 - upsert emails

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

Block 5 - Update last_polled

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

Block 6 - Update last_polled1

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

Block 7 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 8 - Edit Fields

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 9 - Send a message

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

Block 10 - Sticky Note1

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

Block 11 - Limit

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

Block 12 - Sticky Note

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

Block 13 - Get All Email Accounts

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

Block 14 - Sticky Note2

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

Block 15 - Sticky Note3

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

Block 16 - Email Normalization

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

Block 17 - Sticky Note4

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

Block 18 - Sticky Note5

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

Block 19 - Get new emails if any

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

Block 20 - If new email found

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

Block 21 - If new email found1

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

3. Summary Table

Workflow Poll multiple Gmail accounts with unified data table storage & Discord notifications
Complexity advanced
Nodes 21
Categories Ticket Management
Author Jatin Khatri
Published 11 Dec 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/11721/11721.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 Poll multiple Gmail accounts with unified data table storage & Discord notifications do?

This template lets you poll multiple Gmail accounts from a single workflow using n8n’s credential aware execution. Instead of creating separate workfl...

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 Ticket Management use case.