Capture and log email trade instructions with Gmail, OpenAI, and Google Sheets
Ready for 3.0What this workflow does
This workflow has 10 nodes and runs on Gmail events. Along the way it connects Gmail and Google Sheets. It also calls api.openai.com over HTTP.
How it runs
Trigger: On Gmail events.
- 2. Code — Extract Email Context (Code): runs custom JavaScript code
- 3. HTTP — AI Extract Trade Fields (HTTP Request): calls api.openai.com (POST)
- 4. Code — Parse and Validate Trade Data (Code): runs custom JavaScript code
- 5. IF — Trade Valid? (If): checks a condition and branches into true / false
- 6a. Sheets — Log Valid Trade (Google Sheets): append
- 6b. Sheets — Log Failed Trade (Google Sheets): append
- 7. Gmail — Reply Confirmation to Client (Gmail): reply
- 8. Gmail — Ops Alert (Success) (Gmail): uses Gmail
- 9. Gmail — Ops Alert (Extraction Failed) (Gmail): uses Gmail
Services it uses
HTTP calls to: api.openai.com
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
- Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (1. Gmail Trigger — Watch for Trade Instructions).
Nodes used (6)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Code
n8n-nodes-base.code - HTTP Request
n8n-nodes-base.httpRequest - If
n8n-nodes-base.if - Google Sheets
n8n-nodes-base.googleSheets - Gmail
n8n-nodes-base.gmail
From the author
Quick overview This workflow polls Gmail for emails with the subject “Trade Instruction”, uses OpenAI Chat Completions to extract trade fields from the email body, logs valid and failed extractions to separate tabs in Google Sheets, and sends confirmation and…