diff --git a/CHANGELOG.md b/CHANGELOG.md index a66498bb..439f925b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +## [2.0.174](https://github.com/GeneralBots/BotServer/compare/2.0.173...2.0.174) (2022-09-02) + + +### Bug Fixes + +* **whatsapp.gblib:** .gbapp message subprocessing. ([c14a766](https://github.com/GeneralBots/BotServer/commit/c14a766047ec1cad9e52104a52a10afb93b8fd71)) + +## [2.0.173](https://github.com/GeneralBots/BotServer/compare/2.0.172...2.0.173) (2022-09-01) + + +### Bug Fixes + +* **whatsapp.gblib:** .gbapp message subprocessing. ([e72b030](https://github.com/GeneralBots/BotServer/commit/e72b030e9554c6d442de643f73e9a3f19460973f)) +* **whatsapp.gblib:** .gbapp message subprocessing. ([9c00ddd](https://github.com/GeneralBots/BotServer/commit/9c00dddd78eeebe6ef8b156f3cc9a044c7756b1c)) + ## [2.0.172](https://github.com/GeneralBots/BotServer/compare/2.0.171...2.0.172) (2022-09-01) diff --git a/package.json b/package.json index 3889b1f7..bca8c570 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "botserver", - "version": "2.0.172", + "version": "2.0.174", "description": "General Bot Community Edition open-core server.", "main": "./boot.js", "bugs": "https://github.com/pragmatismo-io/BotServer/issues", diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index 69b2764b..1e684ab2 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -237,11 +237,12 @@ export class WhatsappDirectLine extends GBService { const express = require('express'); GBServer.globals.server.use(`/audios`, express.static('work')); - - try { - const res = await request.post(options); - } catch (error) { - GBLog.error(`Error initializing 3rd party Whatsapp provider(1) ${error.message}`); + if (options) { + try { + await request.post(options); + } catch (error) { + GBLog.error(`Error initializing 3rd party Whatsapp provider(1) ${error.message}`); + } } } } @@ -754,13 +755,13 @@ export class WhatsappDirectLine extends GBService { break; } - try { - - // tslint:disable-next-line: await-promise - const result = await request.post(options); - GBLog.info(`Audio ${url} sent to ${to}: ${result}`); - } catch (error) { - GBLog.error(`Error sending audio message to Whatsapp provider ${error.message}`); + if (options) { + try { + const result = await request.post(options); + GBLog.info(`Audio ${url} sent to ${to}: ${result}`); + } catch (error) { + GBLog.error(`Error sending audio message to Whatsapp provider ${error.message}`); + } } } @@ -829,16 +830,16 @@ export class WhatsappDirectLine extends GBService { break; } - try { - GBLog.info(`Message [${msg}] is being sent to ${to}...`); - // tslint:disable-next-line: await-promise - if (this.provider !== "GeneralBots") { + if (options) { + try { + GBLog.info(`Message [${msg}] is being sent to ${to}...`); await request.post(options); } - } catch (error) { - GBLog.error(`Error sending message to Whatsapp provider ${error.message}`); + catch (error) { + GBLog.error(`Error sending message to Whatsapp provider ${error.message}`); - // TODO: Handle Error: socket hang up and retry. + // TODO: Handle Error: socket hang up and retry. + } } } }