Skip to content

Commit

Permalink
Merge pull request #1131 from FaelN1/develop
Browse files Browse the repository at this point in the history
fix: include filename in media message payload for WhatsApp Business
  • Loading branch information
DavidsonGomes authored Jan 6, 2025
2 parents 6212ee3 + e0c960c commit 18626c9
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down

0 comments on commit 18626c9

Please sign in to comment.