fix(whatsapp.gblib): Fix broadcasts.
This commit is contained in:
parent
7b2c9238d3
commit
32c5c004f3
1 changed files with 38 additions and 42 deletions
|
@ -642,9 +642,6 @@ export class GBConversationalService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async fillAndBroadcastTemplate(min: GBMinInstance, mobile: string, text) {
|
public async fillAndBroadcastTemplate(min: GBMinInstance, mobile: string, text) {
|
||||||
if (text.startsWith('broadcastx')) {
|
|
||||||
await this.sendToMobile(min, mobile, { name: text }, null);
|
|
||||||
} else {
|
|
||||||
let isMedia =
|
let isMedia =
|
||||||
text.toLowerCase().endsWith('.jpg') ||
|
text.toLowerCase().endsWith('.jpg') ||
|
||||||
text.toLowerCase().endsWith('.jpeg') ||
|
text.toLowerCase().endsWith('.jpeg') ||
|
||||||
|
@ -662,10 +659,10 @@ export class GBConversationalService {
|
||||||
text = text.replace(/\n/g, '\\n');
|
text = text.replace(/\n/g, '\\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
let template = isMedia ? image.replace(/\.[^/.]+$/, "") : 'broadcast1'
|
let template = isMedia ? image.replace(/\.[^/.]+$/, '') : 'broadcast1';
|
||||||
|
|
||||||
let data: any = {
|
let data: any = {
|
||||||
name: template ,
|
name: template,
|
||||||
components: [
|
components: [
|
||||||
{
|
{
|
||||||
type: 'header',
|
type: 'header',
|
||||||
|
@ -695,7 +692,6 @@ export class GBConversationalService {
|
||||||
await this.sendToMobile(min, mobile, data, null);
|
await this.sendToMobile(min, mobile, data, null);
|
||||||
GBLogEx.info(min, `Sending answer file to mobile: ${mobile}. Header: ${urlImage}`);
|
GBLogEx.info(min, `Sending answer file to mobile: ${mobile}. Header: ${urlImage}`);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// tslint:enable:no-unsafe-any
|
// tslint:enable:no-unsafe-any
|
||||||
|
|
||||||
public async sendMarkdownToMobile(min: GBMinInstance, step: GBDialogStep, mobile: string, text: string) {
|
public async sendMarkdownToMobile(min: GBMinInstance, step: GBDialogStep, mobile: string, text: string) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue