{
  "name": "05 Reddit keyword monitor (find leads & mentions)",
  "nodes": [
    {
      "parameters": {
        "content": "## Reddit keyword monitor\nEvery 3 hours finds new Reddit posts with your keywords (people asking for what you sell, brand mentions) and sends them to you.\n\n1. Open **Config** and paste your Apify API token (free account: console.apify.com -> Settings -> API & Integrations).\n2. Paste a Discord/Slack webhook URL and/or a Telegram bot token + chat ID (delete the node you don't use).\n3. Click **Test workflow**, then switch it to **Active**.",
        "height": 340,
        "width": 420
      },
      "name": "How to use",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -400
      ],
      "id": "77f20abb-3546-4963-92fa-85ed0cdc6dfa"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 3
            }
          ]
        }
      },
      "name": "Schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ],
      "id": "e2ac8001-03e5-4d83-8292-c3d30ade5658"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "c6fbdec4-5aae-45e8-b734-5926210c8409",
              "name": "apifyToken",
              "value": "YOUR_APIFY_TOKEN",
              "type": "string"
            },
            {
              "id": "311213ed-f22b-4575-9653-23530c0b77e4",
              "name": "webhookUrl",
              "value": "https://discord.com/api/webhooks/...",
              "type": "string"
            },
            {
              "id": "8ed9a8a5-0b82-40fe-8215-89a5dd3167b3",
              "name": "telegramBotToken",
              "value": "",
              "type": "string"
            },
            {
              "id": "d3c84743-8360-47da-ae9d-2b2b2277f5bc",
              "name": "telegramChatId",
              "value": "",
              "type": "string"
            },
            {
              "id": "aedafad1-e1a5-4ab4-a7ee-5f6d8cc62b54",
              "name": "keywords",
              "value": "need a scraper, looking for automation",
              "type": "string"
            },
            {
              "id": "302c0171-53cc-488e-a9dc-ae6b16826b1c",
              "name": "subreddit",
              "value": "forhire",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "name": "Config",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        0
      ],
      "id": "f28e81eb-8e16-4d35-98e5-2d0078e21048"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.apify.com/v2/acts/martin10291~reddit-posts-comments-extractor/run-sync-get-dataset-items",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "token",
              "value": "={{ $('Config').item.json.apifyToken }}"
            },
            {
              "name": "timeout",
              "value": "280"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({searchQueries: $('Config').item.json.keywords.split(',').map(s => s.trim()), searchInSubreddit: $('Config').item.json.subreddit, sort: 'new', postedWithinDays: 1, includeComments: false, maxItems: 30}) }}",
        "options": {
          "timeout": 300000
        }
      },
      "name": "Run Apify scraper",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        440,
        0
      ],
      "id": "2ef06283-a533-4c9f-958e-f948c303eca5"
    },
    {
      "parameters": {
        "jsCode": "const rows = $input.all();\nif (!rows.length) return [];\nconst d = rows.map(i => i.json).filter(p => p.title || p.postTitle);\nif (!d.length) return [];\nconst text = 'Reddit mentions:\\n' + d.slice(0, 15).map(p => `• ${p.title || p.postTitle} (r/${p.subreddit})\\n${p.url || p.permalink || p.link}`).join('\\n');\nreturn [{ json: { text } }];"
      },
      "name": "Format message",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        660,
        0
      ],
      "id": "dfc01036-c440-4431-b696-b7be028430f7"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Config').item.json.webhookUrl }}",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({content: $json.text, text: $json.text}) }}",
        "options": {}
      },
      "name": "Send to Discord or Slack",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        880,
        0
      ],
      "id": "e51838fc-e010-45e8-a528-845a5581defc"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.telegram.org/bot{{ $('Config').item.json.telegramBotToken }}/sendMessage",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({chat_id: $('Config').item.json.telegramChatId, text: $json.text, disable_web_page_preview: true}) }}",
        "options": {}
      },
      "name": "Send to Telegram",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        880,
        200
      ],
      "id": "20969de3-dbed-486c-afe2-c520de2f2f0b"
    }
  ],
  "connections": {
    "Schedule": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Config": {
      "main": [
        [
          {
            "node": "Run Apify scraper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Apify scraper": {
      "main": [
        [
          {
            "node": "Format message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format message": {
      "main": [
        [
          {
            "node": "Send to Discord or Slack",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "active": false
}