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 activeMin;
|
||||||
let botId = req.params.botId;
|
|
||||||
if (botId === '[default]' || botId === undefined) {
|
let botId;
|
||||||
botId = GBConfigService.get('BOT_ID');
|
|
||||||
|
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}.`);
|
GBLog.info(`Client requested instance for: ${botId}.`);
|
||||||
|
|
|
@ -51,6 +51,7 @@ export class WhatsappDirectLine extends GBService {
|
||||||
|
|
||||||
public static conversationIds = {};
|
public static conversationIds = {};
|
||||||
public static mobiles = {};
|
public static mobiles = {};
|
||||||
|
public static phones = {};
|
||||||
public static chatIds = {};
|
public static chatIds = {};
|
||||||
public static usernames = {};
|
public static usernames = {};
|
||||||
public static state = {}; // 2: Waiting, 3: MessageArrived.
|
public static state = {}; // 2: Waiting, 3: MessageArrived.
|
||||||
|
@ -133,6 +134,7 @@ export class WhatsappDirectLine extends GBService {
|
||||||
|
|
||||||
let url = `${this.INSTANCE_URL}/${productId}/setWebhook`;
|
let url = `${this.INSTANCE_URL}/${productId}/setWebhook`;
|
||||||
let webhook = `${GBServer.globals.publicAddress}/webhooks/whatsapp/${this.botId}`;
|
let webhook = `${GBServer.globals.publicAddress}/webhooks/whatsapp/${this.botId}`;
|
||||||
|
WhatsappDirectLine.phones[phoneId] = this.botId;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
url: url,
|
url: url,
|
||||||
|
|
Loading…
Add table
Reference in a new issue