AutomationFlowsAI & RAG › Turn Reddit Posts Into Content Ideas with Telegram, Apify, Gpt and Sheets

Turn Reddit Posts Into Content Ideas with Telegram, Apify, Gpt and Sheets

ByVishnu Prasad @vishnuprasad on n8n.io

> A Telegram-triggered n8n workflow that scrapes Reddit posts, analyzes them with AI, and saves structured content ideas to Google Sheets.

Event trigger★★★★☆ complexityAI-powered24 nodes@Apify/N8N Nodes ApifyChain LlmOpenAI ChatOutput Parser StructuredGoogle SheetsTelegram TriggerTelegram
AI & RAG Trigger: Event Nodes: 24 Complexity: ★★★★☆ AI nodes: yes Added:
Turn Reddit Posts Into Content Ideas with Telegram, Apify, Gpt and Sheets — n8n workflow card showing @Apify/N8N Nodes Apify, Chain Llm, OpenAI Chat integration

This workflow corresponds to n8n.io template #14430 — we link there as the canonical source.

This workflow follows the Apifyn8N Nodes Apify → Google Sheets 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 →

Download .json
{
  "id": "MYh634XHbauUJ3mO",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Reddit Content Saver Pipeline",
  "tags": [],
  "nodes": [
    {
      "id": "da574b99-0b38-4c21-a05d-00c4591ffd29",
      "name": "Run an Actor",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        -256,
        880
      ],
      "parameters": {
        "actorId": {
          "__rl": true,
          "mode": "list",
          "value": "oAuCIx3ItNrs2okjQ",
          "cachedResultUrl": "https://console.apify.com/actors/oAuCIx3ItNrs2okjQ/input",
          "cachedResultName": "Reddit Scraper Lite (trudax/reddit-scraper-lite)"
        },
        "customBody": "={\n  \"debugMode\": false,\n  \"ignoreStartUrls\": false,\n  \"includeNSFW\": true,\n  \"maxComments\": 10,\n  \"maxCommunitiesCount\": 2,\n  \"maxItems\": 10,\n  \"maxPostCount\": 10,\n  \"maxUserCount\": 2,\n  \"proxy\": {\n    \"useApifyProxy\": true,\n    \"apifyProxyGroups\": [\n      \"RESIDENTIAL\"\n    ]\n  },\n  \"scrollTimeout\": 40,\n  \"searchComments\": false,\n  \"searchCommunities\": false,\n  \"searchPosts\": true,\n  \"searchUsers\": false,\n  \"skipComments\": false,\n  \"skipCommunity\": false,\n  \"skipUserPosts\": false,\n  \"sort\": \"new\",\n  \"startUrls\": [\n    {\n      \"url\": \"{{ $('Telegram Trigger').item.json.message.link_preview_options.url }}\"\n    }\n  ]\n} ",
        "actorSource": "store"
      },
      "credentials": {
        "apifyApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a4ddb921-5780-4413-9ce9-71d557f22002",
      "name": "Get dataset items",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        -64,
        880
      ],
      "parameters": {
        "options": {},
        "resource": "Datasets",
        "datasetId": "={{ $json.defaultDatasetId }}"
      },
      "credentials": {
        "apifyApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "bb695cf2-41c9-42ad-ab10-2c802232fef1",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        128,
        880
      ],
      "parameters": {
        "jsCode": "const input = $input.all().map(i => i.json);\n\n// Helper\nfunction cleanText(text) {\n  if (!text) return '';\n  return String(text)\n    .replace(/\\s+/g, ' ')\n    .replace(/\\n+/g, ' ')\n    .trim();\n}\n\n// Try to identify post vs comments\nlet post = null;\nlet comments = [];\n\nfor (const item of input) {\n  const dataType = item.dataType || '';\n  \n  if (dataType === 'post') {\n    post = item;\n  } else if (dataType === 'comment') {\n    comments.push(item);\n  }\n}\n\n// If no explicit post found, try fallback guess\nif (!post) {\n  post = input.find(i => \n    i.title || i.postTitle || i.selftext || i.dataType === 'submission'\n  ) || null;\n}\n\n// Filter useful comments\nconst filteredComments = comments\n  .filter(c => {\n    const username = (c.username || '').toLowerCase();\n    const body = cleanText(c.body || '');\n    \n    if (!body) return false;\n    if (username === 'automoderator') return false;\n    if (body === '[deleted]' || body === '[removed]') return false;\n    if (body.length < 30) return false;\n    if (body.includes('I am a bot, and this action was performed automatically')) return false;\n    \n    return true;\n  })\n  .sort((a, b) => (b.upVotes || 0) - (a.upVotes || 0))\n  .slice(0, 10)\n  .map(c => ({\n    author: c.username || '',\n    body: cleanText(c.body || ''),\n    upvotes: c.upVotes || 0,\n    created_at: c.createdAt || '',\n    url: c.url || ''\n  }));\n\nconst result = {\n  source_url: post?.url || comments[0]?.url || '',\n  subreddit: post?.category || post?.communityName || comments[0]?.category || comments[0]?.communityName || '',\n  post_title: cleanText(post?.title || post?.postTitle || ''),\n  post_body: cleanText(post?.body || post?.selftext || post?.text || ''),\n  post_author: post?.username || post?.author || '',\n  post_created_at: post?.createdAt || '',\n  post_upvotes: post?.upVotes || post?.score || 0,\n  useful_comments: filteredComments,\n  comment_summary_text: filteredComments\n    .map((c, i) => `Comment ${i + 1} by ${c.author} (${c.upvotes} upvotes): ${c.body}`)\n    .join('\\n\\n')\n};\n\nreturn [{ json: result }];"
      },
      "typeVersion": 2
    },
    {
      "id": "efbba76f-3990-4b45-9925-54fcd1b08452",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        480,
        880
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e3054f33-822a-48be-91a7-6d2c3f246197",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ !!$json.post_title \n\n !!$json.post_body \n\n !!$json.comment_summary_text }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "llm-01",
      "name": "AI: Analyze Content",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        864,
        720
      ],
      "parameters": {
        "text": "=Analyze this Reddit post for content repurposing potential.\n\nSUBREDDIT: {{ $json.subreddit }}\nTITLE: {{ $json.post_title }}\nBODY: {{ $json.post_body }}\nAUTHOR: {{ $json.post_author }}\nDATE: {{ $json.post_created_at }}\nTOP COMMENTS: {{ $json.comment_summary_text }}\n\nReturn structured JSON with these fields:\n- title: Clean version of the post title\n- source_url: \"{{ $json.source_url }}\"\n- subreddit: \"{{ $json.subreddit }}\"\n- raw_topic: The core topic in 3-5 words\n- concise_summary: 2-3 sentence summary of the key insight\n- why_it_matters: Why this is valuable for content creation or business insight (1-2 sentences)\n- target_audience: Who would find this most valuable\n- content_opportunities: Array of content types this could become\n- hook_ideas: Array of 2-3 attention-grabbing hooks for content\n- blog_angle: One blog article angle (title + 1 sentence description)\n- carousel_angle: One carousel angle (title + slide count suggestion)\n- reel_angle: One short video angle (concept + duration suggestion)\n- linkedin_angle: One LinkedIn post angle (hook + format suggestion)\n- newsletter_angle: One newsletter angle (section title + 1 sentence)\n- confidence_score: 1-10 how useful this is as content material\n- save_priority: high, medium, or low\n- tags: Array of 3-6 topic tags",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "You are a content strategist and research assistant for Insight Advisory, a UAE-based corporate services firm. Your job is to analyze Reddit posts and extract structured content intelligence. Think like a smart content strategist: identify what is valuable, why it matters to a business audience, and how to repurpose it across multiple content formats. Respond ONLY with valid JSON matching the required schema. No markdown, no explanation, no wrapping."
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.9
    },
    {
      "id": "d8b682cd-2c12-43d9-96fb-f8981734adca",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        832,
        896
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5.4",
          "cachedResultName": "gpt-5.4"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "68685c20-a25f-489b-9277-93c4cdcf44f4",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1056,
        896
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"title\": \"How I Grew My SaaS to 10k MRR\",\n  \"source_url\": \"https://www.reddit.com/r/startup/comments/abc123/\",\n  \"subreddit\": \"r/startup\",\n  \"raw_topic\": \"SaaS bootstrapping growth\",\n  \"concise_summary\": \"A founder shares their journey from zero to 10k MRR.\",\n  \"why_it_matters\": \"Demonstrates a repeatable framework for early-stage growth.\",\n  \"target_audience\": \"Aspiring SaaS founders\",\n  \"content_opportunities\": [\"blog\", \"carousel\", \"linkedin_post\"],\n  \"hook_ideas\": [\"Most founders quit at month 3.\", \"The 10k MRR playbook\"],\n  \"blog_angle\": \"6 Lessons from a Bootstrapped Founder\",\n  \"carousel_angle\": \"6 Steps to 10k MRR - 8 slides\",\n  \"reel_angle\": \"The moment everything changed - 30s\",\n  \"linkedin_angle\": \"I quit my job 6 months ago.\",\n  \"newsletter_angle\": \"Founder Spotlight\",\n  \"confidence_score\": 8,\n  \"save_priority\": \"high\",\n  \"tags\": [\"SaaS\", \"growth\", \"bootstrapping\"],\n  \"duplicate_check_key\": \"reddit:startup:abc123\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "39e76556-ef86-4595-b928-b4c034cd1efc",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        1296,
        720
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "7bfeee07-ad46-4a4b-9d35-97302470d4d9",
              "name": "Timestamp",
              "type": "string",
              "value": "={{ $('Code in JavaScript').item.json.post_created_at || $now }}"
            },
            {
              "id": "c86034ec-e274-45d3-b403-4d22ff9207ca",
              "name": "source_url",
              "type": "string",
              "value": "={{ $json.output.source_url }}"
            },
            {
              "id": "87f22da5-6db5-41ee-8d58-bdac68174187",
              "name": "subreddit",
              "type": "string",
              "value": "={{ $json.output.subreddit }}"
            },
            {
              "id": "17d76927-8459-48a2-a212-fb7361a2e069",
              "name": "post_title",
              "type": "string",
              "value": "={{ $('Code in JavaScript').item.json.post_title }}"
            },
            {
              "id": "a6251154-4a0c-48c8-b476-0554f51b3bb7",
              "name": "summary",
              "type": "string",
              "value": "={{ $json.output.concise_summary }}"
            },
            {
              "id": "fafea228-10c5-4257-955d-00536ae34142",
              "name": "why_it_matters",
              "type": "string",
              "value": "={{ $json.output.why_it_matters }}"
            },
            {
              "id": "2a7f8a2c-49b7-4536-9eed-3bafa5f7bf47",
              "name": "output.tags",
              "type": "array",
              "value": "={{ $json.output.tags }}"
            },
            {
              "id": "378a39ee-5dd4-4908-9141-a2717449cb7e",
              "name": "user_note",
              "type": "string",
              "value": "={{ $('Code in JavaScript').item.json.post_body }}"
            },
            {
              "id": "ab9b0a9a-aacc-4b3d-8751-10ad6bcf07ea",
              "name": "hook_ideas",
              "type": "array",
              "value": "={{ $json.output.hook_ideas }}"
            },
            {
              "id": "b9346e7b-89e4-4cf7-9c2c-79847908566c",
              "name": "content_opportunities",
              "type": "array",
              "value": "={{ $json.output.content_opportunities }}"
            },
            {
              "id": "e5533a62-102f-41e8-8457-e26f9bb83b2e",
              "name": "blog_angle",
              "type": "string",
              "value": "={{ $json.output.blog_angle }}"
            },
            {
              "id": "4eb6a9cf-8349-40c0-9600-a94169b593d5",
              "name": "carousel_angle",
              "type": "string",
              "value": "={{ $json.output.carousel_angle }}"
            },
            {
              "id": "81690d16-71b8-4366-9876-6a54853f82a6",
              "name": "reel_angle",
              "type": "string",
              "value": "={{ $json.output.reel_angle }}"
            },
            {
              "id": "e9bd3e0b-1263-41c0-9018-46ca8dfe9a5d",
              "name": "linkedin_angle",
              "type": "string",
              "value": "={{ $json.output.linkedin_angle }}"
            },
            {
              "id": "98233400-9eaa-474a-8c71-c46a02978392",
              "name": "newsletter_angle",
              "type": "string",
              "value": "={{ $json.output.newsletter_angle }}"
            },
            {
              "id": "3c106747-d274-46c5-99f9-fadc51554dd0",
              "name": "confidence_score",
              "type": "number",
              "value": "={{ $json.output.confidence_score }}"
            },
            {
              "id": "42378eb6-f78b-4a03-b487-e96395581d93",
              "name": "save_priority",
              "type": "string",
              "value": "={{ $json.output.save_priority }}"
            },
            {
              "id": "e9e2453c-22d0-456d-8c23-14e8376fc041",
              "name": "duplicate_check_key",
              "type": "string",
              "value": "={{ $json.output.duplicate_check_key }}"
            },
            {
              "id": "dea7a826-a7ba-42ed-92bd-f86b7d9fcd80",
              "name": "post_author",
              "type": "string",
              "value": "={{ $('Code in JavaScript').item.json.post_author }}"
            },
            {
              "id": "c015f0d1-5d23-45b3-b001-dc90e14d107d",
              "name": "output.target_audience",
              "type": "string",
              "value": "={{ $json.output.target_audience }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "40ba1c61-988c-4304-aaaf-853a7b4e370a",
      "name": "Save: Append to Pipeline1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1520,
        720
      ],
      "parameters": {
        "columns": {
          "value": {
            "tags": "={{ $json.output.tags }}",
            "summary": "={{ $json.summary }}",
            "post_date": "={{ $json.Timestamp }}",
            "subreddit": "={{ $json.subreddit }}",
            "timestamp": "={{ $now.format('yyyy-MM-dd HH:MM') }}",
            "user_note": "={{ $json.user_note }}",
            "blog_angle": "={{ $json.blog_angle }}",
            "hook_ideas": "={{ $json.hook_ideas }}",
            "post_title": "={{ $json.post_title }}",
            "reel_angle": "={{ $json.reel_angle }}",
            "source_url": "={{ $json.source_url }}",
            "post_author": "={{ $json.post_author }}",
            "duplicate_key": "={{ $json.duplicate_check_key }}",
            "save_priority": "={{ $json.save_priority }}",
            "carousel_angle": "={{ $json.carousel_angle }}",
            "linkedin_angle": "={{ $json.linkedin_angle }}",
            "why_it_matters": "={{ $json.why_it_matters }}",
            "target_audience": "={{ $json.output.target_audience }}",
            "confidence_score": "={{ $json.confidence_score }}",
            "newsletter_angle": "={{ $json.newsletter_angle }}",
            "content_opportunities": "={{ $json.content_opportunities }}"
          },
          "schema": [
            {
              "id": "timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "source_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "source_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "subreddit",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "subreddit",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "post_title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "post_title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "why_it_matters",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "why_it_matters",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "tags",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "tags",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "user_note",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "user_note",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "hook_ideas",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "hook_ideas",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "content_opportunities",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "content_opportunities",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "blog_angle",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "blog_angle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "carousel_angle",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "carousel_angle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "reel_angle",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "reel_angle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "linkedin_angle",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "linkedin_angle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "newsletter_angle",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "newsletter_angle",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "confidence_score",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "confidence_score",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "save_priority",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "save_priority",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "duplicate_key",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "duplicate_key",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "post_author",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "post_author",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "post_date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "post_date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "target_audience",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "target_audience",
              "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/1y2rvWnN7Kk4YwXkVjBdp4PhioGjMcU2kdAYsbStr_sQ/edit#gid=0",
          "cachedResultName": "CONTENT PIPELINE"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1y2rvWnN7Kk4YwXkVjBdp4PhioGjMcU2kdAYsbStr_sQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1y2rvWnN7Kk4YwXkVjBdp4PhioGjMcU2kdAYsbStr_sQ/edit?usp=drivesdk",
          "cachedResultName": "Content Pipeline Reddit"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "3a6a2742-7a5e-4644-8072-b690646586e7",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1440,
        864
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "16f0b04a-8fc7-47b4-aa45-e9c1e8094cbd",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1216,
        864
      ],
      "parameters": {
        "text": "Your workflow has begun! Please wait!",
        "chatId": "={{ $json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cc471992-3d63-4f82-8fc6-209f42746616",
      "name": "Reply: Success Confirmation1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1744,
        720
      ],
      "parameters": {
        "text": "=\u2705 Content saved to pipeline\n\n\ud83d\udcdd **Title:** {{ $json.post_title }}\n\n\ud83d\udccc **Summary:**  \n{{ $json.summary }}\n\n\ud83d\udd25 **Priority:** {{ $json.save_priority }}\n\n\u270d\ufe0f **Blog Angle:**  \n{{ $json.blog_angle }}\n\n\ud83c\udfa0 **Carousel Angle:**  \n{{ $json.carousel_angle }}\n\n\ud83c\udfa5 **Reel Angle:**  \n{{ $json.reel_angle }}\n\n\ud83d\udcbc **LinkedIn Angle:**  \n{{ $json.linkedin_angle }}\n\n\ud83d\udce9 **Newsletter Angle:**  \n{{ $json.newsletter_angle }}\n\n\ud83c\udfaf **Target Audience:**  \n{{ $json.target_audience }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "93a7d4bb-bccd-4852-9018-fbe67ec58774",
      "name": "Get row(s) in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -864,
        864
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1y2rvWnN7Kk4YwXkVjBdp4PhioGjMcU2kdAYsbStr_sQ/edit#gid=0",
          "cachedResultName": "CONTENT PIPELINE"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1y2rvWnN7Kk4YwXkVjBdp4PhioGjMcU2kdAYsbStr_sQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1y2rvWnN7Kk4YwXkVjBdp4PhioGjMcU2kdAYsbStr_sQ/edit?usp=drivesdk",
          "cachedResultName": "Content Pipeline Reddit"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "5681bb3e-2c28-40fc-9dab-b7a57db7f32d",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        -496,
        864
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a4a3d999-3632-4a7d-98b2-abfd5db111ef",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.is_duplicate }}",
              "rightValue": "="
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "c6a7a037-b8b7-4226-b2db-06710aa88c2d",
      "name": "Send a text message1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -240,
        720
      ],
      "parameters": {
        "text": "=You share this link previously on   {{ $('Get row(s) in sheet').item.json.timestamp }}\n\nTitle {{ $('Get row(s) in sheet').item.json.post_title }}\n\nSummary {{ $('Get row(s) in sheet').item.json.summary }}\n\nPlease check gsheets\n\nhttps://docs.google.com/spreadsheets/d/1y2rvWnN7Kk4YwXkVjBdp4PhioGjMcU2kdAYsbStr_sQ",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "parse_mode": "HTML",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "10fd9c04-0096-4a70-a04a-e5c9eb9ab7ab",
      "name": "Code in JavaScript1",
      "type": "n8n-nodes-base.code",
      "position": [
        -688,
        864
      ],
      "parameters": {
        "jsCode": "// Get all rows from Google Sheets input\nconst sheetRows = $input.all();\n\n// Get the Telegram message text\nconst telegramText = $('Telegram Trigger').item.json.message.text || '';\n\n// Extract first Reddit URL from Telegram text\nconst redditUrlMatch = telegramText.match(/https?:\\/\\/(?:www\\.)?reddit\\.com\\/[^\\s]+/i);\n\nif (!redditUrlMatch) {\n  return [\n    {\n      json: {\n        is_duplicate: false,\n        error: 'No Reddit URL found in Telegram message',\n        incoming_url: '',\n        normalized_incoming_url: '',\n        matched_row: null\n      }\n    }\n  ];\n}\n\nconst incomingUrl = redditUrlMatch[0];\n\n// Normalize URL function\nfunction normalizeUrl(url) {\n  if (!url) return '';\n  \n  try {\n    const u = new URL(url.trim());\n\n    // force hostname lowercase and remove www\n    let hostname = u.hostname.toLowerCase().replace(/^www\\./, '');\n\n    // clean pathname\n    let pathname = u.pathname\n      .replace(/\\/+$/, '') // remove trailing slash\n      .toLowerCase();\n\n    return `${hostname}${pathname}`;\n  } catch (e) {\n    return url.trim().toLowerCase().replace(/^https?:\\/\\//, '').replace(/^www\\./, '').replace(/\\/+$/, '');\n  }\n}\n\nconst normalizedIncomingUrl = normalizeUrl(incomingUrl);\n\n// Look for match in Google Sheet rows\nlet matchedRow = null;\n\nfor (const row of sheetRows) {\n  const sheetUrl = row.json.source_url || '';\n  const normalizedSheetUrl = normalizeUrl(sheetUrl);\n\n  if (normalizedSheetUrl === normalizedIncomingUrl) {\n    matchedRow = row.json;\n    break;\n  }\n}\n\n// Return result\nreturn [\n  {\n    json: {\n      is_duplicate: !!matchedRow,\n      incoming_url: incomingUrl,\n      normalized_incoming_url: normalizedIncomingUrl,\n      matched_row: matchedRow\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "4cae6e8f-4ea9-4024-abeb-ed7cbac5abd4",
      "name": "Reply: Empty Post Content",
      "type": "n8n-nodes-base.telegram",
      "position": [
        864,
        1152
      ],
      "parameters": {
        "text": "No content found inside the link",
        "chatId": "={{ $json.chatId }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "sticky-overview",
      "name": "Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        384
      ],
      "parameters": {
        "color": 4,
        "width": 3536,
        "height": 974,
        "content": "## Reddit Content Saver Pipeline\nReceives a Reddit URL via Telegram \u2192 deduplicates against Google Sheets \u2192 scrapes post with Apify \u2192 validates content \u2192 analyzes with GPT \u2192 saves structured data to Sheets \u2192 confirms via Telegram."
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-trigger",
      "name": "Note: Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1472,
        592
      ],
      "parameters": {
        "color": 3,
        "width": 412,
        "height": 444,
        "content": "### Step 1 \u2014 Trigger & Acknowledge\n**Telegram Trigger** listens for messages in the bot chat.\n\n**Send a text message** immediately replies with an acknowledgment so the user knows the pipeline started.\n\n> Trigger data: `$json.message.link_preview_options.url`"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-dedup",
      "name": "Note: Dedup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        592
      ],
      "parameters": {
        "color": 5,
        "width": 620,
        "height": 444,
        "content": "### Step 2 \u2014 Duplicate Check\n**Get row(s) in sheet** reads all saved URLs from Google Sheets.\n\n**Code in JavaScript1** extracts the submitted URL and checks if it already exists in the sheet data.\n\n**If1** branches:\n- \u2705 True (already saved) \u2192 notify user via Telegram and stop\n- \u274c False (new post) \u2192 proceed to scraping"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-scrape",
      "name": "Note: Scraping",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        512
      ],
      "parameters": {
        "color": 6,
        "width": 640,
        "height": 524,
        "content": "### Step 3 \u2014 Reddit Scraping\n**Run an Actor** triggers Apify's `trudax/reddit-scraper-lite` with the submitted URL (max 10 posts, residential proxy, sort=new).\n\n**Get dataset items** polls and fetches the completed dataset.\n\n**Code in JavaScript** normalises the raw Apify output \u2014 extracts title, body, selftext, score, comment count, author, and post URL into a clean object."
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-validate",
      "name": "Note: Validate",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        544
      ],
      "parameters": {
        "color": 5,
        "width": 230,
        "height": 492,
        "content": "### Step 4 \u2014 Content Check\n**If** verifies the scraped post has non-empty body text.\n\n- \u2705 Has content \u2192 AI analysis\n- \u274c Empty \u2192 **Reply: Empty Post Content** notifies user and stops"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-ai",
      "name": "Note: AI Analysis",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        448
      ],
      "parameters": {
        "color": 2,
        "width": 480,
        "height": 588,
        "content": "### Step 5 \u2014 AI Content Intelligence\n**AI: Analyze Content** (LangChain LLM Chain) sends post title + body to GPT-4o.\n\n**Structured Output Parser** enforces a JSON schema response:\n- `topic` \u2014 primary subject\n- `summary` \u2014 2-3 sentence summary\n- `content_type` \u2014 e.g. discussion, tutorial, news\n- `sentiment` \u2014 positive / neutral / negative\n- `key_insights[]` \u2014 bullet takeaways\n- `relevance_score` \u2014 0\u201310"
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-output",
      "name": "Note: Save & Notify",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1216,
        448
      ],
      "parameters": {
        "color": 3,
        "width": 640,
        "height": 588,
        "content": "### Step 6 \u2014 Save & Confirm\n**Edit Fields** maps AI output + post metadata to the Google Sheets column schema (URL, title, topic, summary, sentiment, relevance_score, saved_at timestamp).\n\n**Save: Append to Pipeline1** appends a new row to the content pipeline tracker sheet.\n\n**Reply: Success Confirmation1** sends a Telegram message with the post title, topic, and relevance score.\n\n> \u26a0\ufe0f Sheet ID must be updated in Google Sheets nodes before use."
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "timezone": "Asia/Dubai",
    "binaryMode": "separate",
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "Vwifa003dTXHSH1G",
    "timeSavedMode": "fixed",
    "availableInMCP": false,
    "executionOrder": "v1",
    "saveDataErrorExecution": "all",
    "saveDataSuccessExecution": "all"
  },
  "versionId": "c45380e6-d6f1-4ac5-9f14-deab152393b9",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "AI: Analyze Content",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Reply: Empty Post Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Send a text message1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Run an Actor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Save: Append to Pipeline1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run an Actor": {
      "main": [
        [
          {
            "node": "Get dataset items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get dataset items": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI: Analyze Content",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI: Analyze Content": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript1": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Code in JavaScript1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a text message": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI: Analyze Content",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Save: Append to Pipeline1": {
      "main": [
        [
          {
            "node": "Reply: Success Confirmation1",
            "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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

&gt; A Telegram-triggered n8n workflow that scrapes Reddit posts, analyzes them with AI, and saves structured content ideas to Google Sheets.

Source: https://n8n.io/workflows/14430/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

++HOW IT WORKS:++ This workflow automates the processing of invoices sent via Telegram. It extracts the data using LlamaIndex OCR, logs it in Google Sheets, and optionally pushes the structured data t

Chain Llm, OpenAI Chat, Telegram Trigger +4
AI & RAG

-Personal or family budget tracking.

OpenAI Chat, Output Parser Structured, Chain Llm +4
AI & RAG

Generate AI viral videos with NanoBanana & VEO3, shared on socials via Blotato 2. Uses @blotato/n8n-nodes-blotato, googleSheets, lmChatOpenAi, toolThink. Event-driven trigger; 94 nodes.

@Blotato/N8N Nodes Blotato, Google Sheets, OpenAI Chat +9
AI & RAG

This template is designed for marketers, content creators, and e-commerce brands who want to automate the creation of professional ad videos at scale. It’s ideal for teams looking to generate consiste

Telegram, Telegram Trigger, Google Drive +8
AI & RAG

This automation is designed to help you generate AI-powered music tracks, cover art, and fully rendered music videos — all triggered from a simple Telegram chat and managed via Google Sheets.

OpenAI Chat, Memory Buffer Window, Output Parser Structured +11