new(whatsapp.gblib): Multiple providers can be loaded at once.
This commit is contained in:
parent
17616c636e
commit
a6c3d7db6a
2 changed files with 12 additions and 9 deletions
|
@ -320,6 +320,10 @@ export class GBMinService {
|
||||||
this.createCheckHealthAddress(GBServer.globals.server, min, min.instance);
|
this.createCheckHealthAddress(GBServer.globals.server, min, min.instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static isChatAPI(req) {
|
||||||
|
return req.body.phone_id ? false : true;
|
||||||
|
}
|
||||||
|
|
||||||
private async WhatsAppCallback(req, res) {
|
private async WhatsAppCallback(req, res) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -330,7 +334,7 @@ export class GBMinService {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let chatapi = GBConfigService.get('CHATAPI') === 'true';
|
let chatapi = GBMinService.isChatAPI(req);
|
||||||
|
|
||||||
if (chatapi) {
|
if (chatapi) {
|
||||||
if (req.body.ack) {
|
if (req.body.ack) {
|
||||||
|
|
|
@ -87,7 +87,7 @@ export class WhatsappDirectLine extends GBService {
|
||||||
this.whatsappServiceKey = whatsappServiceKey;
|
this.whatsappServiceKey = whatsappServiceKey;
|
||||||
this.whatsappServiceNumber = whatsappServiceNumber;
|
this.whatsappServiceNumber = whatsappServiceNumber;
|
||||||
this.whatsappServiceUrl = whatsappServiceUrl;
|
this.whatsappServiceUrl = whatsappServiceUrl;
|
||||||
this.chatapi = GBConfigService.get('CHATAPI') === 'true';
|
this.chatapi = whatsappServiceNumber.indexOf(':') > -1 ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async asyncForEach(array, callback) {
|
public static async asyncForEach(array, callback) {
|
||||||
|
@ -305,7 +305,6 @@ export class WhatsappDirectLine extends GBService {
|
||||||
await this.sendToDeviceEx(user.userSystemId, answerText, locale, null);
|
await this.sendToDeviceEx(user.userSystemId, answerText, locale, null);
|
||||||
|
|
||||||
return; // Exit here.
|
return; // Exit here.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.type === 'ptt') {
|
if (message.type === 'ptt') {
|
||||||
|
|
Loading…
Add table
Reference in a new issue