diff --git a/packages/core.gbapp/services/GBDeployer.ts b/packages/core.gbapp/services/GBDeployer.ts index b3726f76..3725f8d4 100644 --- a/packages/core.gbapp/services/GBDeployer.ts +++ b/packages/core.gbapp/services/GBDeployer.ts @@ -205,7 +205,6 @@ export class GBDeployer implements IGBDeployer { public async deployBlankBot(botId: string, mobile: string, email: string) { // Creates a new row on the GuaribasInstance table. - const instance = await this.importer.createBotInstance(botId); const bootInstance = GBServer.globals.bootInstance; @@ -230,9 +229,6 @@ export class GBDeployer implements IGBDeployer { instance.state = 'active'; instance.nlpScore = 0.8; instance.searchScore = 0.25; - instance.whatsappServiceKey = null; - instance.whatsappServiceNumber = null; - instance.whatsappServiceUrl = null; instance.params = JSON.stringify({ 'Can Publish': mobile, 'Admin Notify E-mail': email }); // Saves bot information to the store. diff --git a/packages/core.gbapp/services/GBImporterService.ts b/packages/core.gbapp/services/GBImporterService.ts index fafb99d0..70122ef6 100644 --- a/packages/core.gbapp/services/GBImporterService.ts +++ b/packages/core.gbapp/services/GBImporterService.ts @@ -99,7 +99,7 @@ export class GBImporter { } public async createBotInstance (botId: string) { - const fullSettingsJson = { ...GBServer.globals.bootInstance }; + const fullSettingsJson = { }; fullSettingsJson['botId'] = botId; return await GuaribasInstance.create(fullSettingsJson); diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 3bb16215..1a4ed1cc 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -771,7 +771,7 @@ export class GBMinService { await min.whatsAppDirectLine.setup(true); } else { const minBoot = GBServer.globals.minBoot as any; - if (min !== minBoot) { + if (min !== minBoot && minBoot.instance.whatsappServiceKey) { min.whatsAppDirectLine = new WhatsappDirectLine( min, min.botId, diff --git a/packages/core.gbapp/services/GBSSR.ts b/packages/core.gbapp/services/GBSSR.ts index 1c295869..f08a18c6 100644 --- a/packages/core.gbapp/services/GBSSR.ts +++ b/packages/core.gbapp/services/GBSSR.ts @@ -286,7 +286,7 @@ export class GBSSR { const onlyChars = /\/([A-Za-z0-9\-\_]+)\/*/.exec(req.originalUrl); - let botId = (req.originalUrl && req.originalUrl === '/') || onlyChars.length === 0 ? minBoot.botId : onlyChars[1]; + let botId = (req.originalUrl && req.originalUrl === '/') || onlyChars ? onlyChars[1] : minBoot.botId; let min: GBMinInstance = req.url === '/'