new(whatsapp.gblib): Multiple providers can be loaded at once.

This commit is contained in:
Rodrigo Rodriguez 2022-07-09 11:20:00 -03:00
parent 6c0ce4fa10
commit cad03e145e

View file

@ -132,13 +132,16 @@ export class WhatsappDirectLine extends GBService {
let phoneId = this.whatsappServiceNumber.split(';')[0]; let phoneId = this.whatsappServiceNumber.split(';')[0];
let productId = this.whatsappServiceNumber.split(';')[1] let productId = this.whatsappServiceNumber.split(';')[1]
let url = `${this.INSTANCE_URL}/${productId}/setWebhook`; let url = `${this.INSTANCE_URL}/${phoneId}/config`;
WhatsappDirectLine.phones[phoneId] = this.botId; WhatsappDirectLine.phones[phoneId] = this.botId;
options = { options = {
url: url, url: url,
method: 'POST', method: 'POST',
body: { webhook: `${GBServer.globals.publicAddress}/webhooks/whatsapp/${this.botId}` }, body: {
webhook: `${GBServer.globals.publicAddress}/webhooks/whatsapp/${this.botId}`,
"ack_delivery": false
},
headers: { headers: {
'x-maytapi-key': this.whatsappServiceKey, 'x-maytapi-key': this.whatsappServiceKey,
'Content-Type': 'application/json', 'Content-Type': 'application/json',