Ready-made recipe · ai
Gmail → AI Agent
An AI Agent reads each new Gmail message and decides by itself: log it as a Google Sheets row, or post it to Slack.
Steps
- When when a new email arrives in gmail — Gmail node only reads
- Then decide whether to add a row to google sheets or post in slack — AI Agent node · may use: Google Sheets, Slack can be undone
Fields to fill (10)
The file has every node wired up. These are the blanks only you can fill (your form, your sheet, your words).
| Node | What to do |
|---|---|
| OpenAI Chat Model | check model: OpenAI Chat Model chosen by default (most used) — swap for Gemini, Anthropic, Ollama … if you like |
| OpenAI Chat Model | fill model (The model) |
| Google Sheets tool | fill documentId (Document) |
| Google Sheets tool | fill sheetName (Sheet) |
| Google Sheets tool | fill columns (Columns) |
| Google Sheets tool | decide per field: a fixed value, or let the agent fill it with {{ $fromAI('field') }} |
| Slack tool | check select = 'channel' (first option; pick yours) |
| Slack tool | fill channelId (The Slack channel to send to) — only if select = channel |
| Slack tool | fill text (The message text to post) |
| Slack tool | decide per field: a fixed value, or let the agent fill it with {{ $fromAI('field') }} |
Accounts to connect (4)
In n8n, pick or add a credential on each node — one of the types below.
- Gmail:
googleApiorgmailOAuth2 - OpenAI Chat Model:
openAiApi - Google Sheets tool:
googleApiorgoogleSheetsOAuth2Api - Slack tool:
slackApiorslackOAuth2Api
- Run it on Apify — type your own sentence, get the workflow back in seconds. Open Bridgecore on Apify (pay per use, $0.02–$0.05; nothing charged on errors).
- Ask your AI — add the MCP server
https://mcp.usebridgecore.com/to Claude, Cursor or any MCP client, then just say what should happen. Tools:do,find_recipe,plan_automation,make_n8n_workflow. Free to plan. - Ask me first — add “and ask me first” to any step (“… and post it on X and ask me first”) and the workflow sends you an Approve / Decline message (Slack, Telegram or Gmail) before that step runs. Nothing is sent, posted, deleted or paid until you tap Approve; no answer in a day = declined.
Get the n8n file
Download gmail-agent-sheets-or-slack.json
- Open a new, empty workflow in n8n.
- Open the workflow menu (⋯) and choose Import from File — or copy the JSON below and paste it onto the canvas (Ctrl/Cmd+V).
- Connect the accounts, fill the fields above, run one test, then turn the workflow on.
Or copy the JSON
{
"name": "An AI Agent reads each new Gmail message and decides by itself: log it as a Google Sheets row",
"nodes": [
{
"id": "n1",
"name": "Gmail Trigger",
"type": "n8n-nodes-base.gmailTrigger",
"typeVersion": 1.4,
"parameters": {
"event": "messageReceived"
},
"position": [
240,
300
],
"notes": "step: when a new email arrives in gmail · reversibility: read-only"
},
{
"id": "n2",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3.1,
"parameters": {
"promptType": "define",
"text": "=Decide whether to add a row to google sheets or post in slack:\n\n{{ JSON.stringify($json) }}"
},
"position": [
460,
300
],
"notes": "step: decide whether to add a row to google sheets or post in slack · reversibility: reversible"
},
{
"id": "n3",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.3,
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": ""
}
},
"position": [
460,
500
]
},
{
"id": "n4",
"name": "Google Sheets tool",
"type": "n8n-nodes-base.googleSheetsTool",
"typeVersion": 4.7,
"parameters": {
"resource": "sheet",
"operation": "append",
"documentId": {
"__rl": true,
"mode": "list",
"value": ""
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": ""
},
"columns": {
"mappingMode": "autoMapInputData",
"value": {},
"matchingColumns": [],
"schema": []
}
},
"position": [
640,
500
]
},
{
"id": "n5",
"name": "Slack tool",
"type": "n8n-nodes-base.slackTool",
"typeVersion": 2.7,
"parameters": {
"resource": "message",
"operation": "post",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": ""
},
"text": ""
},
"position": [
820,
500
]
}
],
"connections": {
"Gmail Trigger": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Google Sheets tool": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Slack tool": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"active": false
}