From 6fe3433ed977c98b8eb1f9637a10e35fefea1dca Mon Sep 17 00:00:00 2001 From: Douglas DUTEIL Date: Mon, 2 Sep 2024 15:24:00 +0200 Subject: [PATCH] :pirate_flag: (crisp): add delay hack --- src/connectors/crisp.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/connectors/crisp.ts b/src/connectors/crisp.ts index 88602383..7ff6feb4 100644 --- a/src/connectors/crisp.ts +++ b/src/connectors/crisp.ts @@ -73,6 +73,10 @@ export async function startCripsConversation({ }, }); + // HACK(douglasduteil): Wait for the message to be sent + // Crisp seems to have a delay between the message being sent and the state being updated + await new Promise((resolve) => setTimeout(resolve, 500)); + await fetch_crisp(config, { endpoint: `/v1/website/${config.website_id}/conversation/${session_id}/state`, method: "PATCH",