Send view-once media, circular video notes and albums with typed options
One attachment pipeline now exposes media-specific presentation options and convenient audio, voice-note and GIF helpers.
OpenWA 5.5 makes attachment presentation explicit. sendFile and sendImage share the native attachment pipeline, and their options object selects the behaviors valid for each media type. Captions and quoted-message IDs now belong in that object.
Choose the presentation
await client.sendFile(chatId, './photo.jpg', 'photo.jpg', {
type: 'image', caption: 'Hello', viewOnce: true,
});
await client.sendFile(chatId, './square-note.mp4', 'note.mp4', {
type: 'video', videoNote: true,
});
await client.sendFile(chatId, './photo.jpg', 'original.jpg', {
type: 'document', caption: 'Original file',
});
The type discriminator limits valid combinations. Images and ordinary videos can be view once. View-once audio must be a voice note (ptt: true); documents and ordinary audio attachments can't use it. Document presentation keeps the supplied MIME type and filename while giving the attachment document behavior.
Circular video notes use WhatsApp's PTV type. Supply a prepared square MP4 with a positive duration of at most 60 seconds. The API doesn't crop or shorten it, and video notes have no caption and can't also be GIFs. A circular note can be view once.
Use convenient helpers
await client.sendAudio(chatId, './sound.mp3');
await client.sendPtt(chatId, './voice.ogg', { viewOnce: true });
await client.sendVideoAsGif(chatId, './loop.mp4');
GIF-style WhatsApp messages carry MP4 video with a playback flag. Supply the prepared MP4; this API doesn't convert a .gif file or transcode other media. GIF-style messages can't be view once. Ogg Opus is suitable prepared input for voice notes.
The helpers accept paths, URLs, data URLs, base64 or buffers through the shared pipeline. Recognized filenames and signatures help identify generic binary input. An unknown file defaults to a document. sendFileFromUrl takes presentation options and a separate download-headers object for authenticated media URLs.
Handle albums and contacts
sendAlbum groups supported images, videos and GIF videos with a caption. Its result can report partial submission, so inspect the structured result instead of treating every album as one atomic send. getAlbumMessages(messageId) returns currently loaded children of an incoming album; that snapshot may be incomplete.
Contact helpers include sendContact, sendMultipleContacts and sendVCard. Status posting remains subject to its licence requirements; ordinary attachment options don't enable licensed status functionality.
A returned ID or native completion result confirms submission, not recipient delivery. Follow onAck for later acknowledgements. If a connection drops during upload, inspect the conversation before repeating an uncertain send.
Read the media guide for the complete option table and examples, and the messaging reference for album inputs and result models.