Owner notification webhook: Telegram re-point (#23)
Test backoffice (smb-crm) / test (push) Has been cancelled
Test backoffice (smb-crm) / test (push) Has been cancelled
Flask fires a fire-and-forget internal webhook (owner_notify.py, mirroring
mailer.py's background-thread queue) on booking create/cancel/reschedule,
carrying the same {booking, business_name, notify_channel} shape the old
EA-driven "Build booking row" node produced, plus an event field so the
Telegram message can say what actually happened. n8n/booking-sync.json gets
a new webhook + IF node feeding the existing Telegram node directly, so it
no longer needs EA's API to build the notification payload; channel routing
(only telegram sends for now) lives in that IF node.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+65
-3
@@ -68,7 +68,7 @@
|
||||
"resource": "message",
|
||||
"operation": "sendMessage",
|
||||
"chatId": "5499280257",
|
||||
"text": "=📅 Neue Buchung\nBetrieb: {{ $('Build booking row').item.json.business_name || $('Build booking row').item.json.booking.client_id }}\nKunde: {{ $('Build booking row').item.json.booking.customer_name || '—' }}\nLeistung: {{ $('Build booking row').item.json.booking.service || '—' }}\nWann: {{ $('Build booking row').item.json.booking.start_time || '—' }}\nKontakt: {{ $('Build booking row').item.json.booking.customer_contact || '—' }}\nQuelle: {{ $('Build booking row').item.json.booking.source }}",
|
||||
"text": "=📅 {{ $json.body.event === 'cancelled' ? 'Buchung storniert' : $json.body.event === 'rescheduled' ? 'Buchung verschoben' : 'Neue Buchung' }}\nBetrieb: {{ $json.body.business_name || $json.body.booking.client_id }}\nKunde: {{ $json.body.booking.customer_name || '—' }}\nLeistung: {{ $json.body.booking.service || '—' }}\nWann: {{ $json.body.booking.start_time || '—' }}\nKontakt: {{ $json.body.booking.customer_contact || '—' }}\nQuelle: {{ $json.body.booking.source }}",
|
||||
"additionalFields": {
|
||||
"appendAttribution": false
|
||||
}
|
||||
@@ -79,7 +79,7 @@
|
||||
"typeVersion": 1.2,
|
||||
"position": [
|
||||
900,
|
||||
300
|
||||
500
|
||||
],
|
||||
"credentials": {
|
||||
"telegramApi": {
|
||||
@@ -87,6 +87,57 @@
|
||||
"name": "SMB Telegram (leads bot)"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "owner-notify",
|
||||
"responseMode": "onReceived",
|
||||
"options": {
|
||||
"allowedOrigins": "*"
|
||||
}
|
||||
},
|
||||
"id": "b0000000-1111-2222-3333-888888888888",
|
||||
"name": "Owner notify webhook",
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
240,
|
||||
500
|
||||
],
|
||||
"webhookId": "smb-owner-notify-webhook-0001"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"conditions": {
|
||||
"options": {
|
||||
"caseSensitive": true,
|
||||
"leftValue": "",
|
||||
"typeValidation": "strict"
|
||||
},
|
||||
"conditions": [
|
||||
{
|
||||
"id": "b0000000-1111-2222-3333-aaaaaaaaaaaa",
|
||||
"leftValue": "={{ $json.body.notify_channel }}",
|
||||
"rightValue": "telegram",
|
||||
"operator": {
|
||||
"type": "string",
|
||||
"operation": "equals"
|
||||
}
|
||||
}
|
||||
],
|
||||
"combinator": "and"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "b0000000-1111-2222-3333-999999999999",
|
||||
"name": "Telegram channel?",
|
||||
"type": "n8n-nodes-base.if",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
460,
|
||||
500
|
||||
]
|
||||
}
|
||||
],
|
||||
"connections": {
|
||||
@@ -112,7 +163,18 @@
|
||||
]
|
||||
]
|
||||
},
|
||||
"Save to CRM (bookings)": {
|
||||
"Owner notify webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Telegram channel?",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Telegram channel?": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user