From fe0a36f9aa327c3bc8d3f6aa9916f1b742c6c0bd Mon Sep 17 00:00:00 2001 From: Ihor_Zhekov Date: Mon, 23 Mar 2026 09:32:34 +0100 Subject: [PATCH] webhook test added --- Profice WebSite/scripts/add/send.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Profice WebSite/scripts/add/send.php b/Profice WebSite/scripts/add/send.php index 157d479..77c2773 100644 --- a/Profice WebSite/scripts/add/send.php +++ b/Profice WebSite/scripts/add/send.php @@ -49,9 +49,9 @@ define('USE_PRODUCTION', true); // Use production webhook for live server define('DEBUG_MODE', true); // Enable debug temporarily to see errors // N8N Webhooks -define('WEBHOOK_TEST', 'https://n8n.profice.de/webhook-test/d94ef798-3f43-46dd-8207-1e335e64518f'); +define('WEBHOOK_TEST', 'https://n8n.support-space.de/webhook-test/bb086ec3-42a5-4f5a-bbab-eddba0db55cc'); define('WEBHOOK_PROD', 'https://n8n.support-space.de/webhook/bb086ec3-42a5-4f5a-bbab-eddba0db55cc'); -define('WEBHOOK_URL', USE_PRODUCTION ? WEBHOOK_PROD : WEBHOOK_TEST); +define('WEBHOOK_URL', WEBHOOK_PROD); // Both test and prod are always active // KI Chat Webhook define('KI_CHAT_WEBHOOK_TEST', 'https://n8n.support-space.de/webhook-test/8a25bce2-ff83-4676-a3a2-a0e1174fcffe'); @@ -544,23 +544,23 @@ function handleContactForm($data) { // Store lead locally first $leadId = storeLead($formData); - - // Send to Offer webhook (contact form) - $webhookResult = sendToWebhook($formData, WEBHOOK_URL); - + + // Send to both production and test webhooks + $webhookResultProd = sendToWebhook($formData, WEBHOOK_PROD); + $webhookResultTest = sendToWebhook($formData, WEBHOOK_TEST); + // Always return success to user, but include webhook info in debug mode $debugData = DEBUG_MODE ? [ 'lead_id' => $leadId, - 'webhook_result' => $webhookResult, - 'webhook_url' => WEBHOOK_URL, + 'webhook_prod' => $webhookResultProd, + 'webhook_test' => $webhookResultTest, 'form_data' => $formData ] : null; - - if ($webhookResult['success']) { + + if ($webhookResultProd['success'] || $webhookResultTest['success']) { sendResponse(true, 'Formular erfolgreich gesendet', $debugData); } else { - // Still return success to user but log the webhook error - error_log('Webhook failed but form was stored locally: ' . json_encode($webhookResult)); + error_log('Both webhooks failed but form was stored locally: ' . json_encode(['prod' => $webhookResultProd, 'test' => $webhookResultTest])); sendResponse(true, 'Formular erfolgreich gesendet (Webhook-Fehler protokolliert)', $debugData); } }