diff --git a/backend/src/services/WbotServices/SendWhatsAppMedia.ts b/backend/src/services/WbotServices/SendWhatsAppMedia.ts index 9c07421..72760e9 100644 --- a/backend/src/services/WbotServices/SendWhatsAppMedia.ts +++ b/backend/src/services/WbotServices/SendWhatsAppMedia.ts @@ -19,13 +19,16 @@ const SendWhatsAppMedia = async ({ }: Request): Promise => { try { const wbot = await GetTicketWbot(ticket); + const hasBody = body + ? formatBody(body as string, ticket.contact) + : undefined; const newMedia = MessageMedia.fromFilePath(media.path); const sentMessage = await wbot.sendMessage( `${ticket.contact.number}@${ticket.isGroup ? "g" : "c"}.us`, newMedia, { - caption: formatBody(body as string, ticket.contact), + caption: hasBody, sendAudioAsVoice: true } ); @@ -36,6 +39,7 @@ const SendWhatsAppMedia = async ({ return sentMessage; } catch (err) { + console.log(err); throw new AppError("ERR_SENDING_WAPP_MSG"); } };