anaksor-ocr
Sokheng · Kit
Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…
An n8n workflow that writes reply drafts in Gmail with an AI agent. Every minute it finds threads with your trigger label, drafts a reply to the last message and removes the label.
Draft Gmail replies with OpenAI for labelled threads is an n8n workflow in the Productivity category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.
Every minute
It starts on a timer, once every minute, and looks for work in your Gmail:
A reply draft waiting in each labelled thread, ready for you to read, edit and send
What you need before you start.
Lists the labelled threads, reads the last message, saves the draft and removes the label.
NeedsA Gmail OAuth2 credential and a trigger label
Language model
Writes the reply text for each thread, on gpt-6-luna.
NeedsAn OpenAI API key
Checked by Mindket on 13 Nov 2026
This n8n workflow writes reply drafts in Gmail with an AI agent. Every minute it looks for threads that carry a label you chose, reads the last message of each and asks the agent for a reply. The reply is saved as a draft in the same thread, and the label is removed. Fourteen nodes do the work, beside ten sticky notes.
Support teams and shops that answer many similar emails and want a first draft waiting for them. Skip it if you want replies sent without a check, since this workflow only saves drafts.
| Industry | Who uses it | How they use it | Example |
|---|---|---|---|
| Support | Support agents | Start from a draft instead of a blank reply | An agent labels a thread and finds a polite reply waiting in it a minute later. |
| Retail | Shop owners | Answer order questions faster | An owner sees a draft that answers a delivery question and edits one line. |
| Agencies | Account managers | Keep the tone of replies consistent | A manager describes the agency’s tone once and every draft follows it. |
| Freelance | Independent consultants | Handle routine enquiries quickly | A consultant labels a pricing enquiry and reviews the draft before sending. |
You need a little n8n: import a file, add two credentials, create one label in Gmail and describe your business to the agent.
Any n8n that can reach Gmail and OpenAI will run it. It checks on its own once a minute, so you do not need to open n8n.
Write replyDownload saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. Create the trigger label in Gmail first, since you pick it in two nodes.
| Need | Detail |
|---|---|
| n8n | On n8n Cloud or on a server of your own |
| Gmail | A Gmail OAuth2 credential that can read mail, change labels and create drafts, and a label that marks threads |
| OpenAI | An API key, for an OpenAI credential |
workflow.json.Get threads with specific labels, Get thread messages, Get single message content, Add email draft to thread and Remove AI label from email.OpenAI Chat Model.Get threads with specific labels and Remove AI label from email, replace <YOUR_TRIGGER_LABEL_ID> by choosing your trigger label.Write reply.Add the trigger label to a Gmail thread. Within a minute a draft reply appears in that thread, and the label disappears. Open the draft, edit it and send it yourself. The draft is addressed to the sender of the last message.
| To change | Where |
|---|---|
| The trigger label | The label in Get threads with specific labels and Remove AI label from email |
| How often it checks | The interval in Schedule trigger (1 min) |
| The content and the tone | System Message in Write reply |
| The model | Model in OpenAI Chat Model |
A shop owner labels a thread where a customer asks about an order. A minute later the thread holds a draft, a short and polite reply that thanks the customer and asks for the order number.
The owner reads the draft, adds a tracking link and sends it. The trigger label is already gone, so the thread is not drafted a second time.
If you are new. n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. A Gmail thread is a conversation of several emails, and a draft is a message that is saved but not sent. The agent is an AI step that writes the reply text.
For experts. Gmail’s API wants the raw message encoded in base64url, so Build email raw writes the headers and Convert raw to base64 encodes them. Loop over threads collects the last message of every thread, and its done output feeds the rest of the flow.
| Node | What it does | What to know |
|---|---|---|
Schedule trigger (1 min) | Schedule Trigger 1.1, every minute | Switch the workflow off when you do not need it |
Get threads with specific labels | Gmail 2.1, Thread, Get Many, all results | The trigger label picks the threads |
Loop over threads | Split In Batches 3 | Its loop output reads each thread, and its done output carries the last messages on |
Get thread messages | Gmail 2.1, Thread, Get, messages only | Return last message in thread keeps the last one |
Get single message content | Gmail 2.1, Get, full message | It gives the agent the plain text |
Write reply | Agent 1.7 with a system message and no tools | It answers in Markdown |
Convert response to HTML | Markdown 1, Markdown to HTML | The draft body is HTML |
Build email raw | Set 3.3, headers and body as one string | It writes To, Subject and Content-Type |
Convert raw to base64 | Code 2, once for each item | It encodes the string as base64url |
Add email draft to thread | HTTP Request 4.1, a POST to the Gmail drafts address | It uses the Gmail credential and the thread id |
Remove AI label from email | Gmail 2.1, Thread, Remove Labels | It runs after the draft is saved |
The original called a service that has been shut down, and it needed your label before it could run safely.
gpt-6-luna, and the assistant’s instructions lived in the OpenAI dashboard, so write the System Message in Write reply yourself<YOUR_TRIGGER_LABEL_ID>. Without a label the list would cover every thread in the mailbox, and the workflow would draft a reply for eachMap fields for further processing, but no step used it, so it is goneAn n8n workflow that writes reply drafts in Gmail. Every minute it looks for threads that carry a label you chose, asks an AI agent
for a reply to the last message and saves it as a draft in the same thread. The label is removed afterwards, and nothing is sent.
workflow.json: the workflow as n8n exports it, fourteen working nodes and ten sticky notes. It holds no credential.README.md: these notes.Write reply with an OpenAI Chat Model on gpt-6-luna. See Good to know.<YOUR_TRIGGER_LABEL_ID> in Get threads with specific labels and Remove AI label from email, so youConvert raw to base64 now writes base64url, which is what Gmail's documentation asks for.Map fields for further processing no longer stores a message id that no step used.workflow.json.Get threads with specific labels, Get thread messages, Get single message content,Add email draft to thread and Remove AI label from email.OpenAI Chat Model.Get threads with specific labels and Remove AI label from email, replace <YOUR_TRIGGER_LABEL_ID> by choosing your label.Write reply, describe your business and your tone in the System Message.Schedule trigger (1 min) starts the workflow.Get threads with specific labels lists the threads that carry the label.Loop over threads takes them one at a time, and Get thread messages reads each one.Return last message in thread keeps the last message, and Get single message content reads it in full.Write reply asks the model for a reply in Markdown.Map fields for further processing collects the thread and reply, and Convert response to HTML makes the reply HTML.Build email raw writes the message and Convert raw to base64 encodes it.Add email draft to thread saves the draft in the thread.Remove AI label from email takes the trigger label off.Get threads with specific labels and Remove AI label from email.Schedule trigger (1 min).Write reply.OpenAI Chat Model.Write reply.gpt-4o, gpt-4o-mini and gpt-4.1 snapshots as shutting down on 14 January 2027, with gpt-6-luna as thegpt-6-luna.NOTICE.md 643 B README.md 4 KB workflow.json 15 KB
Sokheng · Kit
Reads Khmer and English text from documents, receipts and photos of signs, using a detector for text lines and a recogniser for each line. Suits developers who…
Qwen · Kit
Qwen2.5-7B-Instruct as GGUF files in eight quantization sizes, to chat with locally through llama.cpp. For people who want a capable 7.6B model on their own co…
ACE-Step · Kit
Generates music from text with a 4B diffusion decoder, 50 steps and guidance control, aiming for higher audio quality than the base. For creators with a GPU of…
op7418 · Skill
Skill that makes single-file HTML slide decks, slide illustrations and platform covers in two visual styles, with a presenter mode for rehearsal. For speakers…
zarazhangrui · Skill
Builds HTML presentations from scratch or from a PowerPoint file and shows visual style previews to pick from, for people who want web slides with no CSS or Ja…
iptv-org · Kit
Collects publicly available live TV channels from many countries into playlists that any video player with live streaming can open. Made for viewers and for de…