n8n workflow template · 13 nodes · Gmail
Compose reply draft in Gmail with OpenAI Assistant is a free n8n workflow template that runs on a schedule and works with Gmail and OpenAI. It has 13 nodes, 1 of them AI nodes (OpenAI). The notes inside the workflow say: “Run the workflow in equal intervals and check for threads with specific labels (trigger labels).” To run it, you add your own credentials for Gmail OAuth2 and OpenAI API.
The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.
Run the workflow in equal intervals and check for threads with specific labels (trigger labels).
Retrieve content of the last message in the thread.
Return all messages for a single thread and pass for further processing only the last one.
Transfer email content to OpenAI Assitant and return AI-generated reply.
Convert incoming Markdown from OpenAI Assistant into HTML content.
Create raw message in RFC standard and encode it into base64 string (please see Gmail API reference for more details).
Add reply draft from OpenAI Assistant to specific Gmail thread.
Delete trigger label from the Gmail thread.
The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.
This workflow automatically transfers content of incoming email messages with specific labels into OpenAI Assitant and returns reply draft. After draft is composed, trigger label is deleted from the thread.
Please remember to configure your OpenAI Assistant first.
Thank you for your support!
The 13 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:
Configure your own credentials after importing. Create each credential in n8n, then select it in the node.
Do you need somewhere to run it? Read our guide to self-hosted n8n.
We can adapt this workflow to your apps, data and process, then deploy and support it.
Contact Us