fix(whatsapp.gblib): .gbapp message subprocessing.
This commit is contained in:
parent
e72b030e95
commit
c14a766047
1 changed files with 28 additions and 25 deletions
|
@ -227,11 +227,12 @@ export class WhatsappDirectLine extends GBService {
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
GBServer.globals.server.use(`/audios`, express.static('work'));
|
GBServer.globals.server.use(`/audios`, express.static('work'));
|
||||||
|
|
||||||
|
if (options) {
|
||||||
try {
|
try {
|
||||||
const res = await request.post(options);
|
await request.post(options);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
GBLog.error(`Error initializing 3rd party Whatsapp provider(1) ${error.message}`);
|
GBLog.error(`Error initializing 3rd party Whatsapp provider(1) ${error.message}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -698,12 +699,14 @@ export class WhatsappDirectLine extends GBService {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
try {
|
if (options) {
|
||||||
// tslint:disable-next-line: await-promise
|
try {
|
||||||
const result = await request.post(options);
|
// tslint:disable-next-line: await-promise
|
||||||
GBLog.info(`File ${url} sent to ${to}: ${result}`);
|
const result = await request.post(options);
|
||||||
} catch (error) {
|
GBLog.info(`File ${url} sent to ${to}: ${result}`);
|
||||||
GBLog.error(`Error sending file to Whatsapp provider ${error.message}`);
|
} catch (error) {
|
||||||
|
GBLog.error(`Error sending file to Whatsapp provider ${error.message}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -742,13 +745,13 @@ export class WhatsappDirectLine extends GBService {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (options) {
|
||||||
|
try {
|
||||||
// tslint:disable-next-line: await-promise
|
const result = await request.post(options);
|
||||||
const result = await request.post(options);
|
GBLog.info(`Audio ${url} sent to ${to}: ${result}`);
|
||||||
GBLog.info(`Audio ${url} sent to ${to}: ${result}`);
|
} catch (error) {
|
||||||
} catch (error) {
|
GBLog.error(`Error sending audio message to Whatsapp provider ${error.message}`);
|
||||||
GBLog.error(`Error sending audio message to Whatsapp provider ${error.message}`);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -817,16 +820,16 @@ export class WhatsappDirectLine extends GBService {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
if (options) {
|
||||||
GBLog.info(`Message [${msg}] is being sent to ${to}...`);
|
try {
|
||||||
// tslint:disable-next-line: await-promise
|
GBLog.info(`Message [${msg}] is being sent to ${to}...`);
|
||||||
if (this.provider !== "GeneralBots") {
|
|
||||||
await request.post(options);
|
await request.post(options);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
catch (error) {
|
||||||
GBLog.error(`Error sending message to Whatsapp provider ${error.message}`);
|
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.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue