Skip to content

Commit

Permalink
fix(whatsapp.gblib): SEND FILE and WPP providers.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigorodriguez committed Sep 4, 2022
2 parents 5261691 + faccecf commit 05260c0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 20 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
39 changes: 20 additions & 19 deletions packages/whatsapp.gblib/services/WhatsappDirectLine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
}
}
}
Expand Down Expand Up @@ -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}`);
}
}
}

Expand Down Expand Up @@ -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.
}
}
}
}
Expand Down

0 comments on commit 05260c0

Please sign in to comment.