fix(whatsapp.gblib): Applied WhatsApp-web-js patch.

This commit is contained in:
Rodrigo Rodriguez 2023-11-03 11:39:50 -03:00
parent 693e12300d
commit 316b5262ee
4 changed files with 6 additions and 6 deletions

View file

@ -181,7 +181,7 @@
"vm2-process": "2.1.1",
"walk-promise": "0.2.0",
"washyourmouthoutwithsoap": "1.0.2",
"whatsapp-web.js": "1.16.4-alpha.0",
"whatsapp-web.js": "https://github.com/Julzk/whatsapp-web.js/tarball/jkr_hotfix_7",
"winston": "3.8.2",
"winston-logs-display": "1.0.0",
"ws": "8.12.1",

View file

@ -607,7 +607,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
const resChannel = await httpClient.sendRequest(req);
const key = JSON.parse(resChannel.bodyAsText).properties.properties.sites[0].key;
instance.webchatKey = key;
instance.whatsappBotKey = key;
instance.webchatKey = key;
resolve(instance);
} catch (error) {
reject(error);

View file

@ -746,7 +746,7 @@ export class GBMinService {
min.whatsAppDirectLine = new WhatsappDirectLine(
min,
min.botId,
min.instance.whatsappBotKey,
min.instance.webchatKey,
min.instance.whatsappServiceKey,
min.instance.whatsappServiceNumber,
min.instance.whatsappServiceUrl,
@ -759,7 +759,7 @@ export class GBMinService {
min.whatsAppDirectLine = new WhatsappDirectLine(
min,
min.botId,
min.instance.whatsappBotKey,
min.instance.webchatKey,
minBoot.instance.whatsappServiceKey,
minBoot.instance.whatsappServiceNumber,
minBoot.instance.whatsappServiceUrl,

View file

@ -123,7 +123,7 @@ export class WhatsappDirectLine extends GBService {
const client = await new SwaggerClient({
spec: JSON.parse(Fs.readFileSync('directline-3.0.json', 'utf8')),
requestInterceptor: req => {
req.headers['Authorization'] = `Bearer ${this.min.instance.whatsappBotKey}`;
req.headers['Authorization'] = `Bearer ${this.min.instance.webchatKey}`;
}
});
this.directLineClient = client;
@ -318,7 +318,7 @@ export class WhatsappDirectLine extends GBService {
// If there is a number specified, checks if it
// is related to a custom bot and reroutes immediately.
if (newThis !== this && newThis.min.botId !== GBServer.globals.minBoot.botId) {
if (newThis && newThis !== this && newThis.min.botId !== GBServer.globals.minBoot.botId) {
await newThis.received(req, res);
return;