evolution-api-sdk
Version:
Unofficial SDK for the Evolution Whatsapp API v2
68 lines (65 loc) • 1.91 kB
TypeScript
import { Media } from '../../../schemas/common.js';
import { Jid, MessageId } from '../../../types/tags.js';
import { BaseMessageOptions } from './base.js';
interface VoiceMessageResponseRaw {
key: {
remoteJid: string;
id: string;
};
message: {
audioMessage: {
url: string;
mimetype: string;
fileSha256: string;
fileLength: number | string;
seconds: number;
ptt?: boolean;
mediaKey: string;
fileEncSha256: string;
directPath: string;
mediaKeyTimestamp: number | string;
waveform?: string | null;
};
};
messageTimestamp: string | Date;
}
interface VoiceMessageOptions extends BaseMessageOptions {
/**
* Audio URL or file in base64
*/
audio: Media;
/**
* Encode audio into WhatsApp default format (allows audio to be sped up)
* @default true
*/
encoding?: boolean;
}
interface VoiceMessageResponse {
receiver: {
phoneNumber: string;
jid: Jid;
};
media: {
url: string;
mimetype: string;
length: number;
durationInSeconds: number;
sha256: string;
encryptedSha256: string;
directPath: string;
/**
* Indicates whether the audio message is a push-to-talk (PTT) message
*/
isPtt?: boolean;
key: string;
keyTimestamp: Date;
waveform?: string | null;
};
messageId: MessageId;
timestamp: Date;
}
declare const VoiceMessageResponseTransform: (data: VoiceMessageResponseRaw) => VoiceMessageResponse;
declare const ResponseSchema: {
parse: (data: VoiceMessageResponseRaw) => VoiceMessageResponse;
};
export { ResponseSchema, type VoiceMessageOptions, type VoiceMessageResponse, type VoiceMessageResponseRaw, VoiceMessageResponseTransform };