This workflow corresponds to n8n.io template #6756 — 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 →
{
"meta": {
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "d0999399-d322-4583-9be4-66e85d03f74d",
"name": "When clicking \u2018Test workflow\u2019",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-1344,
-32
],
"parameters": {},
"typeVersion": 1
},
{
"id": "b9b83351-8968-4416-83ba-e3800ae77fa8",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1664,
720
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1",
"cachedResultName": "gpt-4.1"
},
"options": {
"maxTokens": 3000
}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "5f37bcd0-3e07-4ad5-bc85-55c3b9c24f88",
"name": "Analysis Content By AI",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1344,
368
],
"parameters": {
"text": "=\n\n Reddit post: {{ $('Loop Over Items1').item.json.selftext }}\n\n Is this a post that might benefit from [PRODUCT]?.\n\n Output only yes or no",
"options": {},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "3da3e313-09e1-4b14-b7cd-91ea8187b812",
"name": "Get Posts",
"type": "n8n-nodes-base.reddit",
"position": [
-544,
368
],
"parameters": {
"limit": 3,
"keyword": "={{ $json.keywords }}",
"operation": "search",
"subreddit": "={{ $json.subreddit }}",
"additionalFields": {
"sort": "new"
}
},
"credentials": {
"redditOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "b2a1954b-5656-48aa-a808-faac83cd7da7",
"name": "Filter Posts",
"type": "n8n-nodes-base.if",
"position": [
-304,
336
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "0823d10a-ad54-4d82-bcea-9dd236e97857",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ $json.ups }}",
"rightValue": 0
},
{
"id": "bb8187aa-f0f1-4999-8d4b-bdc9abba0618",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json.selftext }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "dd31d877-e347-4c57-bf58-be9365ddf562",
"name": "Append row in sheet1",
"type": "n8n-nodes-base.googleSheets",
"position": [
2272,
-112
],
"parameters": {
"columns": {
"value": {
"URL": "={{ $('Loop Over Items3').item.json.url }}",
"Date": "={{ $now.toLocaleString() }}",
"Post": "={{ $('Loop Over Items3').item.json.postcontent.slice(0,200) }}",
"Subreddit": "={{ $('Loop Over Items3').item.json.subreddit }}"
},
"schema": [
{
"id": "Date",
"type": "string",
"display": true,
"required": false,
"displayName": "Date",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Subreddit",
"type": "string",
"display": true,
"required": false,
"displayName": "Subreddit",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "URL",
"type": "string",
"display": true,
"required": false,
"displayName": "URL",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Post",
"type": "string",
"display": true,
"required": false,
"displayName": "Post",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Comment",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Comment",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nuxulk6DQ0Ne9q2QdMaG70wOtQ-SWUEKPp3xGU-kXas/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1nuxulk6DQ0Ne9q2QdMaG70wOtQ-SWUEKPp3xGU-kXas",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1nuxulk6DQ0Ne9q2QdMaG70wOtQ-SWUEKPp3xGU-kXas/edit?usp=drivesdk",
"cachedResultName": "Reddit Posts"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "a9598cff-9280-444a-bb37-86d90da5d867",
"name": "Send a message",
"type": "n8n-nodes-base.gmail",
"position": [
2128,
-256
],
"parameters": {
"sendTo": "user@example.com",
"message": "=<p>Relevant reddit threads:</p>\n\n{{ $json.email }}",
"options": {},
"subject": "Relevant Reddit Threads"
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
},
"typeVersion": 2.1
},
{
"id": "066967d1-4ffa-4ccd-a5b9-f72ec0ec914d",
"name": "Loop Over Items",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-736,
224
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "b755e7e4-2a13-41f6-8620-2b1c483fd288",
"name": "Get many rows",
"type": "n8n-nodes-base.supabase",
"position": [
384,
448
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "post_id",
"keyValue": "={{ $json.id }}",
"condition": "eq"
},
{
"keyName": "subreddit",
"keyValue": "={{ $json.subreddit }}",
"condition": "eq"
}
]
},
"tableId": "reddit_posts",
"matchType": "allFilters",
"operation": "getAll"
},
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "61534535-9e56-44ec-b7b0-6df43fc467f6",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
368,
224
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "929a9e35-fb4a-4963-b090-ea4c72b8dbf6",
"operator": {
"type": "boolean",
"operation": "false",
"singleValue": true
},
"leftValue": "={{ $json.duplicate }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2,
"alwaysOutputData": false
},
{
"id": "ab0af8a9-0983-4da6-a321-b5214f631610",
"name": "Code",
"type": "n8n-nodes-base.code",
"position": [
-1088,
96
],
"parameters": {
"jsCode": "return [\n {\n json: {\n subreddit: \"smallbusiness\",\n keywords: \".....\"\n },\n },\n {\n json: {\n subreddit: \"startup\",\n keywords: \".....\"\n },\n }\n]\n"
},
"typeVersion": 2
},
{
"id": "e0f8093a-c573-4fea-a4e1-5d3c6d23243c",
"name": "Loop Over Items1",
"type": "n8n-nodes-base.splitInBatches",
"position": [
48,
304
],
"parameters": {
"options": {
"reset": false
}
},
"typeVersion": 3
},
{
"id": "d61e92f7-8c98-4105-9f0d-24998415d54e",
"name": "Code3",
"type": "n8n-nodes-base.code",
"position": [
1232,
576
],
"parameters": {
"jsCode": "const original = $('Loop Over Items2').item.json;\noriginal.relevant = $input.first().json.output\n\nreturn [\n {\n json: original\n }\n];"
},
"typeVersion": 2,
"alwaysOutputData": true
},
{
"id": "31765299-a625-4edd-82f2-897dc8c10182",
"name": "Code1",
"type": "n8n-nodes-base.code",
"position": [
144,
720
],
"parameters": {
"jsCode": "const original = $('Loop Over Items1').item.json;\nconsole.log($input)\nreturn [\n {\n json: {\n ...original,\n duplicate: Object.keys($input.item.json).length ? true : false\n }\n }\n];"
},
"typeVersion": 2
},
{
"id": "f42750ae-5ae8-4da2-8789-0aa2743c7d57",
"name": "Loop Over Items2",
"type": "n8n-nodes-base.splitInBatches",
"position": [
800,
256
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "3fd1742e-e484-4b69-a4d0-1cc194c396d8",
"name": "If1",
"type": "n8n-nodes-base.if",
"position": [
1216,
160
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "205c2700-1481-46f9-8fba-c976aff29717",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.relevant }}",
"rightValue": "Yes"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "119c7203-0d76-4e04-a3fb-534980d942f4",
"name": "Wait1",
"type": "n8n-nodes-base.wait",
"position": [
1008,
352
],
"parameters": {
"amount": 1
},
"typeVersion": 1.1
},
{
"id": "5c5908c6-0a0f-49d9-a4a3-5437023cb639",
"name": "Loop Over Items3",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1600,
0
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "8882ed88-346c-418e-8f33-1aeea9735068",
"name": "Create a row",
"type": "n8n-nodes-base.supabase",
"position": [
2160,
144
],
"parameters": {
"tableId": "reddit_posts",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "post_id",
"fieldValue": "={{ $json.id }}"
},
{
"fieldId": "username",
"fieldValue": "optl12"
},
{
"fieldId": "subreddit",
"fieldValue": "={{ $json.subreddit }}"
},
{
"fieldId": "url",
"fieldValue": "={{ $json.url }}"
}
]
}
},
"credentials": {
"supabaseApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "cd1b8c33-5fe5-4f4e-9997-84121827fd72",
"name": "Code4",
"type": "n8n-nodes-base.code",
"position": [
1904,
-192
],
"parameters": {
"jsCode": "let email = '';\n\n// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n email += '<p>' + item.json.title + ' - ' + item.json.url + \"</p>\\n\\n\"\n}\n\nreturn {\n email: email\n}\n\n"
},
"typeVersion": 2
},
{
"id": "bc6a55f5-46ad-4b01-8490-b3a6b5408206",
"name": "Code5",
"type": "n8n-nodes-base.code",
"position": [
1888,
80
],
"parameters": {
"jsCode": "return $input.all();"
},
"typeVersion": 2
},
{
"id": "f54257c0-8234-41ef-b50d-a361e24362d8",
"name": "Code6",
"type": "n8n-nodes-base.code",
"position": [
2464,
176
],
"parameters": {
"jsCode": "return $('Code5').first()"
},
"typeVersion": 2
},
{
"id": "6093eb2e-11c1-4fef-a761-8417a74dc7f8",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-1344,
224
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 8
}
]
}
},
"typeVersion": 1.2
}
],
"connections": {
"If": {
"main": [
[
{
"node": "Loop Over Items2",
"type": "main",
"index": 0
}
],
[]
]
},
"If1": {
"main": [
[
{
"node": "Loop Over Items3",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Code1": {
"main": [
[
{
"node": "Loop Over Items1",
"type": "main",
"index": 0
}
]
]
},
"Code3": {
"main": [
[
{
"node": "Loop Over Items2",
"type": "main",
"index": 0
}
]
]
},
"Code4": {
"main": [
[
{
"node": "Send a message",
"type": "main",
"index": 0
}
]
]
},
"Code5": {
"main": [
[
{
"node": "Create a row",
"type": "main",
"index": 0
}
]
]
},
"Code6": {
"main": [
[
{
"node": "Loop Over Items3",
"type": "main",
"index": 0
}
]
]
},
"Wait1": {
"main": [
[
{
"node": "Analysis Content By AI",
"type": "main",
"index": 0
}
]
]
},
"Get Posts": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Create a row": {
"main": [
[
{
"node": "Code6",
"type": "main",
"index": 0
}
]
]
},
"Filter Posts": {
"main": [
[
{
"node": "Loop Over Items1",
"type": "main",
"index": 0
}
]
]
},
"Get many rows": {
"main": [
[
{
"node": "Code1",
"type": "main",
"index": 0
}
]
]
},
"Send a message": {
"main": [
[]
]
},
"Loop Over Items": {
"main": [
[
{
"node": "Filter Posts",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Posts",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items1": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
],
[
{
"node": "Get many rows",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items2": {
"main": [
[
{
"node": "If1",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait1",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items3": {
"main": [
[
{
"node": "Code4",
"type": "main",
"index": 0
},
{
"node": "Append row in sheet1",
"type": "main",
"index": 0
}
],
[
{
"node": "Code5",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Analysis Content By AI",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Analysis Content By AI": {
"main": [
[
{
"node": "Code3",
"type": "main",
"index": 0
}
]
]
},
"When clicking \u2018Test workflow\u2019": {
"main": [
[
{
"node": "Code",
"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.
gmailOAuth2googleSheetsOAuth2ApiopenAiApiredditOAuth2ApisupabaseApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow monitors targeted subreddits for potential sales leads using Reddit’s API, AI content analysis, Supabase, and Google Sheets.
Source: https://n8n.io/workflows/6756/ — 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.
Automated Book Generation System. Uses googleSheetsTrigger, gmail, lmChatOpenAi, outputParserStructured. Event-driven trigger; 43 nodes.
Analyze Reddit Posts with AI to Identify Business Opportunities. Uses manualTrigger, lmChatOpenAi, sentimentAnalysis, gmail. Event-driven trigger; 22 nodes.
Use case Manually monitoring Reddit for viable business ideas is time-consuming and inconsistent. This workflow automatically analyzes trending Reddit discussions using AI to surface high-potential op
leads. Uses supabase, gmail, formTrigger, httpRequest. Webhook trigger; 62 nodes.
This workflow is designed for Scrum Masters and Agile Coaches who prepare and coordinate Sprint Planning sessions, using Google Calendar, Google Sheets, and OpenAI.