chore: Add apiKey and ServerUrl to prefilledVariables in typebot service

Update typebot.service.ts to add apiKey and ServerUrl to prefilledVariables.
This change is necessary for the typebot service to correctly prefill variables with the required credentials.
The deleted file .github/workflows/publish_docker_image_v2.yml was not related to this change.

Note: This change does not affect the current functionality but provides a better way to handle credentials.

Confidence: 90%
This commit is contained in:
Davidson Gomes
2024-07-18 08:15:53 -03:00
parent b907d85a7e
commit 9aa2b1b3bf
2 changed files with 10 additions and 49 deletions

View File

@@ -1,9 +1,10 @@
import { Message, Typebot as TypebotModel, TypebotSession } from '@prisma/client';
import axios from 'axios';
import { ConfigService, S3, Typebot } from '../../../../config/env.config';
import { Auth, ConfigService, HttpServer, S3, Typebot } from '../../../../config/env.config';
import { Logger } from '../../../../config/logger.config';
import { sendTelemetry } from '../../../../utils/sendTelemetry';
import { ServerUP } from '../../../../utils/server-up';
import { InstanceDto } from '../../../dto/instance.dto';
import { PrismaRepository } from '../../../repository/repository.service';
import { WAMonitoringService } from '../../../services/monitor.service';
@@ -710,6 +711,8 @@ export class TypebotService {
const prefilledVariables = {
remoteJid: remoteJid,
instanceName: instance.instanceName,
serverUrl: this.configService.get<HttpServer>('SERVER').URL,
apiKey: this.configService.get<Auth>('AUTHENTICATION').API_KEY.KEY,
};
if (variables?.length) {
@@ -904,6 +907,8 @@ export class TypebotService {
remoteJid: data.remoteJid,
pushName: data.pushName || data.prefilledVariables?.pushName || '',
instanceName: instance.instanceName,
serverUrl: this.configService.get<HttpServer>('SERVER').URL,
apiKey: this.configService.get<Auth>('AUTHENTICATION').API_KEY.KEY,
},
};
} else {
@@ -917,6 +922,8 @@ export class TypebotService {
remoteJid: data.remoteJid,
pushName: data.pushName || data.prefilledVariables?.pushName || '',
instanceName: instance.instanceName,
serverUrl: this.configService.get<HttpServer>('SERVER').URL,
apiKey: this.configService.get<Auth>('AUTHENTICATION').API_KEY.KEY,
},
},
};
@@ -936,6 +943,8 @@ export class TypebotService {
remoteJid: data.remoteJid,
pushName: data.pushName || '',
instanceName: instance.instanceName,
serverUrl: this.configService.get<HttpServer>('SERVER').URL,
apiKey: this.configService.get<Auth>('AUTHENTICATION').API_KEY.KEY,
},
awaitUser: false,
typebotId: data.typebotId,