{
  "name": "Find leads on Reddit every morning without a Reddit API app using SocialTap and OpenAI",
  "nodes": [
    {
      "parameters": {
        "content": "## Find people on Reddit who are asking for what you sell\n\nEvery morning it searches Reddit for your keywords, keeps the posts it hasn't seen, has OpenAI score how likely each poster is to buy, and emails you the best ones with a reply angle. No Reddit API app is needed, so it works for accounts Reddit no longer approves.\n\n### How it works\n1. The schedule runs once a day.\n2. SocialTap searches Reddit for each keyword: the newest posts of the last day, with their subreddit and text.\n3. Posts seen on an earlier run are dropped.\n4. OpenAI scores each post's buying intent from 0 to 10 and suggests how to reply helpfully.\n5. Posts at or above your minimum score are saved to the **Reddit leads** data table and emailed to you.\n\nReddit's search matches single words unless a phrase is in quotes, so the example keywords are quoted.\n\n### Setup\n- Install the community node **n8n-nodes-socialtap** (Settings → Community nodes → Install). Tested with n8n 2.49.8 and n8n-nodes-socialtap 1.621.43. Until n8n verifies it, it runs on self-hosted n8n. [Install guide](https://socialtap.dev/docs/integrations/#n8n)\n- Add a **SocialTap API** credential: [create a free account](https://socialtap.dev/signup/?ref=n8n-reddit-leads) and paste its API key. Each operation shows its price, and failed requests are free.\n- Add an **OpenAI** credential to the model node and a **Gmail** credential to the email node.\n- Fill in **Your settings**: keywords, what you sell, your email.\n\n### Customization\n- Add a subreddit to the search's options to watch one community.\n- Send to Slack instead of Gmail.\n\n![The workflow](https://socialtap.dev/n8n/reddit-leads.svg)",
        "height": 880,
        "width": 600
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -640,
        0
      ],
      "id": "aefea8fb-02fb-4f90-a117-a379a4f36f0a",
      "name": "Overview"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "days",
              "triggerAtHour": 8
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        340
      ],
      "id": "50f4c2e1-f877-4557-8096-0c6d03a1e070",
      "name": "Every morning"
    },
    {
      "parameters": {
        "content": "## Your settings\nKeywords separated by commas (quotes match a phrase exactly), what you sell, the lowest score to email and where to send it.",
        "height": 400,
        "width": 260,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        200,
        120
      ],
      "id": "47e3823e-5dd6-4121-94fa-5a22f1ba5b75",
      "name": "Settings note"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a545bdc4-2f06-4e45-b68c-d3758c6e82f7",
              "name": "keywords",
              "value": "\"hootsuite alternative\", \"buffer alternative\", \"social media scheduler\", \"schedule instagram posts\"",
              "type": "string"
            },
            {
              "id": "7f12343d-d337-41e6-b013-671c41dc60b6",
              "name": "product",
              "value": "A social media scheduler for small teams: one inbox, a shared calendar and approvals.",
              "type": "string"
            },
            {
              "id": "55950dd7-dff2-4a55-b33e-be880293051c",
              "name": "minScore",
              "value": "7",
              "type": "number"
            },
            {
              "id": "fbe684a5-c433-440f-8d2c-5236b93f6bfa",
              "name": "email",
              "value": "you@example.com",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        260,
        340
      ],
      "id": "89e61fc2-da73-4f5f-a65b-07b73ffa0bf9",
      "name": "Your settings"
    },
    {
      "parameters": {
        "resource": "table",
        "operation": "create",
        "tableName": "Reddit leads",
        "columns": {
          "column": [
            {
              "name": "found_at",
              "type": "string"
            },
            {
              "name": "keyword",
              "type": "string"
            },
            {
              "name": "subreddit",
              "type": "string"
            },
            {
              "name": "title",
              "type": "string"
            },
            {
              "name": "url",
              "type": "string"
            },
            {
              "name": "author",
              "type": "string"
            },
            {
              "name": "score",
              "type": "number"
            },
            {
              "name": "why",
              "type": "string"
            },
            {
              "name": "reply_angle",
              "type": "string"
            }
          ]
        },
        "options": {
          "createIfNotExists": true
        }
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        500,
        340
      ],
      "id": "0edb826a-a542-4d6f-921b-7e082d4c22d9",
      "name": "Create table",
      "executeOnce": true
    },
    {
      "parameters": {
        "jsCode": "// Each keyword, its quotes kept: Reddit matches a quoted phrase exactly.\nreturn $('Your settings').first().json.keywords.split(',').map((k) => k.trim()).filter(Boolean)\n  .map((keyword) => ({ json: { keyword } }));"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        720,
        340
      ],
      "id": "8d76a878-4d2e-4120-86d5-c6fc6eebd586",
      "name": "One item per keyword"
    },
    {
      "parameters": {
        "content": "## 1. Search Reddit\nEach keyword's newest posts of the last day. Posts seen on earlier runs are dropped.",
        "height": 400,
        "width": 500,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        920,
        120
      ],
      "id": "6626fb2b-a41d-4196-afca-d00d7a090491",
      "name": "Search"
    },
    {
      "parameters": {
        "resource": "reddit",
        "operation": "reddit.search_posts",
        "query": "={{ $json.keyword }}",
        "limit": 25,
        "additionalFields": {
          "sort": "newest",
          "since": "={{ $now.minus({ days: 1 }).toISO() }}"
        }
      },
      "type": "n8n-nodes-socialtap.socialTap",
      "typeVersion": 1,
      "position": [
        980,
        340
      ],
      "id": "1d5659ff-c636-4454-a0fe-3d61bd646dd2",
      "name": "Search Reddit",
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "operation": "removeItemsSeenInPreviousExecutions",
        "dedupeValue": "={{ $json.id }}",
        "options": {}
      },
      "type": "n8n-nodes-base.removeDuplicates",
      "typeVersion": 2,
      "position": [
        1200,
        340
      ],
      "id": "732f11e7-b26e-43d8-b736-bb33b88d2422",
      "name": "New posts only"
    },
    {
      "parameters": {
        "jsCode": "// The fields the model and the email need, one post each (the same post found by two keywords counts once).\nconst seen = new Set();\nconst out = [];\n$input.all().forEach(({ json: p }, i) => {\n  if (!p.id || !p.url || seen.has(p.id)) return;\n  seen.add(p.id);\n  out.push({ json: {\n    keyword: $('One item per keyword').itemMatching(i)?.json.keyword ?? '',\n    subreddit: p.platform_specific?.reddit?.subreddit?.name ?? '',\n    title: p.title ?? '',\n    text: (p.text ?? '').slice(0, 3000),\n    url: p.url,\n    author: p.author?.username ?? '',\n    comments: p.metrics?.comment_count ?? null,\n  } });\n});\nreturn out;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1420,
        340
      ],
      "id": "b96022ee-5ae8-4f4d-963d-ef13058bf3f5",
      "name": "Trim posts"
    },
    {
      "parameters": {
        "content": "## 2. Score the intent\nOpenAI rates each post 0 to 10 for buying intent and suggests a reply that helps first.",
        "height": 580,
        "width": 440,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1620,
        120
      ],
      "id": "cb1cd18e-2b48-451b-bb9c-386db39c5cbb",
      "name": "Score"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=What we sell: {{ $('Your settings').first().json.product }}\n\nSubreddit: r/{{ $json.subreddit }}\nTitle: {{ $json.title }}\nPost: {{ $json.text || '(no text)' }}",
        "hasOutputParser": true,
        "messages": {
          "messageValues": [
            {
              "message": "You qualify sales leads from Reddit posts. Score from 0 to 10 how likely the poster is to want what we sell soon:\n10: asks for a tool like ours or an alternative to a competitor\n7: describes the exact problem we solve and is looking for help\n4: discusses the topic without a need\n0: unrelated, a promotion, or a job post\nwhy: one sentence citing the post.\nreply_angle: one or two sentences on how to reply helpfully without a hard sell, following the subreddit's tone. Empty when the score is below 5."
            }
          ]
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.7,
      "position": [
        1700,
        340
      ],
      "id": "22e93dc2-2348-460e-8dcf-048f00695d11",
      "name": "Score the post"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {
          "temperature": 0.4
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        1680,
        560
      ],
      "id": "7aab1f64-34c6-4c0c-9f04-1b967c67bf2f",
      "name": "OpenAI"
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n  \"score\": 8,\n  \"why\": \"They ask for a cheaper alternative to Hootsuite for a team of three.\",\n  \"reply_angle\": \"Share what to look for in a scheduler for small teams, then mention ours as one option.\"\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        1880,
        560
      ],
      "id": "9c296283-0e91-4ad9-8cdc-9a54f5a1a931",
      "name": "Score format"
    },
    {
      "parameters": {
        "jsCode": "// Posts at or above the minimum score, with the model's answer, best first.\nconst posts = $('Trim posts').all();\nconst min = $('Your settings').first().json.minScore;\nconst found_at = $now.toISO();\nreturn $input.all()\n  .map((item, i) => ({ ...posts[i].json, ...(item.json.output ?? {}) }))\n  .filter((r) => Number(r.score) >= min)\n  .sort((a, b) => b.score - a.score)\n  .map(({ text, comments, ...r }) => ({ json: { found_at, ...r, score: Number(r.score) } }));"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2120,
        340
      ],
      "id": "9b04a392-9045-4f0d-bd48-26707d7effd8",
      "name": "Keep the best"
    },
    {
      "parameters": {
        "content": "## 3. Save and send\nThe leads go to the Reddit leads data table and to your inbox. No leads, no email.",
        "height": 400,
        "width": 680,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2320,
        120
      ],
      "id": "6549f7d3-1926-4e94-becf-b9e8043ab293",
      "name": "Send"
    },
    {
      "parameters": {
        "resource": "row",
        "operation": "insert",
        "dataTableId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Create table').first().json.id }}"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1.1,
      "position": [
        2380,
        340
      ],
      "id": "7b12cecc-8354-407f-94d4-8c29d974a968",
      "name": "Save to data table"
    },
    {
      "parameters": {
        "jsCode": "const esc = (s) => String(s ?? '').replace(/[&<>\"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '\"': '&quot;' })[c]);\nconst leads = $('Keep the best').all().map((i) => i.json);\nconst rows = leads.map((l) => '<tr><td style=\"padding:8px;vertical-align:top\"><b>' + l.score + '</b></td><td style=\"padding:8px\">'\n  + '<a href=\"' + esc(l.url) + '\">' + esc(l.title || '(untitled)') + '</a><br><small>r/' + esc(l.subreddit) + ' · u/' + esc(l.author) + ' · ' + esc(l.keyword) + '</small>'\n  + '<p>' + esc(l.why) + '</p>' + (l.reply_angle ? '<p><i>Reply angle:</i> ' + esc(l.reply_angle) + '</p>' : '') + '</td></tr>').join('');\nreturn [{ json: {\n  subject: leads.length + ' Reddit lead' + (leads.length === 1 ? '' : 's') + ' for ' + $now.toFormat('LLL d'),\n  html: '<table style=\"border-collapse:collapse;font-family:sans-serif\">' + rows + '</table>',\n} }];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2600,
        340
      ],
      "id": "77f268bb-33ed-4932-971d-0629c26331a3",
      "name": "Write the email",
      "executeOnce": true
    },
    {
      "parameters": {
        "sendTo": "={{ $('Your settings').first().json.email }}",
        "subject": "={{ $json.subject }}",
        "emailType": "html",
        "message": "={{ $json.html }}",
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        2820,
        340
      ],
      "id": "7f547a52-e4ff-44ca-b897-d85f5ec05cde",
      "name": "Email me",
      "webhookId": "ea002a2b-d0bf-4759-86f0-4ff854dbd087"
    }
  ],
  "pinData": {},
  "connections": {
    "OpenAI": {
      "ai_languageModel": [
        [
          {
            "node": "Score the post",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Score format": {
      "ai_outputParser": [
        [
          {
            "node": "Score the post",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Every morning": {
      "main": [
        [
          {
            "node": "Your settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Your settings": {
      "main": [
        [
          {
            "node": "Create table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create table": {
      "main": [
        [
          {
            "node": "One item per keyword",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "One item per keyword": {
      "main": [
        [
          {
            "node": "Search Reddit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Reddit": {
      "main": [
        [
          {
            "node": "New posts only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New posts only": {
      "main": [
        [
          {
            "node": "Trim posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trim posts": {
      "main": [
        [
          {
            "node": "Score the post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Score the post": {
      "main": [
        [
          {
            "node": "Keep the best",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Keep the best": {
      "main": [
        [
          {
            "node": "Save to data table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save to data table": {
      "main": [
        [
          {
            "node": "Write the email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write the email": {
      "main": [
        [
          {
            "node": "Email me",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}