This workflow corresponds to n8n.io template #15741 — we link there as the canonical source.
This workflow follows the Agent → Gmail recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "k6OH7nGrxYbTWvGa",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "heet-Transaction Log - Suspicious Pattern Detector",
"tags": [],
"nodes": [
{
"id": "04aeddf8-6ef2-45bf-b4c4-d62bb616663a",
"name": "filters today's transactions",
"type": "n8n-nodes-base.if",
"position": [
272,
-16
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "c49b839b-e3b4-48f5-aaec-59507513b907",
"operator": {
"type": "dateTime",
"operation": "equals"
},
"leftValue": "={{ $json.date }}",
"rightValue": "={{ new Date().toISOString().split('T')[0] }}"
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.3
},
{
"id": "a2f55030-2a10-45f8-81ca-feeb84ea4f33",
"name": "Check suspicious",
"type": "n8n-nodes-base.if",
"position": [
944,
-32
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 3,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "af5bfcae-c997-4d5c-9bfb-ff72e8b4cf7b",
"operator": {
"type": "number",
"operation": "gte"
},
"leftValue": "={{ $json.high_value_transactions }}",
"rightValue": 5
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.3
},
{
"id": "b73aed6e-076f-45ac-94db-1de9c19265a8",
"name": "Update suspicious",
"type": "n8n-nodes-base.googleSheets",
"position": [
2240,
-32
],
"parameters": {
"columns": {
"value": {
"reason": "={{ $json.high_value_transactions >= 5 && Number($json.amount) > 50000 \n ? $('Generate Risk Analysis').item.json.output \n : \"\" }}",
"row_number": "={{ $json.row_number }}",
"suspicious": "={{ $json.high_value_transactions >= 5 && \n$json.amount > 50000 ? \"Yes\" : \"No\" }}"
},
"schema": [
{
"id": "transaction_id",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "transaction_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "amount",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "amount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "date",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "suspicious",
"type": "string",
"display": true,
"required": false,
"displayName": "suspicious",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "reason",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "reason",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": false,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"row_number"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 731572875,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Z9JlUPMr00U9k385p64yZbj4VKMDcQVd9AKa6FVXE60/edit#gid=731572875",
"cachedResultName": "transaction log"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1Z9JlUPMr00U9k385p64yZbj4VKMDcQVd9AKa6FVXE60",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Z9JlUPMr00U9k385p64yZbj4VKMDcQVd9AKa6FVXE60/edit?usp=drivesdk",
"cachedResultName": "n8n meeting notes automation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "90100615-aa7b-4f21-8a5b-d57e47773b62",
"name": "Groq Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatGroq",
"position": [
1312,
208
],
"parameters": {
"model": "openai/gpt-oss-20b",
"options": {}
},
"credentials": {
"groqApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "ae9e0e2a-bef5-41cf-8eac-996009d885d1",
"name": "Fetch Transactions",
"type": "n8n-nodes-base.googleSheets",
"position": [
-224,
-16
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 731572875,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Z9JlUPMr00U9k385p64yZbj4VKMDcQVd9AKa6FVXE60/edit#gid=731572875",
"cachedResultName": "transaction log"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1Z9JlUPMr00U9k385p64yZbj4VKMDcQVd9AKa6FVXE60",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Z9JlUPMr00U9k385p64yZbj4VKMDcQVd9AKa6FVXE60/edit?usp=drivesdk",
"cachedResultName": "n8n meeting notes automation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "68e777c6-0b42-40af-bc5c-a3487fd07b55",
"name": "Update Transaction date",
"type": "n8n-nodes-base.googleSheets",
"position": [
16,
-16
],
"parameters": {
"columns": {
"value": {
"date": "=\n{{ $json.date ? $json.date : new Date().toISOString().split('T')[0] }}",
"amount": "={{ $json.amount }}",
"reason": "={{ $json.reason }}",
"row_number": "={{ $json.row_number }}",
"suspicious": "={{ $json.suspicious }}",
"transaction_id": "={{ $json.transaction_id }}"
},
"schema": [
{
"id": "transaction_id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "transaction_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "amount",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "amount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "date",
"type": "string",
"display": true,
"required": false,
"displayName": "date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "suspicious",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "suspicious",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "reason",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "reason",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": false,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"row_number"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 731572875,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Z9JlUPMr00U9k385p64yZbj4VKMDcQVd9AKa6FVXE60/edit#gid=731572875",
"cachedResultName": "transaction log"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1Z9JlUPMr00U9k385p64yZbj4VKMDcQVd9AKa6FVXE60",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Z9JlUPMr00U9k385p64yZbj4VKMDcQVd9AKa6FVXE60/edit?usp=drivesdk",
"cachedResultName": "n8n meeting notes automation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "24ba497a-a9d0-4404-83f9-e99de8deddcc",
"name": "Generate Risk Analysis",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1312,
16
],
"parameters": {
"text": "=Analyze today's transaction activity:\n\nTotal transactions:{{ $json.total_transactions_today }}\nHigh-value transactions (>50000):{{ $json.high_value_transactions }}\n{{ $json.total_amount_today }}\nTotal transaction amount:\n{{ $json.total_amount_today }}\nWrite a short 2-3 line risk explanation including numbers. Mention if this pattern looks suspicious and why.Explain why this is risky. ",
"options": {},
"promptType": "define",
"hasOutputParser": true
},
"executeOnce": true,
"typeVersion": 3.1,
"alwaysOutputData": true
},
{
"id": "46b02ca1-457a-47c3-ab6f-2ad309d6255e",
"name": "Update non-suspicious",
"type": "n8n-nodes-base.googleSheets",
"position": [
1088,
176
],
"parameters": {
"columns": {
"value": {
"reason": "NA",
"row_number": "={{ $json.row_number }}",
"suspicious": "No"
},
"schema": [
{
"id": "transaction_id",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "transaction_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "amount",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "amount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "date",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "suspicious",
"type": "string",
"display": true,
"required": false,
"displayName": "suspicious",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "reason",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "reason",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "number",
"display": true,
"removed": false,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"row_number"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 731572875,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Z9JlUPMr00U9k385p64yZbj4VKMDcQVd9AKa6FVXE60/edit#gid=731572875",
"cachedResultName": "transaction log"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1Z9JlUPMr00U9k385p64yZbj4VKMDcQVd9AKa6FVXE60",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Z9JlUPMr00U9k385p64yZbj4VKMDcQVd9AKa6FVXE60/edit?usp=drivesdk",
"cachedResultName": "n8n meeting notes automation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "f8f4fd03-d50c-4db1-8296-1e904cb36e10",
"name": "Risk Email",
"type": "n8n-nodes-base.gmail",
"position": [
2400,
-32
],
"parameters": {
"message": "=Dear Team, A suspicious transaction pattern has been detected in today's activity. \nSummary: - Total Transactions: {{ $node[\"Calculate Transaction Metrics\"].json.total_transactions_today }} \n- High-Value Transactions (>50,000): {{ $node[\"Calculate Transaction Metrics\"].json.high_value_transactions }}\n- Total Transaction Amount: \u20b9{{ $node[\"Calculate Transaction Metrics\"].json.total_amount_today }} \nRisk Analysis : {{ $json.reason }} \nPlease review these transactions for any potential risks or irregularities. \nThank you!!!",
"options": {},
"subject": "Suspicious Transaction Activity Detected",
"emailType": "text"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"executeOnce": true,
"typeVersion": 2.2
},
{
"id": "b961aa86-1792-4950-9f8f-88baac07d9e5",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1152,
-1120
],
"parameters": {
"width": 624,
"height": 992,
"content": "# Suspicious Transaction Detection & Alert System\n# How It Works\n\nThis workflow automates daily monitoring of transaction data from Google Sheets by processing only relevant records. It updates transaction dates only when missing, filters today\u2019s transactions and calculates key metrics like total transactions, total amount and high-value transactions. Based on these insights, it evaluates suspicious patterns and uses AI to generate a clear risk explanation when conditions are met.\nThe workflow then updates only qualifying transactions as suspicious with the generated reason, while non-suspicious records are updated separately. Finally, a single email alert is sent with a summary and risk analysis to enable quick action without duplicate notifications.\n\n# Setup Steps\n\n## 1. Connect Google Sheets\nAuthenticate and map required columns\n\n## 2. Configure Date Handling\nUpdate date only if empty\n\n## 3. Configure Data Processing\nSet threshold and filtering\n\n## 4. Configure AI Model\nConnect and set prompt\n\n## 5. Set Email Alerts\nAdd recipient email\n\n## 6. Test Workflow\nRun and verify output"
},
"typeVersion": 1
},
{
"id": "1d76b51d-e2c6-4d35-8c97-4d123365021a",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-464,
-160
],
"parameters": {
"color": 7,
"width": 640,
"height": 352,
"content": "## Data Fetch & Filtering\nFetches transaction records from Google Sheets, updates the transaction date and filters only today\u2019s data to ensure accurate daily processing. This step ensures only relevant and latest transactions are considered while avoiding outdated or duplicate entries. It also prepares clean and structured data for further analysis in the workflow."
},
"typeVersion": 1
},
{
"id": "4aaae344-c51d-4f09-a6eb-3fc45a9e6da4",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
240,
-160
],
"parameters": {
"color": 7,
"width": 608,
"height": 352,
"content": "## Transaction Metrics Calculation\nCalculates total transactions, total amount and counts high-value transactions for analysis. These metrics provide a quick overview of daily activity and help in identifying unusual spikes in transaction behavior."
},
"typeVersion": 1
},
{
"id": "2e221a3e-a359-4565-882f-47b17211be9e",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
896,
-208
],
"parameters": {
"color": 7,
"width": 672,
"height": 560,
"content": "## Suspicious Detection & AI Analysis\nEvaluates transaction patterns using defined thresholds to detect suspicious activity. When conditions are met, AI generates a short and clear risk explanation based on transaction trends. If the activity is not suspicious, the workflow follows a normal path without AI analysis and proceeds with standard updates."
},
"typeVersion": 1
},
{
"id": "c787635a-d1d4-4b8e-8075-7d560d21a189",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1632,
-192
],
"parameters": {
"color": 7,
"width": 896,
"height": 368,
"content": "## Data Update & Alert Notification\nUpdates transaction records by marking them as suspicious and attaching reasons for tracking. When suspicious activity is detected, it also sends an email alert with a summary and AI-generated risk analysis for quick action."
},
"typeVersion": 1
},
{
"id": "e5a79442-ca17-450d-a359-45a1cf030d1d",
"name": "Starting Trigger",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-416,
-16
],
"parameters": {},
"typeVersion": 1
},
{
"id": "74cd9206-dd71-4430-b3b5-94864e90d56d",
"name": "Calculate Transaction Metrics",
"type": "n8n-nodes-base.code",
"position": [
528,
-32
],
"parameters": {
"jsCode": "const todayItems = items;\n\nconst totalCount = todayItems.length;\n\nlet highAmountCount = 0;\nlet totalAmount = 0;\n\nfor (let i = 0; i < todayItems.length; i++) {\n const amount = Number(todayItems[i].json.amount);\n\n totalAmount += amount;\n\n if (amount > 50000) {\n highAmountCount++;\n }\n}\n\nreturn todayItems.map(item => {\n return {\n json: {\n ...item.json,\n total_transactions_today: totalCount,\n high_value_transactions: highAmountCount,\n total_amount_today: totalAmount\n }\n };\n});"
},
"typeVersion": 2
},
{
"id": "73688b9c-8990-4f27-91a4-41cfb24a5f74",
"name": "Prepare Transaction Data",
"type": "n8n-nodes-base.set",
"position": [
720,
-32
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "7da4bb23-3382-49f6-a807-aee88f9d00ca",
"name": "total_transactions",
"type": "number",
"value": "={{ $json.total_transactions_today }}"
},
{
"id": "91b68868-c6c2-41ca-8ff2-83e4bd5b5b76",
"name": "row_number",
"type": "string",
"value": "={{ $json.row_number }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "0e65cc20-f5cf-4215-bbf1-b8da1e4ba417",
"name": "Merge AI Output with Transactions",
"type": "n8n-nodes-base.merge",
"position": [
1696,
-32
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineByPosition"
},
"typeVersion": 3.2
},
{
"id": "418acd77-e97c-477a-9431-30b2cff7fe1b",
"name": "Fetch Updated Rows from Sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
1872,
-32
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 731572875,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Z9JlUPMr00U9k385p64yZbj4VKMDcQVd9AKa6FVXE60/edit#gid=731572875",
"cachedResultName": "transaction log"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1Z9JlUPMr00U9k385p64yZbj4VKMDcQVd9AKa6FVXE60",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Z9JlUPMr00U9k385p64yZbj4VKMDcQVd9AKa6FVXE60/edit?usp=drivesdk",
"cachedResultName": "n8n meeting notes automation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.7
},
{
"id": "3d5e25db-0333-4d17-a244-0298a8a3ed77",
"name": "Map Final Fields for Update",
"type": "n8n-nodes-base.set",
"position": [
2064,
-32
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "7d18a84b-b606-4720-8523-24fcf8ee6ce7",
"name": "high_value_transactions",
"type": "string",
"value": "={{ $('Merge AI Output with Transactions').item.json.high_value_transactions }}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
}
],
"active": false,
"settings": {
"availableInMCP": false,
"executionOrder": "v1"
},
"versionId": "5ed90a6e-6522-4da1-aba7-486eeb2e6632",
"connections": {
"Groq Chat Model": {
"ai_languageModel": [
[
{
"node": "Generate Risk Analysis",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Check suspicious": {
"main": [
[
{
"node": "Generate Risk Analysis",
"type": "main",
"index": 0
},
{
"node": "Merge AI Output with Transactions",
"type": "main",
"index": 0
}
],
[
{
"node": "Update non-suspicious",
"type": "main",
"index": 0
}
]
]
},
"Starting Trigger": {
"main": [
[
{
"node": "Fetch Transactions",
"type": "main",
"index": 0
}
]
]
},
"Update suspicious": {
"main": [
[
{
"node": "Risk Email",
"type": "main",
"index": 0
}
]
]
},
"Fetch Transactions": {
"main": [
[
{
"node": "Update Transaction date",
"type": "main",
"index": 0
}
]
]
},
"Generate Risk Analysis": {
"main": [
[
{
"node": "Merge AI Output with Transactions",
"type": "main",
"index": 1
}
]
]
},
"Update Transaction date": {
"main": [
[
{
"node": "filters today's transactions",
"type": "main",
"index": 0
}
]
]
},
"Prepare Transaction Data": {
"main": [
[
{
"node": "Check suspicious",
"type": "main",
"index": 0
}
]
]
},
"Map Final Fields for Update": {
"main": [
[
{
"node": "Update suspicious",
"type": "main",
"index": 0
}
]
]
},
"filters today's transactions": {
"main": [
[
{
"node": "Calculate Transaction Metrics",
"type": "main",
"index": 0
}
],
[]
]
},
"Calculate Transaction Metrics": {
"main": [
[
{
"node": "Prepare Transaction Data",
"type": "main",
"index": 0
}
]
]
},
"Fetch Updated Rows from Sheet": {
"main": [
[
{
"node": "Map Final Fields for Update",
"type": "main",
"index": 0
}
]
]
},
"Merge AI Output with Transactions": {
"main": [
[
{
"node": "Fetch Updated Rows from Sheet",
"type": "main",
"index": 0
}
]
]
}
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
gmailOAuth2googleSheetsOAuth2ApigroqApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
> n8n, Google Sheets, Groq AI & Gmail Alerts
Source: https://n8n.io/workflows/15741/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This n8n workflow automates your entire B2B outreach pipeline from lead discovery to personalized cold email delivery. Submit a form, let Apollo find and enrich your leads, review AI-generated emails
How It Works Trigger: The workflow starts automatically when a new file (PDF, DOCX, or TXT) is uploaded to a specific Google Drive folder for client briefs. Configuration: The workflow sets up key var
This workflow automates real estate investment analysis using Google Sheets and AI. It calculates ROI and rental yield, detects duplicate entries, generates AI-based recommendations and sends email re
This workflow automates the tracking of stock market sector rotation. It fetches a list of active stocks from Google Sheets, pulls their last 5 days of market data from Yahoo Finance and calculates mo
This automated n8n workflow evaluates the historical performance of gold against equity markets. It extracts daily price data from Google Sheets, calculates comparative returns and uses an AI agent to