{
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "name": "Scrape Facebook Real Estate Groups, Filter Deals with AI, and Send SMS Alerts via Twilio",
  "nodes": [
    {
      "id": "37ab86df-4b47-42fb-8d28-13a24d7575a4",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "notes": "At minute 0 past every 4th hour from 9 through 21",
      "position": [
        -640,
        512
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 9-21/4 * * *"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "ee521345-8510-45e8-8e52-3042bd6ad87b",
      "name": "Group 1 - FSBO Florida Homes",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        0
      ],
      "parameters": {
        "url": "https://facebook-scraper3.p.rapidapi.com/group/posts",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "group_id",
              "value": "331454348246054"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "facebook-scraper3.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "YOUR_RAPIDAPI_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d6e87cb6-dc2c-4f19-bb1c-a32c523a0c04",
      "name": "Group 2 - FL Sale or Wholesale",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        208
      ],
      "parameters": {
        "url": "https://facebook-scraper3.p.rapidapi.com/group/posts",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "group_id",
              "value": "364715990323484"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "facebook-scraper3.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "YOUR_RAPIDAPI_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "21ef2eb1-a7c3-476b-a652-d9abfddd6c32",
      "name": "Group 3 - FL Off-Market",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        400
      ],
      "parameters": {
        "url": "https://facebook-scraper3.p.rapidapi.com/group/posts",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "group_id",
              "value": "798052127462556"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "facebook-scraper3.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "YOUR_RAPIDAPI_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "06132518-0bab-44b2-82c7-04e7360adbe9",
      "name": "Group 4 - FL Wholesale",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        608
      ],
      "parameters": {
        "url": "https://facebook-scraper3.p.rapidapi.com/group/posts",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "group_id",
              "value": "211232392244757"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "facebook-scraper3.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "YOUR_RAPIDAPI_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b0ce34bd-b4cc-46d7-9c76-50049e6ddce0",
      "name": "Group 5 - FL Wholesale Deals",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        784
      ],
      "parameters": {
        "url": "https://facebook-scraper3.p.rapidapi.com/group/posts",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "group_id",
              "value": "101799586655446"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "facebook-scraper3.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "YOUR_RAPIDAPI_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "63edfbb2-91de-4478-8d9a-2ff4f1d35132",
      "name": "Group 6 - FL Off Market",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        960
      ],
      "parameters": {
        "url": "https://facebook-scraper3.p.rapidapi.com/group/posts",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "group_id",
              "value": "7183670468315847"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "facebook-scraper3.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "YOUR_RAPIDAPI_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f3a19ef5-4669-4099-8601-0e674cbe892f",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        224,
        0
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "posts"
      },
      "typeVersion": 1
    },
    {
      "id": "8434aef9-7da2-40c5-8d12-9ab080b173ce",
      "name": "Split Out1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        224,
        208
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "posts"
      },
      "typeVersion": 1
    },
    {
      "id": "cbffecb4-62bd-4314-a04d-5b9ca1854251",
      "name": "Split Out2",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        224,
        400
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "posts"
      },
      "typeVersion": 1
    },
    {
      "id": "ace1e816-0c50-41a8-b926-667db3957060",
      "name": "Split Out3",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        224,
        608
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "posts"
      },
      "typeVersion": 1
    },
    {
      "id": "7f2d2f00-8715-40ad-afd6-5cd6d9bd6344",
      "name": "Split Out4",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        224,
        784
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "posts"
      },
      "typeVersion": 1
    },
    {
      "id": "6a48c676-0cbb-4f55-a3e3-67f631f76292",
      "name": "Split Out5",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        224,
        960
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "posts"
      },
      "typeVersion": 1
    },
    {
      "id": "a5405eee-beae-4e6b-beff-b13066bb96f1",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        800,
        432
      ],
      "parameters": {
        "numberInputs": 6
      },
      "typeVersion": 3
    },
    {
      "id": "cafba674-bb36-4a00-a50b-47dc2405bd4c",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1040,
        480
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "bb418af2-da02-4f9d-bdc0-d989463c3c3e",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1264,
        480
      ],
      "parameters": {
        "text": "=Analyze the following Facebook posts and determine if they describe real estate deals. For each post:\n\n1\ufe0f\u20e3 Identify if it is a **real estate deal** (property for sale).\n2\ufe0f\u20e3 Extract the following details (if available):\n   - Property Address\n   - Bedrooms & Bathrooms\n   - Square Footage\n   - Repairs Needed\n   - Rehab Costs (if mentioned)\n   - After Repair Value (ARV)\n   - Asking Price\n   - Major Component Ages (Roof, Water Heater, AC)\n   - Keywords Detected (FSBO, Airbnb, Padsplit, BRRR, etc.)\n   - **Post URL** (for reference)\n\n3\ufe0f\u20e3 Classify the deal as:\n   \u2705 **Preferred Deal** (if at least **3 bed / 2 bath / 1,500+ sqft** OR mentions **pool/Airbnb-related terms**)\n   \u26a0\ufe0f **Not a Preferred Deal** (if it is a real estate deal but does not meet criteria)\n   \u274c **Unclear if this is a real estate deal** (if no sale is mentioned)\n\n\ud83d\udccc **Output in JSON format**, grouping each post separately.\n\nHere is a list of the posts:\n\n {{ JSON.stringify($json.data) }}",
        "options": {
          "systemMessage": "You are an AI real estate deal analyzer. Your job is to analyze Facebook posts and determine if they describe a property for sale. You must:\n1\ufe0f\u20e3 **Identify if the post is about a real estate deal** (property for sale).\n2\ufe0f\u20e3 **Extract key details** (if available):\n   - Property Address\n   - Bedrooms & Bathrooms Count\n   - Square Footage\n   - Repairs Needed\n   - Estimated Rehab Costs\n   - After Repair Value (ARV)\n   - Asking Price\n   - Major Component Ages (Roof, Water Heater, AC)\n   - Keywords Detected (FSBO, Airbnb, Padsplit, BRRR, etc.)\n   - Post URL (to reference the original post)\n3\ufe0f\u20e3 **Classify the deal** based on these criteria:\n   - \u2705 **'Preferred Deal'**: The property is at least **3 bed / 2 bath / 1,500+ sqft** OR mentions a **pool or Airbnb-related terms**.\n   - \u26a0\ufe0f **'Not a Preferred Deal'**: The property is for sale but does not meet the preferred criteria. Still extract and return all available details.\n4\ufe0f\u20e3 If a post **does not appear to be a real estate deal at all**, return: 'Unclear if this is a real estate deal.'\n5\ufe0f\u20e3 Always output structured **JSON format** for easy analysis, including the post URL.\n\nEXAMPLE JSON:\n\n[\n    {\n        \"status\": \"Preferred Deal\",\n        \"property_address\": null,\n        \"bedrooms\": 3,\n        \"bathrooms\": 2,\n        \"square_footage\": 1600,\n        \"repairs_needed\": \"Needs minor updates\",\n        \"rehab_costs\": null,\n        \"ARV\": 350000,\n        \"asking_price\": 250000,\n        \"major_components\": {\n            \"roof_age\": null,\n            \"water_heater_age\": null,\n            \"AC_age\": null\n        },\n        \"keywords_detected\": [\"Airbnb\"],\n        \"post_url\": \"https://facebook.com/groups/realestate/post/123456789\"\n    },\n    {\n        \"status\": \"Not a Preferred Deal\",\n        \"reason\": \"Property is only 2 bed / 1 bath and 1,200 sqft (below minimum).\",\n        \"property_address\": null,\n        \"bedrooms\": 2,\n        \"bathrooms\": 1,\n        \"square_footage\": 1200,\n        \"repairs_needed\": \"Needs rehab\",\n        \"rehab_costs\": null,\n        \"ARV\": 300000,\n        \"asking_price\": 180000,\n        \"major_components\": {\n            \"roof_age\": null,\n            \"water_heater_age\": null,\n            \"AC_age\": null\n        },\n        \"keywords_detected\": [],\n        \"post_url\": \"https://facebook.com/groups/realestate/post/987654321\"\n    },\n    {\n        \"status\": \"Unclear if this is a real estate deal\",\n        \"reason\": \"No mention of a property for sale.\",\n        \"post_url\": \"https://facebook.com/groups/realestate/post/111222333\"\n    }\n]"
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "3520f2bd-dd9d-4cb4-b1d2-371c59894d43",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1264,
        688
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {
          "responseFormat": "json_object"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "136bb72a-9347-47fc-b5ac-9ca50f228f62",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        1680,
        480
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "476c9123-1d18-4ce9-a23f-ec85bd899e32",
      "name": "Twilio",
      "type": "n8n-nodes-base.twilio",
      "position": [
        1920,
        480
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "a1111111-1111-1111-1111-111111111111",
      "name": "Sticky Note - Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        -300
      ],
      "parameters": {
        "color": 6,
        "width": 480,
        "height": 520,
        "content": "## \ud83c\udfe0 Real Estate Deal Finder \u2014 Facebook Groups \u2192 AI \u2192 SMS\n\nThis workflow scrapes posts from Facebook real estate groups, uses GPT-4o to analyze each post against your investment \"buy box,\" and texts you the qualifying deals via Twilio.\n\n### Required credentials\n- **RapidAPI** (Facebook Scraper3 API)\n- **OpenAI** (GPT-4o)\n- **Twilio** (Account SID + Auth Token)\n\n### Setup time\n~15\u201320 minutes once you have the API keys.\n\n### What you'll customize\n1. The 6 Facebook **group IDs** in the HTTP nodes\n2. The **buy box criteria** in the AI Agent's system message\n3. The **SMS message format** in the Edit Fields node\n4. The **schedule** (currently every 4 hours, 9 AM \u2013 9 PM)\n\n\u26a0\ufe0f This template is geared toward Florida wholesale/off-market deals but works for any region \u2014 just swap the group IDs."
      },
      "typeVersion": 1
    },
    {
      "id": "a2222222-2222-2222-2222-222222222222",
      "name": "Sticky Note - Schedule",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -680,
        220
      ],
      "parameters": {
        "color": 4,
        "width": 360,
        "height": 280,
        "content": "## \u23f0 Schedule Trigger\n\nRuns at minute 0, every 4 hours between 9 AM and 9 PM.\n\nCron: `0 9-21/4 * * *`\n\nEdit the cron expression to scrape more or less often. Keep in mind RapidAPI plans have monthly request limits."
      },
      "typeVersion": 1
    },
    {
      "id": "a3333333-3333-3333-3333-333333333333",
      "name": "Sticky Note - HTTP Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -300
      ],
      "parameters": {
        "color": 5,
        "width": 480,
        "height": 540,
        "content": "## \ud83d\udce5 Scrape Facebook Groups (Step 1)\n\nEach HTTP node calls the **Facebook Scraper3** API on RapidAPI to fetch recent posts from one Facebook group.\n\n### Setup\n1. Get a RapidAPI key \u2192 https://rapidapi.com\n2. Subscribe to **Facebook Scraper3**\n3. In each HTTP node, click \"Send Headers\" and add your `x-rapidapi-key` value \u2014 OR (better) create a **Header Auth credential** and reference it\n4. Replace each `group_id` query param with the ID of a group you've joined\n\n### Finding a group ID\nOpen the group in Facebook \u2192 the number in the URL (e.g. `facebook.com/groups/331454348246054`) is the ID.\n\n### Scaling\nAdd or remove HTTP/Split Out branches to track more or fewer groups. Just update the **Merge** node's `numberInputs` accordingly."
      },
      "typeVersion": 1
    },
    {
      "id": "a4444444-4444-4444-4444-444444444444",
      "name": "Sticky Note - Merge",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        140
      ],
      "parameters": {
        "color": 3,
        "width": 320,
        "height": 240,
        "content": "## \ud83d\udd00 Combine all posts (Step 2)\n\n- **Split Out** flattens each group's `posts` array into individual items\n- **Merge** combines all 6 group streams into one\n- **Aggregate** bundles every post back into a single array so the AI sees them all in one call (cheaper + faster than calling per post)"
      },
      "typeVersion": 1
    },
    {
      "id": "a5555555-5555-5555-5555-555555555555",
      "name": "Sticky Note - AI Agent",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1240,
        -40
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 460,
        "content": "## \ud83e\udd16 AI Deal Analyzer (Step 3)\n\nGPT-4o reads every post and extracts:\n- Address, beds/baths, square footage\n- Asking price, ARV, rehab cost\n- Component ages (roof, AC, water heater)\n- Keywords (FSBO, Airbnb, BRRR, Padsplit, pool, etc.)\n\nThen classifies each post as:\n- \u2705 **Preferred Deal** \u2014 matches your buy box\n- \u26a0\ufe0f **Not a Preferred Deal**\n- \u274c **Unclear if real estate deal**\n\n### \ud83c\udfaf Customize your buy box\nEdit the system message to change criteria. Default is **3 bed / 2 bath / 1,500+ sqft OR pool/Airbnb terms** \u2014 change the bed/bath/sqft minimums, add keywords, set a max price, or filter by city."
      },
      "typeVersion": 1
    },
    {
      "id": "a6666666-6666-6666-6666-666666666666",
      "name": "Sticky Note - OpenAI Model",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1264,
        880
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 200,
        "content": "## \ud83e\udde0 OpenAI Model\n\nUsing **GPT-4o** with `response_format: json_object` to guarantee parseable JSON output.\n\nAdd your OpenAI credentials here. Swap to **GPT-4o-mini** if you want lower cost (works fine for this task)."
      },
      "typeVersion": 1
    },
    {
      "id": "a7777777-7777-7777-7777-777777777777",
      "name": "Sticky Note - SMS Alert",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1660,
        -100
      ],
      "parameters": {
        "color": 2,
        "width": 440,
        "height": 540,
        "content": "## \ud83d\udcf1 SMS Alert (Step 4)\n\n### Edit Fields\nFormat the AI's JSON output into a readable SMS body. Example template:\n\n```\n\ud83c\udfe0 {{ $json.status }}!\n{{ $json.property_address }}\n{{ $json.bedrooms }}bd/{{ $json.bathrooms }}ba | {{ $json.square_footage }}sqft\nAsk: ${{ $json.asking_price }} | ARV: ${{ $json.ARV }}\n{{ $json.post_url }}\n```\n\n### Twilio\n1. Add Twilio credentials (Account SID + Auth Token)\n2. Set `to` = your phone number\n3. Set `from` = your Twilio number\n4. Map the message body to the formatted text from Edit Fields\n\n\ud83d\udca1 Tip: Add an **IF node** before Twilio that filters for `status === \"Preferred Deal\"` so you only get texts for deals that match your buy box."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out1": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Split Out2": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Split Out3": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "Split Out4": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 4
          }
        ]
      ]
    },
    "Split Out5": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 5
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Twilio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Group 1 - FSBO Florida Homes",
            "type": "main",
            "index": 0
          },
          {
            "node": "Group 2 - FL Sale or Wholesale",
            "type": "main",
            "index": 0
          },
          {
            "node": "Group 3 - FL Off-Market",
            "type": "main",
            "index": 0
          },
          {
            "node": "Group 4 - FL Wholesale",
            "type": "main",
            "index": 0
          },
          {
            "node": "Group 5 - FL Wholesale Deals",
            "type": "main",
            "index": 0
          },
          {
            "node": "Group 6 - FL Off Market",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Group 4 - FL Wholesale": {
      "main": [
        [
          {
            "node": "Split Out3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Group 3 - FL Off-Market": {
      "main": [
        [
          {
            "node": "Split Out2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Group 6 - FL Off Market": {
      "main": [
        [
          {
            "node": "Split Out5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Group 1 - FSBO Florida Homes": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Group 5 - FL Wholesale Deals": {
      "main": [
        [
          {
            "node": "Split Out4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Group 2 - FL Sale or Wholesale": {
      "main": [
        [
          {
            "node": "Split Out1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}