fix(WhatsappDirectLine): refactor large file upload process to improve error handling and add public URL registration
Some checks are pending
GBCI / build (push) Waiting to run

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2025-06-11 09:33:34 -03:00
parent 51831d2f24
commit b0517c9c94
2 changed files with 16 additions and 16 deletions

View file

@ -665,18 +665,18 @@ export class GBConversationalService {
let data: any = {
name: template,
components: [
{
type: 'header',
parameters: [
{
type: mediaType
}
]
}
components: [
// {
// type: 'header',
// parameters: [
// {
// type: mediaType
// }
// ]
// }
]
};
data['components'][0]['parameters'][0][mediaType] = { link: urlMedia };
//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

@ -856,16 +856,16 @@ export class WhatsappDirectLine extends GBService {
text = text.replace(/\n/g, '\\n');
// Upload the media file based on media type
const handleMedia = await min.whatsAppDirectLine.uploadLargeFile(min, packagePath);
//const handleMedia = await min.whatsAppDirectLine.uploadLargeFile(min, packagePath);
let data: any = {
name: template,
components: [
{
type: 'HEADER',
format: mediaType.toUpperCase(), // Use IMAGE or VIDEO format
example: { header_handle: [handleMedia] }
},
// {
// type: 'HEADER',
// format: mediaType.toUpperCase(), // Use IMAGE or VIDEO format
// example: { header_handle: [handleMedia] }
// },
{
type: 'BODY',
text: text