Reply draft with OpenAI Assistant
Configured with Gmail, HTTP Request, Limit, Markdown, and additional nodes. Review the connections and setup before adapting this template.
Node categories in this workflow
- Messaging
- Web / API
- Code
- Transform
- AI & models
- Routing
- Trigger
Icons describe general node roles, inferred from node types. Inspect the parameters for the configured action.
Drag to pan; use + and − to zoom. Reconstructed from the exported node positions; nothing runs here. Dashed lines represent non-main connections. Full node names and notes appear below.
How it works
The exported workflow contains the following configured nodes. Their connections are shown above; inspect the JSON for the complete logic, expressions, and external actions.
| Node | Category | Type | Operation |
|---|---|---|---|
| Remove AI label from email | Messaging | Gmail | thread / removeLabels |
| Add email draft to thread | Web / API | HTTP Request | POST |
| Convert raw to base64 | Code | Code | See node parameters |
| Build email raw | Transform | Edit Fields | See node parameters |
| Convert response to HTML | Transform | Markdown | See node parameters |
| Map fields for further processing | Transform | Edit Fields | See node parameters |
| Ask OpenAI Assistant | AI & models | Open Ai | assistant |
| Get single message content | Messaging | Gmail | get |
| Return last message in thread | Transform | Limit | See node parameters |
| Get thread messages | Messaging | Gmail | thread / get |
| Loop over threads | Routing | Loop Over Items | See node parameters |
| Get threads with specific labels | Messaging | Gmail | thread |
| Schedule trigger (1 min) | Trigger | Schedule Trigger | See node parameters |
Setup
- Download the JSON and import it into an isolated n8n instance. Leave the workflow inactive.
- Connect your own credentials through n8n’s credential store. Replace
REPLACE_WITH_*values with your resource identifiers. - Inspect API destinations, Code nodes, database queries, file paths, and outbound actions.
- Run with synthetic data and harmless destinations. Enable triggers only after checking the actual outputs.
Requirements
An n8n instance with the listed node types and compatible versions. Service-connected workflows may require accounts, credentials, or paid APIs.
Credential types declared in the source
gmailOAuth2openAiApi
Workflow notes
Reply draft with OpenAI Assistant
Reply draft with OpenAI Assistant
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.
Schedule trigger and get emails
Schedule trigger and get emails
Run the workflow in equal intervals and check for threads with specific labels (trigger labels).
⚠️ Note
⚠️ Note
- Complete video guide for this workflow is available on my YouTube.
- Remember to add your credentials and configure nodes (covered in the video guide).
- If you like this workflow, please subscribe to my YouTube channel and/or my newsletter.
Thank you for your support!
Generate reply
Generate reply
Transfer email content to OpenAI Assitant and return AI-generated reply.
Create HTML message
Create HTML message
Convert incoming Markdown from OpenAI Assistant into HTML content.
Build and encode message
Build and encode message
Create raw message in RFC standard and encode it into base64 string (please see Gmail API reference for more details).
Insert reply draft
Insert reply draft
Add reply draft from OpenAI Assistant to specific Gmail thread.
Remove label
Remove label
Delete trigger label from the Gmail thread.
Return message content
Return message content
Retrieve content of the last message in the thread.
Get last message from thread
Get last message from thread
Return all messages for a single thread and pass for further processing only the last one.
Reply draft with OpenAI Assistant
Reply draft with OpenAI Assistant
Purpose and structure
This folder contains the Reply draft with OpenAI Assistant workflow. Its executable nodes use code, gmail, httpRequest, limit, markdown, openAi, scheduleTrigger, set, splitInBatches. The table and connection map below are derived from the JSON, not an inferred guarantee of behavior.
Setup
Import inactive. Configure your own credentials and replace REPLACE_WITH_* values. Review external destinations and Code nodes before running.
Entry points
Schedule trigger (1 min)
Verification
Sanitized source candidate; not runtime-tested. This overview is generated from node metadata. Read the folder README for the connection map, credential types, and license.
Attribution
https://github.com/Zie619/n8n-workflows/blob/94007c1445d9258a7da116646b79473e7c7c3282/workflows/Limit/0473_Limit_Code_Create_Scheduled.json MIT; preserve source notices.