new(all): Custom Domain support per bot.
This commit is contained in:
parent
0aa358aa98
commit
1d6ecfb9bc
1 changed files with 61 additions and 53 deletions
|
@ -139,21 +139,18 @@ export class WhatsappDirectLine extends GBService {
|
|||
const localName = Path.join('work', gbaiName, 'profile');
|
||||
|
||||
const browser = await createBrowser(localName);
|
||||
|
||||
const createClient = (browserWSEndpoint)=>{
|
||||
const client = this.customClient = new Client({
|
||||
authStrategy: new LocalAuth({
|
||||
clientId: this.min.botId,
|
||||
dataPath: localName
|
||||
}),
|
||||
puppeteer: browser
|
||||
puppeteer: {browserWSEndpoint:browserWSEndpoint }
|
||||
});
|
||||
|
||||
|
||||
client.initialize();
|
||||
this.browserWSEndpoint = browser.wsEndpoint(); // store for later
|
||||
|
||||
browser.on('disconnected', (async () => {
|
||||
client.browser = await puppeteer.connect({browserWSEndpoint: this.browserWSEndpoint});
|
||||
}).bind(this));
|
||||
// Dispatches messages to the received method.
|
||||
|
||||
|
||||
client.on('message', (async message => {
|
||||
await this.WhatsAppCallback(message, null);
|
||||
|
@ -196,6 +193,17 @@ export class WhatsappDirectLine extends GBService {
|
|||
GBLog.info(`WhatsApp QR Code authenticated for ${this.botId}.`);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
this.browserWSEndpoint = browser.wsEndpoint(); // store for later
|
||||
|
||||
|
||||
(createClient.bind(this))(this.browserWSEndpoint);
|
||||
|
||||
browser.on('disconnected', (async () => {
|
||||
(createClient.bind(this))(this.browserWSEndpoint);
|
||||
}).bind(this));
|
||||
|
||||
setUrl = false;
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue