{
  "meta": {
    "instanceId": "4a11afdb3c52fd098e3eae9fad4b39fdf1bbcde142f596adda46c795e366b326",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "25856d57-7004-4e77-b424-267fc8a2136a",
      "name": "parameters",
      "type": "n8n-nodes-base.set",
      "position": [
        -1200,
        272
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "d16e4ff1-02f6-4627-8eed-f1dc94b37bda",
              "name": "city",
              "type": "string",
              "value": "={{ $json.chatInput }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b1e2690a-2c9d-493a-9ebe-e2e60b10fe75",
      "name": "OpenRouter Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        720,
        -96
      ],
      "parameters": {
        "options": {
          "temperature": 0
        }
      },
      "credentials": {
        "openRouterApi": {
          "id": "credential-id",
          "name": "openRouterApi Credential"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "53856c53-d3ac-4502-97ce-3dcc1b3c0944",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1472,
        -448
      ],
      "parameters": {
        "width": 704,
        "height": 496,
        "content": "# Booking Hotels Scraper\n\nThis workflow automates the extraction and presentation of hotel data from Booking.com. It is triggered by a chat message and uses the Bright Data API to scrape real-time information.\n\n👉 Get your free Bright Data API key here: [Bright Data](https://get.brightdata.com/unstoppable)\n\n## Key Features\nBright Data Integration: Utilizes Bright Data's Web Scraper to extract hotel listings from Booking.com based on a user-provided city.\n\nAI-Powered Data Refinement: Leverages an OpenRouter AI model to clean and format the extracted data into a user-friendly list.\n\nCalculations: Employs a Calculator tool to convert prices and ensure a clear, actionable output.\n\nDynamic Response: The final result is a well-presented, synthesized list of hotels, ready for immediate use.\n\n[Phil | Inforeole](https://inforeole.fr)\n- Ask me for profesional services\n- 🇫🇷 Contactez nous pour automatiser vos processus"
      },
      "typeVersion": 1
    },
    {
      "id": "0086bb48-c55d-4470-a0e0-3e03502bdb67",
      "name": "check Snapshot Again",
      "type": "n8n-nodes-base.noOp",
      "position": [
        400,
        384
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f025118a-7158-4c7f-8c16-cbd6735e618b",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        192,
        288
      ],
      "webhookId": "90ced54f-0f59-4cbf-a3ba-f4653c84656a",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "f113acb4-d92c-4e28-ab8d-46a760c7a492",
      "name": "check if result ready",
      "type": "n8n-nodes-base.if",
      "position": [
        -176,
        216
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fa03d52a-2e6f-47a6-86e3-80038c3f644c",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "ready"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "971b3f97-6bd8-4632-a369-0574b6ac57dd",
      "name": "Initiate batch extraction from URL",
      "type": "@brightdata/n8n-nodes-brightdata.brightData",
      "notes": "👉 Get your free Bright Data API key here: Bright Data https://get.brightdata.com/unstoppable",
      "position": [
        -976,
        272
      ],
      "parameters": {
        "urls": "=[{\"url\":\"https://www.booking.com\",\"location\":\"{{ $json.city }}\",\"check_in\":\"2025-11-01T00:00:00.000Z\",\"check_out\":\"2025-11-08T00:00:00.000Z\",\"adults\":2,\"children\":1,\"rooms\":1,\"property_type\":\"Hostels\",\"currency\":\"\",\"country\":\"\"}]",
        "resource": "webScrapper",
        "operation": "triggerCollectionByUrl",
        "dataset_id": {
          "__rl": true,
          "mode": "list",
          "value": "gd_m4bf7a917zfezv9d5",
          "cachedResultName": " Booking Listings Search"
        },
        "requestOptions": {}
      },
      "credentials": {
        "brightdataApi": {
          "id": "credential-id",
          "name": "brightdataApi Credential"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "46ac9648-9c1f-4c4b-88c9-64f2bdc95c26",
      "name": "Check the status of a batch extraction",
      "type": "@brightdata/n8n-nodes-brightdata.brightData",
      "notes": "👉 Get your free Bright Data API key here: Bright Data https://get.brightdata.com/unstoppable",
      "position": [
        -400,
        216
      ],
      "parameters": {
        "resource": "webScrapper",
        "operation": "monitorProgressSnapshot",
        "snapshot_id": "={{ $('Initiate batch extraction from URL').item.json.snapshot_id }}",
        "requestOptions": {}
      },
      "credentials": {
        "brightdataApi": {
          "id": "credential-id",
          "name": "brightdataApi Credential"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "711d58dc-9f61-4050-a587-f967c18f9b36",
      "name": "hotels",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -624,
        288
      ],
      "parameters": {
        "options": {
          "reset": true
        }
      },
      "typeVersion": 3
    },
    {
      "id": "14ab09c3-230f-4c47-a48e-c98493791c34",
      "name": "Download the snapshot content",
      "type": "@brightdata/n8n-nodes-brightdata.brightData",
      "notes": "👉 Get your free Bright Data API key here: Bright Data https://get.brightdata.com/unstoppable",
      "onError": "continueErrorOutput",
      "position": [
        80,
        -192
      ],
      "parameters": {
        "resource": "webScrapper",
        "operation": "downloadSnapshot",
        "snapshot_id": "={{ $('Check the status of a batch extraction').item.json.snapshot_id }}",
        "requestOptions": {}
      },
      "credentials": {
        "brightdataApi": {
          "id": "credential-id",
          "name": "brightdataApi Credential"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "80eedc12-1084-4f69-946e-e694635b69cb",
      "name": "clean data",
      "type": "n8n-nodes-base.set",
      "position": [
        272,
        -320
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0959a683-5e37-4542-b227-a3d99ed4473a",
              "name": "title",
              "type": "string",
              "value": "={{ $json.title }}"
            },
            {
              "id": "e9bd6f96-cf55-4aab-8fa7-8c0801058b34",
              "name": "address",
              "type": "string",
              "value": "={{ $json.address }}"
            },
            {
              "id": "56cd3a10-2969-4a36-92b0-2b741be118f5",
              "name": "original_price",
              "type": "number",
              "value": "={{ $json.original_price }}"
            },
            {
              "id": "47f07b88-970a-43a8-87ad-33e90328e796",
              "name": "final_price",
              "type": "number",
              "value": "={{ $json.final_price }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c84f4df4-bb8e-42b3-8072-08a7d8a52b3e",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -1424,
        272
      ],
      "webhookId": "ffe54650-b98b-45fa-9cb3-31421837e6fb",
      "parameters": {
        "options": {
          "responseMode": "lastNode"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "37667062-07ee-41eb-9358-5daa9c34be5f",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        496,
        -320
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "c62e2982-00fb-43e1-9320-820ae7e5101c",
      "name": "Human Friendly Results",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        720,
        -320
      ],
      "parameters": {
        "text": "={{ $json }}",
        "options": {
          "systemMessage": "=Convert this list of hotels into a well-presented list for human display.\n\nUse the CALC tool to show prices in euros.\n\nStart the response with 'Here is the list of hotels available on Booking in the city of' followed by the name of the city"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "b8f16cb1-bf89-4c34-b9c1-c3a0422ac940",
      "name": "Calculator",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "position": [
        864,
        -96
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "2e4ba580-7546-4360-b18b-99dc7c60fd83",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1472,
        128
      ],
      "parameters": {
        "color": 6,
        "width": 752,
        "height": 320,
        "content": "## Start\n\nAsk for City to scrape\nSend Hotel listing Request"
      },
      "typeVersion": 1
    },
    {
      "id": "08e27b2b-a6b9-492b-92c1-79b8bcad2271",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -688,
        112
      ],
      "parameters": {
        "color": 2,
        "width": 1264,
        "height": 496,
        "content": "## Wait for results\n\nIt takes time to get result (scrap, bypass captchas...)"
      },
      "typeVersion": 1
    },
    {
      "id": "d84fd647-a202-4158-a156-c04504143a44",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -416
      ],
      "parameters": {
        "color": 4,
        "width": 1136,
        "height": 496,
        "content": "## Process Hotel listing\nGet Hotel listing (if not ready, loop)\nProcess it in a Fiendly way"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "check Snapshot Again",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "hotels": {
      "main": [
        [],
        [
          {
            "node": "Check the status of a batch extraction",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Human Friendly Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "Human Friendly Results",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "clean data": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "parameters": {
      "main": [
        [
          {
            "node": "Initiate batch extraction from URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "check Snapshot Again": {
      "main": [
        [
          {
            "node": "hotels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "check if result ready": {
      "main": [
        [
          {
            "node": "Download the snapshot content",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Human Friendly Results": {
      "main": [
        []
      ]
    },
    "OpenRouter Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Human Friendly Results",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download the snapshot content": {
      "main": [
        [
          {
            "node": "clean data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Initiate batch extraction from URL": {
      "main": [
        [
          {
            "node": "hotels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check the status of a batch extraction": {
      "main": [
        [
          {
            "node": "check if result ready",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}