diff --git a/src/api/integrations/channel/meta/whatsapp.business.service.ts b/src/api/integrations/channel/meta/whatsapp.business.service.ts index 170410663..b6500a0cb 100644 --- a/src/api/integrations/channel/meta/whatsapp.business.service.ts +++ b/src/api/integrations/channel/meta/whatsapp.business.service.ts @@ -799,6 +799,8 @@ export class BusinessStartupService extends ChannelStartupService { return await this.post(content, 'messages'); } if (message['media']) { + const isImage = message['mimetype']?.startsWith('image/'); + content = { messaging_product: 'whatsapp', recipient_type: 'individual', @@ -807,12 +809,13 @@ export class BusinessStartupService extends ChannelStartupService { [message['mediaType']]: { [message['type']]: message['id'], preview_url: linkPreview, + ...(message['fileName'] && !isImage && { filename: message['fileName'] }), caption: message['caption'], }, }; quoted ? (content.context = { message_id: quoted.id }) : content; return await this.post(content, 'messages'); - } + } if (message['audio']) { content = { messaging_product: 'whatsapp',