open-wa
DocsAPI reference

Media Client API

Generated client method reference for the media namespace.

Media Client API

This page documents 2 schema-registry client methods in the media namespace.

decryptMedia

Decrypts media from a message

Signature client.decryptMedia(message: { ack: -1 \| 0 \| 1 \| 2 \| 3 \| 4; author?: string; body: string; broadcast?: boolean; caption?: string; chat: { ack?: any; contact: { formattedName?: string; id: string; isBusiness?: boolean; isEnterprise?: boolean; isMe?: boolean; isMyContact?: boolean; isOnline?: boolean; isPSA?: boolean; isUser?: boolean; isWAContact?: boolean; labels?: string[]; lastSeen?: number; msgs?: any[]; name?: string; profilePicThumbObj?: { eurl?: string; id?: { _serialized: string; server: string; user: string }; img?: string; imgFull?: string; tag?: string }; pushname?: string; shortName?: string; statusMute?: boolean; type?: string; verifiedLevel?: number; verifiedName?: string }; formattedTitle?: string; groupMetadata?: { announce?: boolean; creation: number; desc?: string; descOwner?: string; descTime?: number; id: string; owner?: string; participants: { id: string; isAdmin: boolean; isSuperAdmin?: boolean }[]; restrict?: boolean; subject: string }; id: string; isGroup: boolean; isReadOnly?: boolean; lastReceivedKey?: any; msgs?: any[]; muteExpiration?: number; name?: string; notSpam?: boolean; pin?: number; presence?: object; t?: number; unreadCount?: number }; chatId: string; clientUrl?: string; content: string; deprecatedMms3Url?: string; from: string; fromMe: boolean; id: string; invis?: boolean; isForwarded?: boolean; isGroupMsg: boolean; isMedia: boolean; isMMS?: boolean; isNewMsg?: boolean; isNotification: boolean; isPSA?: boolean; isQuotedMsgAvailable: boolean; labels?: string[]; mentionedJidList?: string[]; notifyName?: string; quotedMsg?: any; quotedMsgObj?: any; recvFresh?: boolean; self: "in" \| "out"; sender: { formattedName?: string; id: string; isBusiness?: boolean; isEnterprise?: boolean; isMe?: boolean; isMyContact?: boolean; isOnline?: boolean; isPSA?: boolean; isUser?: boolean; isWAContact?: boolean; labels?: string[]; lastSeen?: number; msgs?: any[]; name?: string; profilePicThumbObj?: { eurl?: string; id?: { _serialized: string; server: string; user: string }; img?: string; imgFull?: string; tag?: string }; pushname?: string; shortName?: string; statusMute?: boolean; type?: string; verifiedLevel?: number; verifiedName?: string }; senderId?: string; star?: boolean; t: number; timestamp: number; to: string; type: "chat" \| "audio" \| "ptt" \| "image" \| "video" \| "document" \| "sticker" \| "location" \| "vcard" \| "multi_vcard" \| "revoked" \| "order" \| "buttons_response" \| "list_response" \| "unknown" }): Promise<DataURL>

Usage

// Use the full media message from your message handler.
const result = await client.decryptMedia(message);

Parameters

Prop

Type

Returns

PropValue
Return typePromise<DataURL>
DataURLView fields

Resolves to DataURL. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<DataURL>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacemedia
Actionread
Functionalityboth
Positional parameter ordermessage
Aliasesmedia.decrypt
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/media/decryptdecryptMediaActive
AliasPOST/api/decryptMediadecryptMediaActive

downloadMedia

Downloads and decrypts media from a message to a file

Signature client.downloadMedia(message: { ack: -1 \| 0 \| 1 \| 2 \| 3 \| 4; author?: string; body: string; broadcast?: boolean; caption?: string; chat: { ack?: any; contact: { formattedName?: string; id: string; isBusiness?: boolean; isEnterprise?: boolean; isMe?: boolean; isMyContact?: boolean; isOnline?: boolean; isPSA?: boolean; isUser?: boolean; isWAContact?: boolean; labels?: string[]; lastSeen?: number; msgs?: any[]; name?: string; profilePicThumbObj?: { eurl?: string; id?: { _serialized: string; server: string; user: string }; img?: string; imgFull?: string; tag?: string }; pushname?: string; shortName?: string; statusMute?: boolean; type?: string; verifiedLevel?: number; verifiedName?: string }; formattedTitle?: string; groupMetadata?: { announce?: boolean; creation: number; desc?: string; descOwner?: string; descTime?: number; id: string; owner?: string; participants: { id: string; isAdmin: boolean; isSuperAdmin?: boolean }[]; restrict?: boolean; subject: string }; id: string; isGroup: boolean; isReadOnly?: boolean; lastReceivedKey?: any; msgs?: any[]; muteExpiration?: number; name?: string; notSpam?: boolean; pin?: number; presence?: object; t?: number; unreadCount?: number }; chatId: string; clientUrl?: string; content: string; deprecatedMms3Url?: string; from: string; fromMe: boolean; id: string; invis?: boolean; isForwarded?: boolean; isGroupMsg: boolean; isMedia: boolean; isMMS?: boolean; isNewMsg?: boolean; isNotification: boolean; isPSA?: boolean; isQuotedMsgAvailable: boolean; labels?: string[]; mentionedJidList?: string[]; notifyName?: string; quotedMsg?: any; quotedMsgObj?: any; recvFresh?: boolean; self: "in" \| "out"; sender: { formattedName?: string; id: string; isBusiness?: boolean; isEnterprise?: boolean; isMe?: boolean; isMyContact?: boolean; isOnline?: boolean; isPSA?: boolean; isUser?: boolean; isWAContact?: boolean; labels?: string[]; lastSeen?: number; msgs?: any[]; name?: string; profilePicThumbObj?: { eurl?: string; id?: { _serialized: string; server: string; user: string }; img?: string; imgFull?: string; tag?: string }; pushname?: string; shortName?: string; statusMute?: boolean; type?: string; verifiedLevel?: number; verifiedName?: string }; senderId?: string; star?: boolean; t: number; timestamp: number; to: string; type: "chat" \| "audio" \| "ptt" \| "image" \| "video" \| "document" \| "sticker" \| "location" \| "vcard" \| "multi_vcard" \| "revoked" \| "order" \| "buttons_response" \| "list_response" \| "unknown" }, path: string): Promise<string>

Usage

// Use the full media message from your message handler.
const result = await client.downloadMedia(message, "./downloaded-media");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<string>

Path to the saved file

In-process Client resolves to Promise<string>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property. Path to the saved file

Advanced method metadata

Overview

PropValue
Namespacemedia
Actionread
Functionalityboth
Positional parameter ordermessage, path
Aliasesmedia.download
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/media/downloaddownloadMediaActive
AliasPOST/api/downloadMediadownloadMediaActive

Was this helpful?

Your answer includes the page path and docs version.

On this page