new(whatsapp.gblib): New provider.
This commit is contained in:
parent
3edf06e73b
commit
8d3ee08a9f
2 changed files with 14 additions and 4 deletions
|
@ -365,9 +365,17 @@ export class GBMinService {
|
|||
}
|
||||
|
||||
let activeMin;
|
||||
let botId = req.params.botId;
|
||||
if (botId === '[default]' || botId === undefined) {
|
||||
botId = GBConfigService.get('BOT_ID');
|
||||
|
||||
let botId;
|
||||
|
||||
if (chatapi) {
|
||||
botId = req.params.botId;
|
||||
if (botId === '[default]' || botId === undefined) {
|
||||
botId = GBConfigService.get('BOT_ID');
|
||||
}
|
||||
}
|
||||
else {
|
||||
botId = WhatsappDirectLine.phones[req.body.phoneId];
|
||||
}
|
||||
|
||||
GBLog.info(`Client requested instance for: ${botId}.`);
|
||||
|
@ -508,7 +516,7 @@ export class GBMinService {
|
|||
await minInstance.whatsAppDirectLine.received(req, res);
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
|
||||
GBLog.error(`Error on Whatsapp callback: ${error.data ? error.data : error}`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ export class WhatsappDirectLine extends GBService {
|
|||
|
||||
public static conversationIds = {};
|
||||
public static mobiles = {};
|
||||
public static phones = {};
|
||||
public static chatIds = {};
|
||||
public static usernames = {};
|
||||
public static state = {}; // 2: Waiting, 3: MessageArrived.
|
||||
|
@ -133,6 +134,7 @@ export class WhatsappDirectLine extends GBService {
|
|||
|
||||
let url = `${this.INSTANCE_URL}/${productId}/setWebhook`;
|
||||
let webhook = `${GBServer.globals.publicAddress}/webhooks/whatsapp/${this.botId}`;
|
||||
WhatsappDirectLine.phones[phoneId] = this.botId;
|
||||
|
||||
options = {
|
||||
url: url,
|
||||
|
|
Loading…
Add table
Reference in a new issue