{
  "nodes": [
    {
      "id": "b0a2f427-1788-4707-b2ca-07b7ba9878ab",
      "name": "When clicking \u2018Test workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -2040,
        1040
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "9bf6edaf-e2ad-4702-8730-0600775531cb",
      "name": "Post Summarization",
      "type": "@n8n/n8n-nodes-langchain.chainSummarization",
      "position": [
        20,
        680
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "9541106a-af9c-4326-91b1-07f68c9ee386",
      "name": "Merge Input",
      "type": "n8n-nodes-base.merge",
      "position": [
        -720,
        980
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3
    },
    {
      "id": "b0ad0465-0daa-48f6-a9c5-8dadca2ca4e1",
      "name": "Output The Results",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1140,
        820
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 979106892,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1cIMIh_DjoWXMDaJEH-AyTZbnAha6TxthCSSEam4NLsE/edit#gid=979106892",
          "cachedResultName": "Find-Leads"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "1cIMIh_DjoWXMDaJEH-AyTZbnAha6TxthCSSEam4NLsE"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "16c397ea-1625-43c6-8602-9150a79858a4",
      "name": "Merge 3 Inputs",
      "type": "n8n-nodes-base.merge",
      "position": [
        800,
        820
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineByPosition"
      },
      "typeVersion": 3
    },
    {
      "id": "f59b3a35-9502-4a69-8b18-6760538765ab",
      "name": "Filter Posts By Features",
      "type": "n8n-nodes-base.if",
      "position": [
        -1620,
        1040
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "0823d10a-ad54-4d82-bcea-9dd236e97857",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.ups }}",
              "rightValue": 2
            },
            {
              "id": "bb8187aa-f0f1-4999-8d4b-bdc9abba0618",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.selftext }}",
              "rightValue": ""
            },
            {
              "id": "539f0f5c-025a-4f82-9b3a-2ef1ad3a2d96",
              "operator": {
                "type": "dateTime",
                "operation": "after"
              },
              "leftValue": "={{ DateTime.fromSeconds($json.created).toISO() }}",
              "rightValue": "={{ $today.minus(180,'days').toISO() }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d88efb10-91cf-4ac0-9f7b-796bfa8a75ab",
      "name": "Filter Posts By Content",
      "type": "n8n-nodes-base.if",
      "position": [
        -460,
        980
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d5d38c01-3a88-4767-b488-d9c04145bb8f",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": "yes"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "405f37a4-d3a8-4d92-8add-ad232be014b7",
      "name": "Select Key Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -1380,
        1020
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e5082ecc-3add-474e-bdb5-b8ad64729930",
              "name": "upvotes",
              "type": "string",
              "value": "={{ $json.ups }}"
            },
            {
              "id": "a92b5859-fbcc-40c2-95e0-452b12530d98",
              "name": "subreddit_subscribers",
              "type": "number",
              "value": "={{ $json.subreddit_subscribers }}"
            },
            {
              "id": "a846e21c-6cff-4521-9e0c-a32fa1305376",
              "name": "postcontent",
              "type": "string",
              "value": "={{ $json.selftext }}"
            },
            {
              "id": "b8045389-684d-4872-9e32-9a6b5511eb2b",
              "name": "url",
              "type": "string",
              "value": "={{ $json.url }}"
            },
            {
              "id": "f182fedc-1b09-40fe-aeb5-2473263da442",
              "name": "date",
              "type": "string",
              "value": "={{ DateTime.fromSeconds($json.created).toISO() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "6a6143e1-6181-45a0-988f-e8ed7e634bd8",
      "name": "Get Posts",
      "type": "n8n-nodes-base.reddit",
      "position": [
        -1820,
        1040
      ],
      "parameters": {
        "keyword": "how do I find leads",
        "operation": "search",
        "subreddit": "=Entrepreneur",
        "additionalFields": {
          "sort": "hot"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1937b724-18a1-4b5b-8338-1752f478eccf",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2140,
        800
      ],
      "parameters": {
        "width": 880,
        "height": 440,
        "content": "# Data Extraction\n## Retrieves recent posts from specific Reddit community (subreddit)\n## Filters content by keywords and upvotes"
      },
      "typeVersion": 1
    },
    {
      "id": "5d4a1df6-16a5-473e-b6b4-42e7966a5cd2",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1140,
        580
      ],
      "parameters": {
        "color": 4,
        "width": 820,
        "height": 660,
        "content": "# Transformation Step\n## Analyze using LLM (AI)\n## Filter for business opportunities"
      },
      "typeVersion": 1
    },
    {
      "id": "399afd5a-ced1-447b-95de-a7191632d266",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        480
      ],
      "parameters": {
        "color": 6,
        "width": 1460,
        "height": 760,
        "content": "#Transformation 2nd Step + Load to Gsheet\n## Insight Generation \n## Generates executive summaries of key opportunities\n## Submit findings in Google Sheets"
      },
      "typeVersion": 1
    },
    {
      "id": "571bf6e7-ef36-4a7d-9e9d-e97aef4e7015",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -1100,
        940
      ],
      "parameters": {
        "model": "openai/gpt-4.1-mini",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "7e157fc9-a7cd-42d4-80d5-233308a2441a",
      "name": "OpenRouter Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        40,
        860
      ],
      "parameters": {
        "model": "openai/gpt-4.1-mini",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "9f2020d1-77f2-4dbc-b6ce-7dae7acd1263",
      "name": "Basic LLM Chain",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -1100,
        760
      ],
      "parameters": {
        "text": "=Decide whether this reddit post is describing a business-related problem or a need for a solution.",
        "messages": {
          "messageValues": [
            {
              "message": "The post should mention a specific challenge or requirement that a business is trying to address. Is this post about a business problem or need for a solution ? Output only yes or no"
            },
            {
              "type": "HumanMessagePromptTemplate",
              "message": "=Reddit post:  {{ $json.postcontent }}"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.6
    },
    {
      "id": "b048b2f6-3c46-4ad2-8255-5b0509e9da0f",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        460,
        680
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "7038812d-f325-4196-89b6-3623d81dec7b",
              "name": "summary",
              "type": "string",
              "value": "={{ $json.response.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "924219fa-ae4d-44b3-a42d-e2c67dc85545",
      "name": "Edit Fields1",
      "type": "n8n-nodes-base.set",
      "position": [
        280,
        960
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1f34c3f3-7be7-474c-9026-7058807a7b3d",
              "name": "date",
              "type": "string",
              "value": "={{ $json.date }}"
            },
            {
              "id": "0e0e5227-e37b-43fc-8a88-2bb76631108d",
              "name": "subreddit_subscribers",
              "type": "number",
              "value": "={{ $json.subreddit_subscribers }}"
            },
            {
              "id": "68e2ca82-6b1d-42ec-acc7-b784e9ed61b5",
              "name": "url",
              "type": "string",
              "value": "={{ $json.url }}"
            },
            {
              "id": "946800a2-ec8b-4f99-a4db-9248bf305747",
              "name": "upvotes",
              "type": "string",
              "value": "={{ $json.upvotes }}"
            },
            {
              "id": "da86d4d3-db84-44e3-a684-38aff2fd5b77",
              "name": "postcontent",
              "type": "string",
              "value": "={{ $json.postcontent }}"
            },
            {
              "id": "b67148e1-67a5-4b10-be6c-c819ff910be0",
              "name": "business_opportunity",
              "type": "string",
              "value": "={{ $json.output }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "connections": {
    "Get Posts": {
      "main": [
        [
          {
            "node": "Filter Posts By Features",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Merge 3 Inputs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Input": {
      "main": [
        [
          {
            "node": "Filter Posts By Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Merge 3 Inputs",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge 3 Inputs": {
      "main": [
        [
          {
            "node": "Output The Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Merge Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select Key Fields": {
      "main": [
        [
          {
            "node": "Merge Input",
            "type": "main",
            "index": 1
          },
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post Summarization": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Post Summarization",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Filter Posts By Content": {
      "main": [
        [
          {
            "node": "Post Summarization",
            "type": "main",
            "index": 0
          },
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Posts By Features": {
      "main": [
        [
          {
            "node": "Select Key Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Test workflow\u2019": {
      "main": [
        [
          {
            "node": "Get Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}