diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b96f10d..9a3ca50d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Feature * New method of saving sessions to a file using worker, made in partnership with [codechat](https://github.com/code-chat-br/whatsapp-api) +* Correction of variables breaking lines in typebot # 1.8.0 (2024-05-27 16:10) diff --git a/src/api/integrations/typebot/services/typebot.service.ts b/src/api/integrations/typebot/services/typebot.service.ts index ebdaa920..ce56108d 100644 --- a/src/api/integrations/typebot/services/typebot.service.ts +++ b/src/api/integrations/typebot/services/typebot.service.ts @@ -525,10 +525,14 @@ export class TypebotService { } } - if (element.type === 'p') { + if (element.type === 'p' && element.type !== 'inline-variable') { text = text.trim() + '\n'; } + if (element.type === 'inline-variable') { + text = text.trim(); + } + if (element.type === 'ol') { text = '\n' + @@ -582,6 +586,8 @@ export class TypebotService { formattedText = formattedText.replace(/\*\*/g, '').replace(/__/, '').replace(/~~/, '').replace(/\n$/, ''); + formattedText = formattedText.replace(/\n$/, ''); + await instance.textMessage({ number: remoteJid.split('@')[0], options: {