diff --git a/docs/site/content/en/docs/how-to/send-messages/index.md b/docs/site/content/en/docs/how-to/send-messages/index.md index d8de13bc..1df33de1 100644 --- a/docs/site/content/en/docs/how-to/send-messages/index.md +++ b/docs/site/content/en/docs/how-to/send-messages/index.md @@ -273,6 +273,8 @@ You can send voice messages in two ways: 1. Provide a URL for the voice. 2. Encode the whole file content into base64 and send it in the request body. +Please make sure your file has **OPUS** encoding and packed in OGG container. + #### URL ```json { @@ -280,8 +282,7 @@ You can send voice messages in two ways: "chatId": "11111111111@c.us", "file": { "mimetype": "audio/ogg; codecs=opus", - "filename": "voice-message.mp3", - "url": "https://github.com/devlikeapro/whatsapp-http-api/raw/core/examples/dev.likeapro.mp3" + "url": "https://github.com/devlikeapro/whatsapp-http-api/raw/core/examples/dev.likeapro.opus" }, "caption": "string" } @@ -319,7 +320,7 @@ You can send voice messages in two ways: "file": { "mimetype": "video/mp4", "filename": "video.mp4", - "url": "https://github.com/devlikeapro/whatsapp-http-api/raw/core/examples/dev.likeapro.mp3" + "url": "https://github.com/devlikeapro/whatsapp-http-api/raw/core/examples/video.mp4" } } ``` diff --git a/examples/dev.likeapro.mp3 b/examples/dev.likeapro.mp3 deleted file mode 100644 index 3205fdbd..00000000 Binary files a/examples/dev.likeapro.mp3 and /dev/null differ diff --git a/examples/dev.likeapro.opus b/examples/dev.likeapro.opus new file mode 100644 index 00000000..fab7a8e6 Binary files /dev/null and b/examples/dev.likeapro.opus differ diff --git a/src/structures/chatting.dto.ts b/src/structures/chatting.dto.ts index 5b1869a6..dcfa6ddf 100644 --- a/src/structures/chatting.dto.ts +++ b/src/structures/chatting.dto.ts @@ -171,8 +171,8 @@ export class MessageLocationRequest extends ChatRequest { class FileRequest extends ChatRequest { @ApiProperty({ oneOf: [ - { $ref: getSchemaPath(BinaryFile) }, { $ref: getSchemaPath(RemoteFile) }, + { $ref: getSchemaPath(BinaryFile) }, ], }) file: BinaryFile | RemoteFile; @@ -190,8 +190,8 @@ export class MessageFileRequest extends FileRequest { export class MessageVoiceRequest extends ChatRequest { @ApiProperty({ oneOf: [ - { $ref: getSchemaPath(VoiceBinaryFile) }, { $ref: getSchemaPath(VoiceRemoteFile) }, + { $ref: getSchemaPath(VoiceBinaryFile) }, ], }) file: VoiceBinaryFile | VoiceRemoteFile; diff --git a/src/structures/files.dto.ts b/src/structures/files.dto.ts index 2d4ef19e..9ac3728a 100644 --- a/src/structures/files.dto.ts +++ b/src/structures/files.dto.ts @@ -1,4 +1,5 @@ import { ApiProperty } from '@nestjs/swagger'; + export class Base64File { mimetype: string; data: string; @@ -70,14 +71,9 @@ export class VoiceRemoteFile { }) mimetype = 'audio/ogg; codecs=opus'; - @ApiProperty({ - description: 'Document file name. Optional', - }) - filename = 'voice-message.mp3'; - @ApiProperty({ example: - 'https://github.com/devlikeapro/whatsapp-http-api/raw/core/examples/dev.likeapro.mp3', + 'https://github.com/devlikeapro/whatsapp-http-api/raw/core/examples/dev.likeapro.opus', }) url: string; }