From 63233eb7eea6956ea2ce546b09246bb6df62c4f5 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Sun, 12 Nov 2023 08:35:29 +0100 Subject: [PATCH] :bug: (webhook) Fix legacy webhook {{state}} body parsing --- .../api/typebots/[typebotId]/blocks/[blockId]/executeWebhook.ts | 2 +- .../blocks/integrations/webhook/executeWebhookBlock.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/viewer/src/pages/api/typebots/[typebotId]/blocks/[blockId]/executeWebhook.ts b/apps/viewer/src/pages/api/typebots/[typebotId]/blocks/[blockId]/executeWebhook.ts index 44ae3eaa7..c0202b01a 100644 --- a/apps/viewer/src/pages/api/typebots/[typebotId]/blocks/[blockId]/executeWebhook.ts +++ b/apps/viewer/src/pages/api/typebots/[typebotId]/blocks/[blockId]/executeWebhook.ts @@ -239,7 +239,7 @@ const getBodyContent = variables: Variable[] isCustomBody?: boolean }): Promise => { - return isEmpty(body) && isCustomBody !== true + return body === '{{state}}' || isEmpty(body) || isCustomBody !== true ? JSON.stringify( resultValues ? parseAnswers({ diff --git a/packages/bot-engine/blocks/integrations/webhook/executeWebhookBlock.ts b/packages/bot-engine/blocks/integrations/webhook/executeWebhookBlock.ts index d14233102..7b3c17272 100644 --- a/packages/bot-engine/blocks/integrations/webhook/executeWebhookBlock.ts +++ b/packages/bot-engine/blocks/integrations/webhook/executeWebhookBlock.ts @@ -223,7 +223,7 @@ const getBodyContent = async ({ variables: Variable[] isCustomBody?: boolean }): Promise => { - return isEmpty(body) && isCustomBody !== true + return body === '{{state}}' || isEmpty(body) || isCustomBody !== true ? JSON.stringify( parseAnswers({ answers,