Send an audio message as a PTT, like a recorded message

Example

// PTT audio
WPP.chat.sendFileMessage(
'[number]@c.us',
'data:audio/mp3;base64,<a long base64 file...>',
{
type: 'audio',
isPtt: true // false for common audio
}
);
interface AudioMessageOptions {
    caption?: string;
    createChat?: boolean;
    delay?: number;
    detectMentioned?: boolean;
    filename?: string;
    footer?: string;
    isPtt?: boolean;
    isViewOnce?: boolean;
    markIsRead?: boolean;
    mentionedList?: (string | WAJS.whatsapp.Wid)[];
    messageId?: string | MsgKey;
    mimetype?: string;
    quotedMsg?: string | MsgKey | MsgModel;
    type: "audio";
    waitForAck?: boolean;
    waveform?: boolean;
}

Hierarchy (view full)

Properties

caption?: string
createChat?: boolean

Create a new chat to a new contact

Default

false

Example

WPP.chat.sendTextMessage('[number]@c.us', 'Hello new contact', {
createChat: true
});
delay?: number

Delay some time (in ms) before sending message While delaying, Typing Status is used to look like a human interaction

Default

0

Example

WPP.chat.sendTextMessage('[number]@c.us', 'Delay with typing', {
delay: 4000
})
detectMentioned?: boolean

Automatic detect and add the mentioned contacts with @[number]

Default

true

Example

WPP.chat.sendTextMessage('[number]@c.us', 'Hello @123 and @456', {
detectMentioned: true
});
filename?: string
footer?: string
isPtt?: boolean
isViewOnce?: boolean
markIsRead?: boolean

Automatically mark chat is read after send a message

Default

true

Example

WPP.chat.sendTextMessage('[number]@c.us', 'Replying your message', {
markIsRead: true
});
mentionedList?: (string | WAJS.whatsapp.Wid)[]

Define a mentioned list for a message This option work better with a message with mension

Example

WPP.chat.sendTextMessage('[number]@c.us', 'Hello @123 and @456', {
mentionedList: ['123@c.us', '456@c.us']
})
messageId?: string | MsgKey
mimetype?: string
quotedMsg?: string | MsgKey | MsgModel

Quote a message, like a reply message

Example

WPP.chat.sendTextMessage('[number]@c.us', 'This is a reply', {
quotedMsg: 'true_[number]@c.us_3EB0F435D95D32C4C638'
})
type: "audio"
waitForAck?: boolean

Wait for send while the ACK of message is SENT(1)

Default

true

Example

WPP.chat.sendTextMessage('[number]@c.us', 'Wait for sent', {
waitForAck: true
})
waveform?: boolean

Send an audio message as a PTT with waveform

Example

// Enable waveform
WPP.chat.sendFileMessage(
'[number]@c.us',
'data:audio/mp3;base64,<a long base64 file...>',
{
type: 'audio',
isPtt: true,
waveform: true // false to disable
}
);
// Disable waveform
WPP.chat.sendFileMessage(
'[number]@c.us',
'data:audio/mp3;base64,<a long base64 file...>',
{
type: 'audio',
isPtt: true,
waveform: false
}
);