fix(whatsapp.gblib): SEND FILE and WPP providers.
This commit is contained in:
commit
05260c0ee5
3 changed files with 36 additions and 20 deletions
15
CHANGELOG.md
15
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)
|
||||
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -237,14 +237,15 @@ export class WhatsappDirectLine extends GBService {
|
|||
const express = require('express');
|
||||
GBServer.globals.server.use(`/audios`, express.static('work'));
|
||||
|
||||
|
||||
if (options) {
|
||||
try {
|
||||
const res = await request.post(options);
|
||||
await request.post(options);
|
||||
} catch (error) {
|
||||
GBLog.error(`Error initializing 3rd party Whatsapp provider(1) ${error.message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async resetConversationId(botId, number, group = '') {
|
||||
WhatsappDirectLine.conversationIds[botId + number + group] = undefined;
|
||||
|
@ -754,15 +755,15 @@ export class WhatsappDirectLine extends GBService {
|
|||
break;
|
||||
}
|
||||
|
||||
if (options) {
|
||||
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}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async sendTextAsAudioToDevice(to, msg, chatId) {
|
||||
|
||||
|
@ -829,19 +830,19 @@ export class WhatsappDirectLine extends GBService {
|
|||
break;
|
||||
}
|
||||
|
||||
if (options) {
|
||||
try {
|
||||
GBLog.info(`Message [${msg}] is being sent to ${to}...`);
|
||||
// tslint:disable-next-line: await-promise
|
||||
if (this.provider !== "GeneralBots") {
|
||||
await request.post(options);
|
||||
}
|
||||
} catch (error) {
|
||||
catch (error) {
|
||||
GBLog.error(`Error sending message to Whatsapp provider ${error.message}`);
|
||||
|
||||
// TODO: Handle Error: socket hang up and retry.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async sendToDeviceEx(to, text, locale, conversationId) {
|
||||
text = await this.min.conversationalService.translate(
|
||||
|
|
Loading…
Add table
Reference in a new issue