From 14b3ff1fe1b7c56e182c09802735a54b77c363b0 Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Tue, 11 Jun 2024 23:24:29 -0300 Subject: [PATCH] new(basic.gblib): New batch features. --- .../services/GBConversationalService.ts | 2 ++ .../services/WhatsappDirectLine.ts | 17 ++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/core.gbapp/services/GBConversationalService.ts b/packages/core.gbapp/services/GBConversationalService.ts index 85fdb41c..424349df 100644 --- a/packages/core.gbapp/services/GBConversationalService.ts +++ b/packages/core.gbapp/services/GBConversationalService.ts @@ -698,7 +698,9 @@ export class GBConversationalService { } GBLogEx.info(min, `Sending answer file to mobile: ${mobile}. Header: ${urlImage}`); + await this.sendToMobile(min, mobile, data, null); + } // tslint:enable:no-unsafe-any diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index 3deba32c..bf8da2b0 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -226,13 +226,6 @@ export class WhatsappDirectLine extends GBService { if (setUrl && options && this.whatsappServiceUrl) { GBServer.globals.server.use(`/audios`, express.static('work')); - - if (options) { - try { - } catch (error) { - GBLog.error(`Error initializing 3rd party Whatsapp provider(1) ${error.message}`); - } - } } } @@ -612,7 +605,7 @@ export class WhatsappDirectLine extends GBService { watermark = response.obj.watermark; await this.printMessages(response.obj.activities, conversationId, from, fromName); } catch (error) { - GBLog.error(`Error calling printMessages on Whatsapp channel ${JSON.stringify(error)}`); + GBLog.error(`Error calling printMessages on Whatsapp channel ${GBUtil.toYAML(error)}`); } }; setInterval(worker, this.pollInterval); @@ -739,6 +732,7 @@ export class WhatsappDirectLine extends GBService { } public async sendToDevice(to: any, msg: string, conversationId) { + try{ const cmd = '/audio '; let url; let chatId = WhatsappDirectLine.chatIds[conversationId]; @@ -823,6 +817,11 @@ export class WhatsappDirectLine extends GBService { } } } + try { + } catch (error) { + GBLog.error(`GBWhatsApp ERR: ${GBUtil.toYAML(error)}`); + } + } public async sendToDeviceEx(to, text, locale, conversationId) { @@ -1092,7 +1091,7 @@ export class WhatsappDirectLine extends GBService { } } } catch (error) { - GBLog.error(`Error on Whatsapp callback: ${JSON.stringify(error)}`); + GBLog.error(`Error on Whatsapp callback: ${GBUtil.toYAML(error)}`); } } }