{
  "name": "Weekly Reddit brand mentions → Google Sheets + Slack (rich_minds/reddit-brand-monitoring-ai)",
  "nodes": [
    {
      "parameters": {
        "rule": {"interval": [{"field": "weeks", "triggerAtDay": [1], "triggerAtHour": 8}]}
      },
      "name": "Every Monday 08:00",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [0, 0]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/acts/rich_minds~reddit-brand-monitoring-ai/run-sync-get-dataset-items?timeout=290",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"sourceMode\": \"actor\",\n  \"brandTerms\": [\"acme crm\"],\n  \"competitorTerms\": [\"hubspot\"],\n  \"brandBrief\": \"Acme CRM — the sales CRM for small agencies. Replace with your product in one sentence.\",\n  \"maxItemsPerSearch\": 75,\n  \"maxDiscoveryChargeUsd\": 0.5,\n  \"dedupeAcrossRuns\": true\n}",
        "options": {"timeout": 300000}
      },
      "name": "Run Reddit Brand Monitoring (new mentions only)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [240, 0],
      "notes": "Credential: Header Auth, name 'Authorization', value 'Bearer <your Apify API token>'. dedupeAcrossRuns keeps each run to NEW mentions; the run-over-run trend is in the run's OUTPUT record."
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {"__rl": true, "mode": "url", "value": "<your Google Sheet URL — import sheets-template.csv first>"},
        "sheetName": {"__rl": true, "mode": "name", "value": "Shortlist"},
        "columns": {
          "mappingMode": "autoMapInputData",
          "matchingColumns": ["dedupeKey"]
        },
        "options": {}
      },
      "name": "Upsert into the Shortlist sheet (key: dedupeKey)",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [480, -100]
    },
    {
      "parameters": {
        "conditions": {
          "conditions": [
            {"leftValue": "={{ $json.priority }}", "rightValue": "high", "operator": {"type": "string", "operation": "equals"}}
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "name": "High priority only",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [480, 100]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {"__rl": true, "mode": "name", "value": "#reddit-mentions"},
        "text": "=*{{ $json.priority }}* · {{ $json.mentionType }} · r/{{ $json.subreddit }} — <{{ $json.url }}|{{ $json.name }}>\n> {{ $json.evidenceQuote || '' }}\nNext: {{ $json.suggestedAction }} — {{ $json.actionReason }}",
        "otherOptions": {}
      },
      "name": "Post to Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [720, 100]
    }
  ],
  "connections": {
    "Every Monday 08:00": {"main": [[{"node": "Run Reddit Brand Monitoring (new mentions only)", "type": "main", "index": 0}]]},
    "Run Reddit Brand Monitoring (new mentions only)": {"main": [[
      {"node": "Upsert into the Shortlist sheet (key: dedupeKey)", "type": "main", "index": 0},
      {"node": "High priority only", "type": "main", "index": 0}
    ]]},
    "High priority only": {"main": [[{"node": "Post to Slack", "type": "main", "index": 0}], []]}
  },
  "settings": {"executionOrder": "v1"}
}