n8n workflow template · 32 nodes · OpenAI
Send a ChatGPT email reply and save responses to Google Sheets is a free n8n workflow template that starts from the Gmail Trigger node and works with OpenAI, Gmail and Google Sheets. It has 32 nodes, 1 of them AI nodes (OpenAI). The notes inside the workflow say: “This workflow sends a OpenAI GPT reply when an email is received from specific email recipients. It then saves the initial email and the GPT response to an automatically generated Google spreadsheet.” To run it, you add your own credentials for Gmail OAuth2, Google Sheets 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.
This workflow sends a OpenAI GPT reply when an email is received from specific email recipients. It then saves the initial email and the GPT response to an automatically generated Google spreadsheet. Subsequent GPT responses will be added to the same spreadsheet. Additionally, when feedback is given for any of the GPT responses, it will be recorded to the spreasheet, which can then be used later to fine-tune the GPT model.
This workflow is essentially a two-in-one workflow. It triggers off from two different nodes and have very different functionality from each trigger.
On email received
On feedback given
This workflow should never reach this node. It is only here for extending the functionality of this workflow if needed.
The email that was received is too large to process, as it exceeds token limit. See more on token limits.
The spreadsheet ID is stored in this workflow's static data. If you want to refresh the static data you will need to copy this entire workflow into a new workflow.
If your workflow reaches this stage, you will need to consider increasing the tokens in Generate reply node.
The spreadsheet ID is stored in this workflow's static data. If you want to refresh the static data you will need to copy this entire workflow into a new workflow.
A spreadsheet is created if the spreadsheet does not exist. The spreadsheet ID is stored in the $getWorkflowStaticData('global') variable. Using Extract current deal node, the deal information is formatted for the sending to the new spreadsheet.
If you ever want to start over, delete the old spreadsheet, making sure that it is also deleted from Google Drive's trash.
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.
If you decide to use your own spreadsheet, it is up to you to ensure all columns are present before running this workflow. A good way to do this is to run this workflow once with empty spreadsheetid and worksheetId variables (see the Configure node). Then map the output from Store spreadsheet ID to this node.
It is recommended that you specify the spreadsheetId and worksheetId, since relying solely on a workflow's static data is considered bad practice.
spreadsheetId: The ID of the spreadsheet where Pipedrive deals will be stored. worksheetId: The ID of the worksheet where Pipedrive deals will be stored. spreadsheetName(required): The human readable name of the spreadsheet where Pipedrive deals will be stored. worksheetName(required): The human readable name of the worksheet in the spreadsheet where Pipedrive deals will be stored. recipients(required): Comma-separated list of email recipients to send ChatGPT emails to. Use to send ChatGPT response to every email address. maxTokenSize(required): The maximum token size for the model you choose. See possible models from OpenAI here. replyTokenSize(required): The reply's maximum token size. Default is 300. This determines how much text the AI will reply with.
The 32 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