200 lines
9.3 KiB
JSON
200 lines
9.3 KiB
JSON
{
|
|
"updatedAt": "2026-07-25T06:47:03.613Z",
|
|
"createdAt": "2026-07-25T04:55:57.932Z",
|
|
"id": "b84Fmd6xTFjt0A8D",
|
|
"name": "scraper-service (receiver)",
|
|
"active": true,
|
|
"isArchived": false,
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"httpMethod": "POST",
|
|
"path": "booking-result",
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.webhook",
|
|
"typeVersion": 2.1,
|
|
"position": [
|
|
0,
|
|
0
|
|
],
|
|
"id": "8dc9e219-bacc-452e-adaf-35fc4903548d",
|
|
"name": "Webhook",
|
|
"webhookId": "3ddfdc90-2a1a-4d22-8017-d5ee79ba6099"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "// Unterstützt sowohl $input.item.json.body (Webhook) als auch $input.item.json direkt\nconst payload = $input.item.json.body || $input.item.json;\n\nconst rawPrice = payload.price;\nconst hotelName = payload.hotelName || \"Unbekanntes Hotel\";\n\n// Falls kein Preis gefunden wurde, senden wir die Hotel-Info trotzdem mit (hilft beim Debugging in n8n)\nif (!rawPrice) {\n return [{\n json: {\n success: false,\n reason: \"Kein Preis im Payload gefunden\",\n hotelName: hotelName,\n url: payload.url,\n timestamp: payload.timestamp || new Date().toISOString()\n }\n }];\n}\n\n// Preis bereinigen (z. B. \"€ 1.017\" -> 1017 oder \"1.016,70 €\" -> 1016.7)\nlet cleanPrice = null;\n\nif (rawPrice.includes(',')) {\n // Deutsche Formate mit Cents (z. B. \"1.016,70 €\" -> 1016.70)\n const normalized = rawPrice.replace(/\\./g, '').replace(',', '.').replace(/[^\\d.]/g, '');\n cleanPrice = parseFloat(normalized);\n} else {\n // Ganzzahlen (z. B. \"€ 1.017\" -> 1017)\n cleanPrice = parseInt(rawPrice.replace(/[^\\d]/g, ''), 10);\n}\n\n// Vollständiges Ergebnis an n8n zurückgeben\nreturn [{\n json: {\n success: true,\n jobId: payload.jobId,\n hotelName: hotelName,\n cleanPrice: cleanPrice,\n rawPrice: rawPrice,\n geniusPrice: cleanPrice*0.90,\n rating: payload.rating,\n reviewCount: payload.reviewCount,\n address: payload.address,\n image: payload.image,\n url: payload.url,\n timestamp: payload.timestamp\n }\n}];"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
208,
|
|
0
|
|
],
|
|
"id": "fed7037a-ae62-44b4-8d0b-7c51ff6675d0",
|
|
"name": "Code in JavaScript"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"chatId": "302560724",
|
|
"text": "=Hotel Update\n\n*{{ $json.hotelName }}*\nPreis: {{ $json.cleanPrice }} € (Rohwert: {{ $json.rawPrice }}, -10%: {{$json.geniusPrice}} € )\nBewertung: {{ $json.rating }} ({{ $json.reviewCount }} Bewertungen)\nAdresse: {{ $json.address }}\n\n[Auf Booking.com ansehen]({{ $json.url }})",
|
|
"additionalFields": {
|
|
"appendAttribution": false,
|
|
"parse_mode": "Markdown"
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.telegram",
|
|
"typeVersion": 1.2,
|
|
"position": [
|
|
592,
|
|
0
|
|
],
|
|
"id": "4273d21f-06f5-4438-bb04-660082203602",
|
|
"name": "Send a text message",
|
|
"webhookId": "96f70b22-e539-4570-9430-46f8c9b98bf3",
|
|
"credentials": {
|
|
"telegramApi": {
|
|
"id": "0VfHBSP6pKSlq4f8",
|
|
"name": "scraperservicebot"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"connections": {
|
|
"Webhook": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Code in JavaScript",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Code in JavaScript": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Send a text message",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"settings": {
|
|
"executionOrder": "v1",
|
|
"binaryMode": "separate"
|
|
},
|
|
"staticData": null,
|
|
"meta": {
|
|
"templateCredsSetupCompleted": true
|
|
},
|
|
"pinData": {},
|
|
"versionId": "a02b8fb4-b954-444b-a9f6-9a3a8021fd66",
|
|
"activeVersionId": "a02b8fb4-b954-444b-a9f6-9a3a8021fd66",
|
|
"triggerCount": 1,
|
|
"shared": [
|
|
{
|
|
"updatedAt": "2026-07-25T04:55:57.934Z",
|
|
"createdAt": "2026-07-25T04:55:57.934Z",
|
|
"role": "workflow:owner",
|
|
"workflowId": "b84Fmd6xTFjt0A8D",
|
|
"projectId": "cSAaWNJydnksD5EB"
|
|
}
|
|
],
|
|
"activeVersion": {
|
|
"updatedAt": "2026-07-25T06:52:16.000Z",
|
|
"createdAt": "2026-07-25T06:46:46.092Z",
|
|
"versionId": "a02b8fb4-b954-444b-a9f6-9a3a8021fd66",
|
|
"workflowId": "b84Fmd6xTFjt0A8D",
|
|
"nodes": [
|
|
{
|
|
"parameters": {
|
|
"httpMethod": "POST",
|
|
"path": "booking-result",
|
|
"options": {}
|
|
},
|
|
"type": "n8n-nodes-base.webhook",
|
|
"typeVersion": 2.1,
|
|
"position": [
|
|
0,
|
|
0
|
|
],
|
|
"id": "8dc9e219-bacc-452e-adaf-35fc4903548d",
|
|
"name": "Webhook",
|
|
"webhookId": "3ddfdc90-2a1a-4d22-8017-d5ee79ba6099"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"jsCode": "// Unterstützt sowohl $input.item.json.body (Webhook) als auch $input.item.json direkt\nconst payload = $input.item.json.body || $input.item.json;\n\nconst rawPrice = payload.price;\nconst hotelName = payload.hotelName || \"Unbekanntes Hotel\";\n\n// Falls kein Preis gefunden wurde, senden wir die Hotel-Info trotzdem mit (hilft beim Debugging in n8n)\nif (!rawPrice) {\n return [{\n json: {\n success: false,\n reason: \"Kein Preis im Payload gefunden\",\n hotelName: hotelName,\n url: payload.url,\n timestamp: payload.timestamp || new Date().toISOString()\n }\n }];\n}\n\n// Preis bereinigen (z. B. \"€ 1.017\" -> 1017 oder \"1.016,70 €\" -> 1016.7)\nlet cleanPrice = null;\n\nif (rawPrice.includes(',')) {\n // Deutsche Formate mit Cents (z. B. \"1.016,70 €\" -> 1016.70)\n const normalized = rawPrice.replace(/\\./g, '').replace(',', '.').replace(/[^\\d.]/g, '');\n cleanPrice = parseFloat(normalized);\n} else {\n // Ganzzahlen (z. B. \"€ 1.017\" -> 1017)\n cleanPrice = parseInt(rawPrice.replace(/[^\\d]/g, ''), 10);\n}\n\n// Vollständiges Ergebnis an n8n zurückgeben\nreturn [{\n json: {\n success: true,\n jobId: payload.jobId,\n hotelName: hotelName,\n cleanPrice: cleanPrice,\n rawPrice: rawPrice,\n geniusPrice: cleanPrice*0.90,\n rating: payload.rating,\n reviewCount: payload.reviewCount,\n address: payload.address,\n image: payload.image,\n url: payload.url,\n timestamp: payload.timestamp\n }\n}];"
|
|
},
|
|
"type": "n8n-nodes-base.code",
|
|
"typeVersion": 2,
|
|
"position": [
|
|
208,
|
|
0
|
|
],
|
|
"id": "fed7037a-ae62-44b4-8d0b-7c51ff6675d0",
|
|
"name": "Code in JavaScript"
|
|
},
|
|
{
|
|
"parameters": {
|
|
"chatId": "302560724",
|
|
"text": "=Hotel Update\n\n*{{ $json.hotelName }}*\nPreis: {{ $json.cleanPrice }} € (Rohwert: {{ $json.rawPrice }}, -10%: {{$json.geniusPrice}} € )\nBewertung: {{ $json.rating }} ({{ $json.reviewCount }} Bewertungen)\nAdresse: {{ $json.address }}\n\n[Auf Booking.com ansehen]({{ $json.url }})",
|
|
"additionalFields": {
|
|
"appendAttribution": false,
|
|
"parse_mode": "Markdown"
|
|
}
|
|
},
|
|
"type": "n8n-nodes-base.telegram",
|
|
"typeVersion": 1.2,
|
|
"position": [
|
|
592,
|
|
0
|
|
],
|
|
"id": "4273d21f-06f5-4438-bb04-660082203602",
|
|
"name": "Send a text message",
|
|
"webhookId": "96f70b22-e539-4570-9430-46f8c9b98bf3",
|
|
"credentials": {
|
|
"telegramApi": {
|
|
"id": "0VfHBSP6pKSlq4f8",
|
|
"name": "scraperservicebot"
|
|
}
|
|
}
|
|
}
|
|
],
|
|
"connections": {
|
|
"Webhook": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Code in JavaScript",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
},
|
|
"Code in JavaScript": {
|
|
"main": [
|
|
[
|
|
{
|
|
"node": "Send a text message",
|
|
"type": "main",
|
|
"index": 0
|
|
}
|
|
]
|
|
]
|
|
}
|
|
},
|
|
"authors": "Prasanna Ranjan",
|
|
"name": "Version a02b8fb4",
|
|
"description": "",
|
|
"autosaved": true
|
|
},
|
|
"tags": []
|
|
} |