From 51ed67a53e110167465375b66274b2bb8a251560 Mon Sep 17 00:00:00 2001 From: Douglas Rauber at Nitro Date: Tue, 19 Dec 2023 16:31:41 -0300 Subject: [PATCH] Fix: Array message from typebot get only last one to show --- src/whatsapp/services/typebot.service.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/whatsapp/services/typebot.service.ts b/src/whatsapp/services/typebot.service.ts index 3dc4c894..fc41394e 100644 --- a/src/whatsapp/services/typebot.service.ts +++ b/src/whatsapp/services/typebot.service.ts @@ -412,12 +412,15 @@ export class TypebotService { let formattedText = ''; let linkPreview = false; - for (const richText of message.content.richText) { if (richText.type === 'variable') { for (const child of richText.children) { for (const grandChild of child.children) { - formattedText += grandChild.text; + if (grandChild.text.startsWith('[') && grandChild.text.endsWith(']')) { + formattedText += JSON.parse(grandChild.text).slice(-1)[0]; + } else { + formattedText += grandChild.text; + } } } } else {