Skip to content

Commit 29a1d99

Browse files
committed
fix: Fixed prefilledVariables in startTypebot
1 parent ebbba7b commit 29a1d99

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 2.1.3 (develop)
2+
3+
### Fixed
4+
5+
* Fixed prefilledVariables in startTypebot
6+
17
# 2.1.2 (2024-10-06 10:09)
28

39
### Features

src/api/integrations/chatbot/typebot/controllers/typebot.controller.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { TypebotService } from '@api/integrations/chatbot/typebot/services/typeb
55
import { PrismaRepository } from '@api/repository/repository.service';
66
import { WAMonitoringService } from '@api/services/monitor.service';
77
import { Events } from '@api/types/wa.types';
8-
import { Auth, configService, HttpServer, Typebot } from '@config/env.config';
8+
import { configService, Typebot } from '@config/env.config';
99
import { Logger } from '@config/logger.config';
1010
import { BadRequestException } from '@exceptions';
1111
import { Typebot as TypebotModel } from '@prisma/client';
@@ -609,13 +609,7 @@ export class TypebotController extends ChatbotController implements ChatbotContr
609609
}
610610
}
611611

612-
const prefilledVariables = {
613-
remoteJid: remoteJid,
614-
instanceName: instance.instanceName,
615-
serverUrl: configService.get<HttpServer>('SERVER').URL,
616-
apiKey: configService.get<Auth>('AUTHENTICATION').API_KEY.KEY,
617-
ownerJid: instanceData.number,
618-
};
612+
const prefilledVariables: any = {};
619613

620614
if (variables?.length) {
621615
variables.forEach((variable: { name: string | number; value: string }) => {
@@ -674,6 +668,7 @@ export class TypebotController extends ChatbotController implements ChatbotContr
674668
stopBotFromMe,
675669
keepOpen,
676670
'init',
671+
prefilledVariables,
677672
);
678673

679674
// const response = await this.typebotService.createNewSession(instanceData, {

src/api/integrations/chatbot/typebot/services/typebot.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ export class TypebotService {
356356
stopBotFromMe: boolean,
357357
keepOpen: boolean,
358358
content: string,
359+
prefilledVariables?: any,
359360
) {
360361
if (session && expire && expire > 0) {
361362
const now = Date.now();
@@ -397,6 +398,7 @@ export class TypebotService {
397398
remoteJid: remoteJid,
398399
pushName: msg.pushName,
399400
botId: findTypebot.id,
401+
prefilledVariables: prefilledVariables,
400402
});
401403

402404
if (data.session) {
@@ -524,6 +526,7 @@ export class TypebotService {
524526
remoteJid: remoteJid,
525527
pushName: msg?.pushName,
526528
botId: findTypebot.id,
529+
prefilledVariables: prefilledVariables,
527530
});
528531

529532
if (data?.session) {

0 commit comments

Comments
 (0)