diff --git a/src/whatsapp/services/typebot.service.ts b/src/whatsapp/services/typebot.service.ts index b4da8369..7681fa34 100644 --- a/src/whatsapp/services/typebot.service.ts +++ b/src/whatsapp/services/typebot.service.ts @@ -181,6 +181,14 @@ export class TypebotService { if (startSession) { const newSessions = await this.clearSessions(instance, remoteJid); + + const prefilledVariables = { + ...data.prefilledVariables, + remoteJid: data.remoteJid, + pushName: data.pushName || '', + messageType: msg.type, + instanceName: instance.instanceName, + }; const response = await this.createNewSession(instance, { enabled: findTypebot.enabled, @@ -641,6 +649,12 @@ export class TypebotService { return; } + + const prefilledVariables = { + remoteJid: remoteJid, + pushName: pushName, + messageType: msg.type, + }; try { const version = this.configService.get('TYPEBOT').API_VERSION; @@ -695,6 +709,7 @@ export class TypebotService { sessions: sessions, remoteJid: remoteJid, pushName: msg.pushName, + prefilledVariables: prefilledVariables, }); await this.sendWAMessage(instance, remoteJid, data.messages, data.input, data.clientSideActions);