[core] Fix send voice
This commit is contained in:
1 parent
1260fe34aa
commit
7d73b96b78
5 files changed
+8
-11
No files matched your search
@@ -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"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user