Skip to main content

Host an AI Gmail reply approval inbox with OpenAI and CustomJS

Workflow preview

Workflow preview
100%
Host an AI Gmail reply approval inbox with OpenAI and CustomJS preview
Open on n8n.io

1. Workflow Overview

Quick overview Build super flexible and customizable Human in the Loop (HITL) processes with n8n and CustomJS. Instead of letting AI reply autonomously, this workflow ...

Best for

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

Tools used

n8n-nodes-base.manualtrigger, @custom-js/n8n-nodes-pdf-toolkit-v2.pdftoolkit, n8n-nodes-base.stickynote, n8n-nodes-base.gmail, n8n-nodes-base.webhook, n8n-nodes-base.code, @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 CustomJS.

Original n8n.io source

1.1 Workflow description

Title
Host an AI Gmail reply approval inbox with OpenAI and CustomJS
Workflow name
Host an AI Gmail reply approval inbox with OpenAI and CustomJS

Quick overview

Build super flexible and customizable Human-in-the-Loop (HITL) processes with n8n and CustomJS. Instead of letting AI reply autonomously, this workflow fetches data, drafts responses, and hosts interactive approval pages via CustomJS—ensuring full human quality control over your automations with optional custom domain hosting.

How it works

  1. Trigger: Set to run manually (or scheduled on a cron job).
  2. Fetch Emails: Pulls unread messages from your Gmail inbox.
  3. Filter: Discards standard no-reply and notification addresses.
  4. AI Generation: OpenAI analyzes the email text and subject line to write a suggested reply.
  5. Build Dashboard: A Code node merges the dataset into a premium HTML template.
  6. Upsert Page: The CustomJS node hosts the generated HTML instantly.

Setup

  1. Configure the Base URL: Open the Build Approval Page Code node, locate the configuration section (around line 22), and replace the placeholder with your actual n8n instance URL:
  2. Connect CustomJS: Add your CustomJS API token to your n8n to allow the workflow to automatically push and host the generated process pages.
  3. Activate Webhook: Ensure your n8n webhook node is set to "Production" so it can reliably receive the approval and rejection signals from your hosted page.

Requirements

  • n8n Instance: A running self-hosted or cloud instance of n8n to manage the automation logic and webhooks.
  • CustomJS Account: A CustomJS active account to handle the automated deployment of your frontend code.
  • Workflow Data Source: Connected credentials (e.g., Gmail, database, CRM) for the system you want to monitor and control.

Additional info

This workflow utilizes the CustomJS HTML Hosting Service to host and publish your custom human-in-the-loop process steps instantly as a clean HTML page.

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 - When clicking 'Execute workflow'

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

Block 2 - Upsert Approval Page

Type / Role
@custom-js/n8n-nodes-pdf-toolkit-v2.pdfToolkit - pdfToolkit
Config choices
Version 1

Block 3 - Sticky Note Overview

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

Block 4 - Sticky Note Email

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

Block 5 - Sticky Note AI

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

Block 6 - Sticky Note Host

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

Block 7 - Get many messages

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

Block 8 - Webhook - Receive Approval

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

Block 9 - Extract Reply Data

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

Block 10 - Lane 2 Note

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

Block 11 - Filter No Reply Emails

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

Block 12 - Generate AI Draft Reply

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

Block 13 - Format Email Drafts

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

Block 14 - Build Approval Page

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

Block 15 - Reply to a message

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

Block 16 - Mark a message as read

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

3. Summary Table

Workflow Host an AI Gmail reply approval inbox with OpenAI and CustomJS
Complexity advanced
Nodes 16
Categories Ticket Management, AI Chatbot
Author CustomJS
Published 20 May 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/15865/15865.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 Host an AI Gmail reply approval inbox with OpenAI and CustomJS do?

Quick overview Build super flexible and customizable Human in the Loop (HITL) processes with n8n and CustomJS. Instead of letting AI reply autonomously, this workflow ...

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