{
  "name": "Generic Reddit Pain Point Listener",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 */2 * * *"
            }
          ]
        }
      },
      "id": "1",
      "name": "Every 2 Hours",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.1,
      "position": [200, 400]
    },
    {
      "parameters": {
        "url": "https://www.reddit.com/r/startups/new/.rss",
        "options": {}
      },
      "id": "2",
      "name": "Reddit RSS Feed",
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1,
      "position": [400, 400]
    },
    {
      "parameters": {
        "jsCode": "const items = $input.all();\nconst uniqueItems = [];\nconst seenLinks = new Set();\n\nfor (const item of items) {\n  if (!seenLinks.has(item.json.link)) {\n    seenLinks.add(item.json.link);\n    uniqueItems.push(item);\n  }\n}\n\nreturn uniqueItems.slice(0, 10); // Limit to top 10 fresh items per run to save tokens"
      },
      "id": "3",
      "name": "Deduplicate & Limit",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [600, 400]
    },
    {
      "parameters": {
        "model": "gpt-4o-mini",
        "messages": {
          "messageValues": [
            {
              "role": "system",
              "message": "You are an elite B2B product-market fit matcher. Analyze this Reddit post's title and description.\n\nYour task is to determine if the poster is experiencing an ACTIVE, acute pain point that could be solved by a B2B agency or SaaS product (specifically around marketing, web design, automation, sales, operations, or scaling).\n\nProvide the following in your JSON output:\n1. \"intentScore\": A number from 0 to 100 representing how close the user is to looking for a solution/recommendation. (80+ = actively asking for help/software/consultant).\n2. \"painPointDescription\": A brief summary of their core frustration.\n3. \"suggestedOutreachDraft\": A highly personalized, non-salesy outreach message tailored to their specific problem. Start with empathy, offer a quick tip, and end with a soft call-to-action. (No robotic or overly promotional copy).\n\nOutput ONLY a valid JSON object. Do not include markdown formatting or code blocks."
            },
            {
              "role": "user",
              "message": "=Title: {{ $json.title }}\n\nContent: {{ $json.contentSnippet || $json.content || \"No content\" }}"
            }
          ]
        },
        "options": {
          "responseFormat": "json_object"
        }
      },
      "id": "4",
      "name": "AI Pain Point Analyzer",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [800, 400]
    },
    {
      "parameters": {
        "jsCode": "const aiResponse = JSON.parse($input.first().json.choices[0].message.content);\nreturn {\n  ...$node[\"Deduplicate & Limit\"].json,\n  intentScore: aiResponse.intentScore,\n  painPointDescription: aiResponse.painPointDescription,\n  suggestedOutreachDraft: aiResponse.suggestedOutreachDraft\n};"
      },
      "id": "5",
      "name": "Parse AI Output",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [1000, 400]
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json.intentScore }}",
              "operation": "larger",
              "value2": 80
            }
          ]
        }
      },
      "id": "6",
      "name": "Is High Intent?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [1200, 400]
    },
    {
      "parameters": {
        "channel": "reddit-deals",
        "text": "🚨 *New Reddit Sales Opportunity Detected!*\n\n*Subreddit:* r/startups\n*Post Title:* {{ $json.title }}\n*Link:* {{ $json.link }}\n*Intent Score:* {{ $json.intentScore }}/100\n\n*Frustration Summary:* \n{{ $json.painPointDescription }}\n\n*Suggested Outreach Draft:* \n```\n{{ $json.suggestedOutreachDraft }}\n```"
      },
      "id": "7",
      "name": "Slack Alert",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2,
      "position": [1450, 250]
    },
    {
      "parameters": {
        "chatId": "your_telegram_chat_id_here",
        "text": "🚨 *New Reddit Sales Opportunity!*\n\n*Post Title:* {{ $json.title }}\n*Link:* {{ $json.link }}\n*Intent Score:* {{ $json.intentScore }}/100\n\n*Pain Point:* \n{{ $json.painPointDescription }}\n\n*Outreach Draft:* \n```\n{{ $json.suggestedOutreachDraft }}\n```",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "id": "9",
      "name": "Telegram Alert",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.1,
      "position": [1450, 400]
    },
    {
      "parameters": {
        "resource": "spreadsheet",
        "operation": "append",
        "spreadsheetId": "your_sheet_id_here",
        "values": {
          "mappingMode": "defineEverything",
          "value": {
            "Date": "={{ new Date().toISOString() }}",
            "Title": "={{ $json.title }}",
            "Link": "={{ $json.link }}",
            "Pain Point": "={{ $json.painPointDescription }}",
            "Outreach": "={{ $json.suggestedOutreachDraft }}"
          }
        }
      },
      "id": "8",
      "name": "Log to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4,
      "position": [1450, 550]
    }
  ],
  "connections": {
    "Every 2 Hours": {
      "main": [
        [
          {
            "node": "Reddit RSS Feed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reddit RSS Feed": {
      "main": [
        [
          {
            "node": "Deduplicate & Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deduplicate & Limit": {
      "main": [
        [
          {
            "node": "AI Pain Point Analyzer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Pain Point Analyzer": {
      "main": [
        [
          {
            "node": "Parse AI Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Output": {
      "main": [
        [
          {
            "node": "Is High Intent?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is High Intent?": {
      "main": [
        [
          {
            "node": "Slack Alert",
            "type": "main",
            "index": 0
          },
          {
            "node": "Telegram Alert",
            "type": "main",
            "index": 0
          },
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
