From 9df0d5d78d29384b01b3da00682eb3ed5fd2bd67 Mon Sep 17 00:00:00 2001 From: Ihor_Zhekov Date: Thu, 26 Feb 2026 10:11:26 +0100 Subject: [PATCH] w --- WebApp/app.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/WebApp/app.js b/WebApp/app.js index 8b93283..8bc47fa 100644 --- a/WebApp/app.js +++ b/WebApp/app.js @@ -254,9 +254,9 @@ function showFallback() { // ─── n8n Webhook (#5.2, #6) ────────────────────────────────── -async function postWebhook(path, body) { - const base = (CFG.webhook_base || '').replace(/\/$/, ''); - const res = await fetch(`${base}${path}`, { +async function postWebhook(body) { + const url = (CFG.webhook_base || '').replace(/\/$/, ''); + const res = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body), @@ -268,6 +268,7 @@ async function postWebhook(path, body) { async function startSession(entry) { const payload = { + action: 'start', entry, sponsor: window.FESTIVAL.sponsor, session_id: window.FESTIVAL.session_id, @@ -277,7 +278,7 @@ async function startSession(entry) { }; const typing = showTyping(); try { - const data = await postWebhook('/festival/start', payload); + const data = await postWebhook(payload); if (typing) typing.remove(); const reply = (data?.reply && typeof data.reply === 'string') ? data.reply @@ -304,6 +305,7 @@ async function sendMessage(text) { appendBubble('user', text); const payload = { + action: 'message', session_id: window.FESTIVAL.session_id, entry: window.FESTIVAL.entry, sponsor: window.FESTIVAL.sponsor, @@ -313,7 +315,7 @@ async function sendMessage(text) { const typing = showTyping(); try { - const data = await postWebhook('/festival/message', payload); + const data = await postWebhook(payload); if (typing) typing.remove(); const reply = (data?.reply && typeof data.reply === 'string' && data.reply.trim()) ? data.reply : '…';