diff --git a/src/api/integrations/channel/meta/whatsapp.business.service.ts b/src/api/integrations/channel/meta/whatsapp.business.service.ts index c44cbb18c..921d0e6d4 100644 --- a/src/api/integrations/channel/meta/whatsapp.business.service.ts +++ b/src/api/integrations/channel/meta/whatsapp.business.service.ts @@ -465,16 +465,23 @@ export class BusinessStartupService extends ChannelStartupService { }, }); + const audioMessage = received?.messages[0]?.audio; + if ( openAiDefaultSettings && openAiDefaultSettings.openaiCredsId && openAiDefaultSettings.speechToText && - received?.message?.audioMessage + audioMessage ) { messageRaw.message.speechToText = await this.openaiService.speechToText( openAiDefaultSettings.OpenaiCreds, - received, - this.client.updateMediaMessage, + { + message: { + mediaUrl: messageRaw.message.mediaUrl, + ...messageRaw, + } + }, + () => {}, ); } }