{ "name": "Reddit tuto", "nodes": [ { "parameters": {}, "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [ -1360, -80 ], "id": "16315a9a-8048-4b45-8fb1-47c4817b68c3", "name": "When clicking ‘Execute workflow’" }, { "parameters": { "operation": "getTimeBetweenDates", "startDate": "={{ $json.created_time }}", "endDate": "={{$now}}", "units": [ "hour" ], "outputFieldName": "post age", "options": {} }, "type": "n8n-nodes-base.dateTime", "typeVersion": 2, "position": [ -688, -80 ], "id": "53947f2c-433b-414c-abad-fa806b0f9db8", "name": "Date & Time" }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 3 }, "conditions": [ { "id": "49f3be92-8a27-4619-a55e-094743b8b149", "leftValue": "={{ $json['post age'].hours }}", "rightValue": 4, "operator": { "type": "number", "operation": "lt" } } ], "combinator": "and" }, "options": {} }, "type": "n8n-nodes-base.filter", "typeVersion": 2.3, "position": [ -464, -80 ], "id": "636f992a-84c6-4ff2-a44c-87ce24bc11b2", "name": "Remove posts older than 4 hours" }, { "parameters": { "jsonSchemaExample": "{\n \"suitable_for_reply\": \"yes\",\n \"explanation\": \"The post mentions an n8n workflow error and the author is requesting help, which makes it suitable for an expert reply.\"\n}\n" }, "type": "@n8n/n8n-nodes-langchain.outputParserStructured", "typeVersion": 1.3, "position": [ 288, 144 ], "id": "b0572819-24eb-4c62-8664-75c415cf7c01", "name": "Structured Output Parser" }, { "parameters": { "model": { "__rl": true, "mode": "list", "value": "gpt-4.1-mini" }, "responsesApiEnabled": false, "options": { "responseFormat": "json_object" } }, "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "typeVersion": 1.3, "position": [ -168, 144 ], "id": "f90efae4-42be-4ec4-b118-56312919bbbf", "name": "OpenAI Chat Model", "credentials": { "openAiApi": { "id": "k9LlgnkWoOMbNkRw", "name": "OpenAi account 5" } } }, { "parameters": { "model": { "__rl": true, "value": "gpt-5", "mode": "list", "cachedResultName": "gpt-5" }, "responsesApiEnabled": false, "options": { "responseFormat": "json_object" } }, "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "typeVersion": 1.3, "position": [ 120, 144 ], "id": "f2d8fe31-692e-4747-b338-55281fe973ae", "name": "OpenAI Chat Model1", "credentials": { "openAiApi": { "id": "k9LlgnkWoOMbNkRw", "name": "OpenAi account 5" } } }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 3 }, "conditions": [ { "id": "62f1c5e8-48fe-4312-be2f-c5e1777a2c0c", "leftValue": "={{ $json.evaluation.suitable_for_reply }}", "rightValue": "yes", "operator": { "type": "string", "operation": "equals" } } ], "combinator": "and" }, "options": {} }, "type": "n8n-nodes-base.filter", "typeVersion": 2.3, "position": [ 688, -80 ], "id": "a411c15c-6fb5-4895-896e-ff7423187139", "name": "Filter" }, { "parameters": { "promptType": "define", "text": "={{ $json.content }}", "options": { "systemMessage": "You are a Professional Reddit content creator.\nYour task is to reply Professionally and as humanly possible on Reddit comment. \n", "batching": { "batchSize": 1 } } }, "type": "@n8n/n8n-nodes-langchain.agent", "typeVersion": 3.1, "position": [ 912, -80 ], "id": "97c3cb00-e856-4fbf-912c-1433e6dc155c", "name": "AI Agent" }, { "parameters": { "model": { "__rl": true, "mode": "list", "value": "gpt-4.1-mini" }, "builtInTools": {}, "options": {} }, "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "typeVersion": 1.3, "position": [ 984, 144 ], "id": "9346a479-f268-4f73-8b84-f93d4b1d3e0c", "name": "OpenAI Chat Model2", "credentials": { "openAiApi": { "id": "k9LlgnkWoOMbNkRw", "name": "OpenAi account 5" } } }, { "parameters": { "resource": "postComment", "postId": "={{ $('Filter').item.json[\"post id\"] }}", "commentText": "={{ $json.output }}" }, "type": "n8n-nodes-base.reddit", "typeVersion": 1, "position": [ 1264, -80 ], "id": "6905d9ee-f501-4ebb-ba5b-b520fdcb521d", "name": "Create a comment in a post", "credentials": { "redditOAuth2Api": { "id": "SZxE9A8xjwuzrGFq", "name": "Reddit account" } } }, { "parameters": { "operation": "getAll", "subreddit": "n8n", "filters": { "category": "new" } }, "type": "n8n-nodes-base.reddit", "typeVersion": 1, "position": [ -1136, -80 ], "id": "251f5949-f946-41c4-98f7-b26bd03bd5b0", "name": "Get many posts", "credentials": { "redditOAuth2Api": { "id": "SZxE9A8xjwuzrGFq", "name": "Reddit account" } } }, { "parameters": { "promptType": "define", "text": "=# post title # \n{{ $('Post data').item.json.title }}\n\n# post content #\n{{ $('Post data').item.json.content }}", "messages": { "messageValues": [ { "message": "=You a Reddit post classification expert.\n\nGet only the topics that are related to n8n, AI Agent and AI Automation.\n\nYour task is to look a Reddit post from r/{{ $('Post data').item.json.subreddit }} and then classify the posts to output only those related to the following topic:\n\n-n8n workflow errors or issues\n(execution failures, node errors, credentials problems, webhook issues, broken workflows, debugging)\n\n!!Output Only the Posts related to n8n workflow errors or issues !!\n\n!! Don't Out the posts that are not related !!\n\n\nThe output should a json object with the following format :\n\n\n{\n\" is related\": \"yes\", \n \"explanation\": string // one sentence explenation for why yes/no\n\n}" } ] }, "batching": {} }, "type": "@n8n/n8n-nodes-langchain.chainLlm", "typeVersion": 1.8, "position": [ -240, -80 ], "id": "172deccc-5721-4e29-8018-7b48634dba9e", "name": "Post Classification" }, { "parameters": { "promptType": "define", "text": "=# post title # \n{{ $('Post data').item.json.title }}\n\n# post content #\n{{ $('Post data').item.json.content }}", "hasOutputParser": true, "messages": { "messageValues": [ { "message": "=You are a Marketing Research Assistant specialized in identifying high-intent Reddit posts for ethical self-promotion related to n8n automation services.\n\nYour goal is to analyze a Reddit post from r/{{ $('Post data').item.json.subreddit }} and decide whether it is relevant for outreach or self-promotion as an n8n expert.\n\nYour task is to look at a post and the respond with a Json object with the following format: \n\n{\n\" suitable for reply\": \"yes\" | \"no\", \n \"explanation\": string // one sentence explenation for why yes/no\n\n}" } ] }, "batching": {} }, "type": "@n8n/n8n-nodes-langchain.chainLlm", "typeVersion": 1.8, "position": [ 112, -80 ], "id": "e8739ac8-a874-413f-8962-4f18d6947907", "name": "Reddit Analysis" }, { "parameters": { "assignments": { "assignments": [ { "id": "8afbbb43-faf6-4129-8de5-72cebf80a1bb", "name": "post id", "value": "={{ $json.id }}", "type": "string" }, { "id": "b70d68d2-5923-4b19-a690-de6205330d6f", "name": "content", "value": "={{ $json.selftext.slice(0, 4000) ||$json.url }}", "type": "string" }, { "id": "3f1950a5-43c7-4423-883c-3cabfc855857", "name": "title", "value": "={{ $json.title }}", "type": "string" }, { "id": "06e2660d-13c1-4155-95d3-85218ed91d55", "name": "subreddit", "value": "={{ $json.subreddit }}", "type": "string" }, { "id": "cdaa164a-2df8-40e3-808e-f644a553ce15", "name": "created_time", "value": "={{ $json.created_utc }}", "type": "number" }, { "id": "7fb375dc-1be3-482d-a987-46fd23ed1486", "name": "permalink", "value": "=https://reddit.com{{ $json.permalink }}", "type": "string" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ -912, -80 ], "id": "c273683f-136a-4810-9ee6-5f487319a61a", "name": "Post data" }, { "parameters": { "assignments": { "assignments": [ { "id": "aa0d1dc5-487d-4cb1-a5cf-082f0c8a95af", "name": "evaluation.suitable_for_reply", "value": "={{ $json.output.suitable_for_reply }}", "type": "string" }, { "id": "f470918b-d896-4a31-9261-17ad6de66f81", "name": "evaluation.explanation", "value": "={{ $json.output.explanation }}", "type": "string" }, { "id": "098004a5-bf33-404c-b267-dd7a2b3f47bc", "name": "post id", "value": "={{ $('Post data').item.json['post id'] }}", "type": "string" }, { "id": "e736d790-e539-425d-aece-fbf341a7c7ab", "name": "content", "value": "={{ $('Post data').item.json.content }}", "type": "string" } ] }, "options": {} }, "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 464, -80 ], "id": "a5db1043-45bd-4b8f-992b-a3a4dcf935c8", "name": "Evaluation" } ], "pinData": {}, "connections": { "When clicking ‘Execute workflow’": { "main": [ [ { "node": "Get many posts", "type": "main", "index": 0 } ] ] }, "Date & Time": { "main": [ [ { "node": "Remove posts older than 4 hours", "type": "main", "index": 0 } ] ] }, "Remove posts older than 4 hours": { "main": [ [ { "node": "Post Classification", "type": "main", "index": 0 } ] ] }, "Structured Output Parser": { "ai_outputParser": [ [ { "node": "Reddit Analysis", "type": "ai_outputParser", "index": 0 } ] ] }, "OpenAI Chat Model": { "ai_languageModel": [ [ { "node": "Post Classification", "type": "ai_languageModel", "index": 0 } ] ] }, "OpenAI Chat Model1": { "ai_languageModel": [ [ { "node": "Reddit Analysis", "type": "ai_languageModel", "index": 0 } ] ] }, "Filter": { "main": [ [ { "node": "AI Agent", "type": "main", "index": 0 } ] ] }, "AI Agent": { "main": [ [ { "node": "Create a comment in a post", "type": "main", "index": 0 } ] ] }, "OpenAI Chat Model2": { "ai_languageModel": [ [ { "node": "AI Agent", "type": "ai_languageModel", "index": 0 } ] ] }, "Create a comment in a post": { "main": [ [] ] }, "Get many posts": { "main": [ [ { "node": "Post data", "type": "main", "index": 0 } ] ] }, "Post Classification": { "main": [ [ { "node": "Reddit Analysis", "type": "main", "index": 0 } ] ] }, "Reddit Analysis": { "main": [ [ { "node": "Evaluation", "type": "main", "index": 0 } ] ] }, "Post data": { "main": [ [ { "node": "Date & Time", "type": "main", "index": 0 } ] ] }, "Evaluation": { "main": [ [ { "node": "Filter", "type": "main", "index": 0 } ] ] } }, "active": false, "settings": { "executionOrder": "v1", "availableInMCP": false }, "versionId": "a23bf9d4-48e0-40b1-92fe-b33df264a3f7", "meta": { "templateCredsSetupCompleted": true, "instanceId": "23830929e6c018b604abb710d12ca57ce411c63a552f9a21234ab1d153211b0b" }, "id": "eKzkE7WE48SgtA0k", "tags": [] }