Skip to main content

Automated Gmail reply drafts with OpenAI assistant for labeled emails

Workflow preview

Workflow preview
100%
Automated Gmail reply drafts with OpenAI assistant for labeled emails preview
Open on n8n.io

Important notice

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

1. Workflow Overview

n8n workflow template description [template] This workflow automatically drafts replies to your emails using an OpenAI Assistant, streamlining your inbox management. It's designed for support teams...

Best for

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

Tools used

n8n-nodes-base.code, n8n-nodes-base.httprequest, n8n-nodes-base.gmail, n8n-nodes-base.scheduletrigger, n8n-nodes-base.set, n8n-nodes-base.markdown, n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.openai

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Automated Gmail reply drafts with OpenAI assistant for labeled emails
Workflow name
Automated Gmail reply drafts with OpenAI assistant for labeled emails

n8n workflow template description [template] This workflow automatically drafts replies to your emails using an OpenAI Assistant, streamlining your inbox management. It's designed for support teams, sales professionals, or anyone looking to accelerate their email response process by leveraging AI to create context-aware draft replies in Gmail. How it works The workflow runs on a schedule (every minute) to check for emails with a specific label in your Gmail account. It takes the content of the newest email in a thread and sends it to your designated OpenAI Assistant for processing. A draft reply is generated by the AI assistant. This AI-generated reply is then added as a draft to the original email thread in Gmail. Finally, the initial trigger label is removed from the email thread to prevent it from being processed again. Set up steps Connect your accounts: You'll need to connect your Gmail and OpenAI accounts in the respective nodes. Configure the trigger: In the "Get threads with specific labels" Gmail node, specify the label that you want to use to trigger the workflow (e.g., generate-reply). Any email you apply this label to will be processed. Select your OpenAI Assistant: In the "Ask OpenAI Assistant" node, choose the pre-configured Assistant you want to use for generating replies. Configure label removal: In the "Remove AI label from email" Gmail node, ensure the same trigger label is selected to be removed after the draft has been successfully created. Activate the workflow: Save and activate the workflow to begin automating your email replies.

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 - Convert raw to base64

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

Block 2 - Add email draft to thread

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.1

Block 3 - Remove AI label from email

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

Block 4 - Schedule trigger (1 min)

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

Block 5 - Map fields for further processing

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

Block 6 - Convert response to HTML

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

Block 7 - Build email raw

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

Block 8 - Sticky Note

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

Block 9 - Sticky Note2

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

Block 10 - Sticky Note1

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

Block 11 - Sticky Note4

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

Block 12 - Sticky Note5

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

Block 13 - Sticky Note7

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

Block 14 - Sticky Note8

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

Block 15 - Sticky Note9

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

Block 16 - Get threads with specific labels

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

Block 17 - Ask OpenAI Assistant

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1

Block 18 - Loop over threads

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

Block 19 - Get thread messages

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

Block 20 - Return last message in thread

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

Block 21 - Get single message content

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

Block 22 - Sticky Note10

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

Block 23 - Sticky Note11

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

3. Summary Table

Workflow Automated Gmail reply drafts with OpenAI assistant for labeled emails
Complexity advanced
Nodes 23
Categories Ticket Management, Multimodal AI
Author Hichul
Published 25 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6442/6442.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 Automated Gmail reply drafts with OpenAI assistant for labeled emails do?

n8n workflow template description [template] This workflow automatically drafts replies to your emails using an OpenAI Assistant, streamlining your inbox management. It's designed for support teams...

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, Multimodal AI use case.