Media Client API
Generated client method reference for the media namespace.
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
| Prop | Value |
|---|---|
| Return type | Promise<DataURL> |
| DataURL | View 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
| Prop | Value |
|---|---|
| Namespace | media |
| Action | read |
| Functionality | both |
| Positional parameter order | message |
| Aliases | media.decrypt |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | POST | /api/media/decrypt | decryptMedia | Active |
| Alias | POST | /api/decryptMedia | decryptMedia | Active |
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
| Prop | Value |
|---|---|
| Return type | Promise<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
| Prop | Value |
|---|---|
| Namespace | media |
| Action | read |
| Functionality | both |
| Positional parameter order | message, path |
| Aliases | media.download |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | POST | /api/media/download | downloadMedia | Active |
| Alias | POST | /api/downloadMedia | downloadMedia | Active |
Was this helpful?
Your answer includes the page path and docs version.
