new(basic.gblib): Video in WPP templates.

This commit is contained in:
Rodrigo Rodriguez 2024-09-05 15:28:21 -03:00
parent b09222ca0c
commit 2b09b58d4b
2 changed files with 4 additions and 5 deletions

View file

@ -651,8 +651,8 @@ export class GBConversationalService {
text.toLowerCase().endsWith('.png') ||
text.toLowerCase().endsWith('.mp4') ||
text.toLowerCase().endsWith('.mov');
let mediaType = text.toLowerCase().endsWith('.mp4') || text.toLowerCase().endsWith('.mov') ? 'video' : 'image';
let mediaFile = !isMedia ? /(.*)\n/gim.exec(text)[0].trim() : text;
let mediaType = mediaFile.toLowerCase().endsWith('.mp4') || text.toLowerCase().endsWith('.mov') ? 'video' : 'image';
// Set folder based on media type
const folder = mediaType === 'video' ? 'videos' : 'images';
@ -683,7 +683,6 @@ export class GBConversationalService {
};
data['components'][0]['parameters'][0][mediaType] = { link: urlMedia };
await this.sendToMobile(min, mobile, data, null);
GBLogEx.info(min, `Sending answer file to mobile: ${mobile}. Header: ${urlMedia}`);
}

View file

@ -758,8 +758,8 @@ export class WhatsappDirectLine extends GBService {
text.toLowerCase().endsWith('.png') ||
text.toLowerCase().endsWith('.mp4') ||
text.toLowerCase().endsWith('.mov');
let mediaType = text.toLowerCase().endsWith('.mp4') || text.toLowerCase().endsWith('.mov') ? 'video' : 'image';
let mediaFile = /(.*)\n/gim.exec(text)[0].trim();
let mediaType = mediaFile.toLowerCase().endsWith('.mp4') || text.toLowerCase().endsWith('.mov') ? 'video' : 'image';
// Set folder based on media type
let folder = mediaType === 'video' ? 'videos' : 'images';