open-wa logoopen-wa
DocsAPI reference

Messages Client API

Generated client method reference for the messages namespace.

Messages Client API

This page documents 47 schema-registry client methods in the messages namespace.

deleteMessage

Deletes a message

Signature client.deleteMessage(chatId: string, messageId: string[] \| string, onlyLocal?: boolean): Promise<boolean>

Usage

const result = await client.deleteMessage("447123456789@c.us", ["false_447123456789@c.us_ABC123","false_447123456789@c.us_DEF456"]);

Parameters

Prop

Type

Returns

PropValue
Return typePromise<boolean>

Resolves to boolean: true means the runtime accepted the operation and false means it did not complete. Provider-side revoke can still be rejected, so the value is not proof that every recipient removed the message. A rejected Promise indicates input validation or dispatch failure.

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actiondelete
Functionalityboth
Positional parameter orderchatId, messageId, onlyLocal
Aliasesmessages.delete
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryDELETE/api/messages/deletedeleteMessageActive
AliasDELETE/api/deleteMessagedeleteMessageActive

editMessage

Edits the text of a message through the installed private patch

Signature client.editMessage(messageId: string, newContent: string): Promise<boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.editMessage({
  messageId: "false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB",
  newContent: "newContent",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<boolean>

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

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionupdate
Functionalityboth
Positional parameter ordermessageId, newContent
Aliasesmessages.edit
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/messages/editeditMessageActive
AliasPUT/api/editMessageeditMessageActive

forwardMessages

Forwards messages to a chat

Signature client.forwardMessages(to: string, messages: string[] \| string, skipMyMessages?: boolean): Promise<MessageIdReturn[] \| boolean>

Usage

const result = await client.forwardMessages("447123456789@c.us", ["false_447123456789@c.us_ABC123","false_447123456789@c.us_DEF456"]);

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn[] | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn[] \| boolean. A rejected Promise indicates input validation or dispatch failure.

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, messages, skipMyMessages
Aliasesmessages.forward
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/forwardforwardMessagesActive
AliasPOST/api/forwardMessagesforwardMessagesActive

getAlbumMessages

Returns currently loaded image and video messages associated with an album, including GIF videos. The album can arrive before its media, so the array may be incomplete. Returns false if the album is not loaded or the ID belongs to another message type.

Signature client.getAlbumMessages(messageId: string): Promise<Message[] \| false>

Usage

const result = await client.getAlbumMessages("false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<Message[] | false>
MessageView fields

A snapshot of currently loaded album media. An empty or partial array does not mean that the sender sent an empty or partial album. Each item retains its caption and can be passed to decryptMedia or downloadMedia.

In-process Client resolves to Promise<Message[] \| false>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property. A snapshot of currently loaded album media. An empty or partial array does not mean that the sender sent an empty or partial album. Each item retains its caption and can be passed to decryptMedia or downloadMedia.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionread
Functionalityboth
Positional parameter ordermessageId
Aliasesmessages.getAlbum
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/messages/getAlbumgetAlbumMessagesActive
AliasGET/api/getAlbumMessagesgetAlbumMessagesActive

getAllMessages

Retrieves all messages in the session

Signature client.getAllMessages(chatId?: string, includeMe?: boolean, includeNotifications?: boolean): Promise<Message[]>

Usage

const result = await client.getAllMessages();

Parameters

Prop

Type

Returns

PropValue
Return typePromise<Message[]>
MessageView fields

Resolves to Message[]. A rejected Promise indicates input validation or dispatch failure.

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionread
Functionalityboth
Positional parameter orderchatId, includeMe, includeNotifications
AliaseslistMessages, messages.all, messages.getAll, messages.list
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/messages/getAllgetAllMessagesActive
AliasGET/api/getAllMessagesgetAllMessagesActive
AliasGET/api/listMessageslistMessagesActive
AliasGET/api/messages/allmessages.allActive
AliasGET/api/messages/listmessages.listActive

getMessageById

Retrieves a specific message by ID

Signature client.getMessageById(messageId: string): Promise<Message \| null \| false>

Usage

const result = await client.getMessageById("false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<Message | null | false>
MessageView fields

Resolves to Message \| null \| false. A rejected Promise indicates input validation or dispatch failure.

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionread
Functionalityboth
Positional parameter ordermessageId
AliasesgetMessage, messages.get, messages.getById
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/messages/getgetMessageByIdActive
AliasGET/api/getMessagegetMessageActive
AliasGET/api/getMessageByIdgetMessageByIdActive
AliasGET/api/messages/getByIdmessages.getByIdActive

getMessageInfo

Get message delivery info

Signature client.getMessageInfo(messageId: string): Promise<MessageInfo>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.getMessageInfo({
  messageId: "false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageInfo>
MessageInfoView fields

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

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionread
Functionalityboth
Positional parameter ordermessageId
Aliasesmessages.getInfo
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/messages/getInfogetMessageInfoActive
AliasGET/api/getMessageInfogetMessageInfoActive

getMessagesForLLM

Get messages formatted for LLMs

Signature client.getMessagesForLLM(chatId: string, last?: number): Promise<LLMMessage[]>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.getMessagesForLLM({
  chatId: "447123456789@c.us",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<LLMMessage[]>
LLMMessageView fields

Resolves to LLMMessage[]. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionread
Functionalityboth
Positional parameter orderchatId, last
AliasesgetGptArray, messages.getForLLM, messages.getGptArray
Deprecated aliasesgetGptArray, messages.getGptArray
Licensenone
WAPI overridegetGptArray
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/messages/getForLLMgetMessagesForLLMActive
Deprecated aliasGET/api/getGptArraygetGptArrayDeprecated
AliasGET/api/getMessagesForLLMgetMessagesForLLMActive
Deprecated aliasGET/api/messages/getGptArraymessages.getGptArrayDeprecated

getMyLastMessage

Get last message sent by host

Signature client.getMyLastMessage(chatId?: string): Promise<Message \| undefined>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.getMyLastMessage();

Parameters

Prop

Type

Returns

PropValue
Return typePromise<Message | undefined>
MessageView fields

Resolves to Message \| undefined. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionread
Functionalityboth
Positional parameter orderchatId
Aliasesmessages.getMyLast
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/messages/getMyLastgetMyLastMessageActive
AliasGET/api/getMyLastMessagegetMyLastMessageActive

getPollResults

Hydrates the local poll vote store and returns synced counts, choices and votes. Hidden-voter polls omit voter identities and the votes array. Unsynced votes may be absent.

Signature client.getPollResults(messageId: string): Promise<PollResults>

Usage

const result = await client.getPollResults("false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<PollResults>
PollResultsView fields

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

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionget
Functionalityboth
Positional parameter ordermessageId
Aliasesmessages.getPollResults
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/getPollResultsgetPollResultsActive
AliasPOST/api/getPollResultsgetPollResultsActive
Insiders

getStarredMessages

Get starred messages

Signature client.getStarredMessages(chatId?: string): Promise<Message[]>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.getStarredMessages();

Parameters

Prop

Type

Returns

PropValue
Return typePromise<Message[]>
MessageView fields

Resolves to Message[]. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionread
Functionalityboth
Positional parameter orderchatId
Aliasesmessages.getStarred
Deprecated aliases-
Licenseinsiders
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/messages/getStarredgetStarredMessagesActive
AliasGET/api/getStarredMessagesgetStarredMessagesActive

getUnsentMessages

Get unsent/pending messages

Signature client.getUnsentMessages(): Promise<Message[]>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.getUnsentMessages();

Parameters

This method does not define input parameters.

Returns

PropValue
Return typePromise<Message[]>
MessageView fields

Resolves to Message[]. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionread
Functionalityboth
Positional parameter order-
Aliasesmessages.getUnsent
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/messages/getUnsentgetUnsentMessagesActive
AliasGET/api/getUnsentMessagesgetUnsentMessagesActive

getVCards

Extract vCards from message

Signature client.getVCards(messageId: string): Promise<string[]>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.getVCards({
  messageId: "false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<string[]>

Resolves to string[]. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionread
Functionalityboth
Positional parameter ordermessageId
Aliasesmessages.getVCards
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/messages/getVCardsgetVCardsActive
AliasGET/api/getVCardsgetVCardsActive

loadEarlierMessages

Loads earlier messages from a chat

Signature client.loadEarlierMessages(chatId: string, count?: number, includeMe?: boolean): Promise<Message[]>

Usage

const result = await client.loadEarlierMessages("447123456789@c.us");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<Message[]>
MessageView fields

Resolves to Message[]. A rejected Promise indicates input validation or dispatch failure.

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionread
Functionalityboth
Positional parameter orderchatId, count, includeMe
AliasesloadOlderMessages, messages.loadEarlier, messages.loadOlder
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/loadEarlierloadEarlierMessagesActive
AliasPOST/api/loadEarlierMessagesloadEarlierMessagesActive
AliasPOST/api/loadOlderMessagesloadOlderMessagesActive
AliasPOST/api/messages/loadOldermessages.loadOlderActive

pinMessage

Pins a message in its chat for everyone, subject to native permissions. This differs from pinChat, which changes the current account chat list.

Signature client.pinMessage(messageId: string, duration?: "OneDay" \| "SevenDays" \| "ThirtyDays"): Promise<boolean>

Usage

const result = await client.pinMessage("false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<boolean>

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

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionset
Functionalityboth
Positional parameter ordermessageId, duration
Aliasesmessages.pin
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/pinpinMessageActive
AliasPOST/api/pinMessagepinMessageActive

react

React to message with emoji

Signature client.react(messageId: string, emoji: string): Promise<boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.react({
  messageId: "false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB",
  emoji: "emoji",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<boolean>

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

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter ordermessageId, emoji
Aliasesmessages.react
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/reactreactActive
AliasPOST/api/reactreactActive
Insiders

sendAdvancedButtons

Sends an advanced button message with media (deprecated)

Signature client.sendAdvancedButtons(to: string, body?: string \| any, buttons: any[], text: string, footer: string, filename: string): Promise<MessageIdReturn \| boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.sendAdvancedButtons({
  to: "447123456789@c.us",
  buttons: [],
  text: "text",
  footer: "footer",
  filename: "filename",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, body, buttons, text, footer, filename
Aliasesmessages.sendAdvancedButtons
Deprecated aliases-
Licenseinsiders
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendAdvancedButtonssendAdvancedButtonsActive
AliasPOST/api/sendAdvancedButtonssendAdvancedButtonsActive

sendAlbum

Sends images and videos together as a native WhatsApp album with one caption on its first item. GIFs use MP4 video data with isGif: true. Documents are rejected. Phone-number IDs are resolved to LIDs; the destination chat must already be loaded and allow sending. WhatsApp controls the minimum item count and upload limits. Runtime failures include the parent and submitted child IDs when available; inspect the chat before retrying.

Signature client.sendAlbum(to: string, media: { file: string; filename: string; isGif?: boolean }[], caption?: string, quotedMsgId?: string): Promise<AlbumSendResult>

Usage

import { readFile } from 'node:fs/promises';

// Put these real image files in your process working directory.
const media = await Promise.all(['photo-1.jpg', 'photo-2.jpg', 'photo-3.jpg', 'photo-4.jpg'].map(async filename => ({
  filename,
  file: `data:image/jpeg;base64,${(await readFile(filename)).toString('base64')}`,
})));

const result = await client.sendAlbum('447123456789@c.us', media, 'One caption for the album');

Parameters

Prop

Type

Returns

PropValue
Return typePromise<AlbumSendResult>
AlbumSendResultView fields

Submitted album parent and child message IDs, in input order. Submission does not confirm recipient delivery. Runtime failures include the album ID and submitted child IDs when available. A lost connection can leave the send outcome unknown; inspect the chat before retrying.

In-process Client resolves to Promise<AlbumSendResult>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property. Submitted album parent and child message IDs, in input order. Submission does not confirm recipient delivery. Runtime failures include the album ID and submitted child IDs when available. A lost connection can leave the send outcome unknown; inspect the chat before retrying.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, media, caption, quotedMsgId
Aliasesmessages.sendAlbum
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendAlbumsendAlbumActive
AliasPOST/api/sendAlbumsendAlbumActive

sendAudio

Sends an audio attachment with an optional quoted message. Use sendPtt for voice notes and view-once audio.

Signature client.sendAudio(to: string, file: string, filename?: string, options?: { quotedMsgId?: string }): Promise<MessageIdReturn \| boolean>

Usage

const result = await client.sendAudio("447123456789@c.us", "data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAA...");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, file, filename, options
Aliasesmessages.sendAudio
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendAudiosendAudioActive
AliasPOST/api/sendAudiosendAudioActive

sendBanner

Sends a banner image

Signature client.sendBanner(to: string, base64: string): Promise<MessageIdReturn \| boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.sendBanner({
  to: "447123456789@c.us",
  base64: "base64",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, base64
Aliasesmessages.sendBanner
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendBannersendBannerActive
AliasPOST/api/sendBannersendBannerActive
Insiders

sendButtons

Sends a button message (deprecated)

Signature client.sendButtons(to: string, body?: string \| any, buttons: any[], title?: string, footer?: string): Promise<MessageIdReturn \| boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.sendButtons({
  to: "447123456789@c.us",
  buttons: [],
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, body, buttons, title, footer
Aliasesmessages.sendButtons
Deprecated aliases-
Licenseinsiders
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendButtonssendButtonsActive
AliasPOST/api/sendButtonssendButtonsActive

sendContact

Sends a single contact

Signature client.sendContact(to: string, contactId: string \| string[]): Promise<MessageIdReturn \| boolean \| (MessageIdReturn \| boolean)[]>

Usage

const result = await client.sendContact("447123456789@c.us", "447123456789@c.us");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean | (MessageIdReturn | boolean)[]>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean \| (MessageIdReturn \| boolean)[]. A rejected Promise indicates input validation or dispatch failure.

In-process Client resolves to Promise<MessageId \| boolean \| (MessageId \| boolean)[]>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, contactId
Aliasesmessages.sendContact
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendContactsendContactActive
AliasPOST/api/sendContactsendContactActive

sendFile

Sends an image, video, audio file or document using MIME detection or an explicit typed presentation. Incompatible options are rejected before sending. Media is not transcoded.

Signature client.sendFile(to: string, file: string, filename?: string, options?: { caption?: string; quotedMsgId?: string; type?: "auto"; viewOnce?: boolean } \| { caption?: string; quotedMsgId?: string; type: "image"; viewOnce?: boolean } \| { caption?: string; isGif?: boolean; quotedMsgId?: string; type: "video"; videoNote?: boolean; viewOnce?: boolean } \| { ptt?: boolean; quotedMsgId?: string; type: "audio"; viewOnce?: boolean } \| { caption?: string; quotedMsgId?: string; type: "document" }): Promise<MessageIdReturn \| boolean>

Usage

const result = await client.sendFile("447123456789@c.us", "data:application/pdf;base64,JVBERi0xLjQK...");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, file, filename, options
Aliasesmessages.sendFile
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendFilesendFileActive
AliasPOST/api/sendFilesendFileActive

sendFileFromUrl

Downloads media and sends it through sendFile with the same typed presentation options.

Signature client.sendFileFromUrl(to: string, url: string, filename?: string, options?: { caption?: string; quotedMsgId?: string; type?: "auto"; viewOnce?: boolean } \| { caption?: string; quotedMsgId?: string; type: "image"; viewOnce?: boolean } \| { caption?: string; isGif?: boolean; quotedMsgId?: string; type: "video"; videoNote?: boolean; viewOnce?: boolean } \| { ptt?: boolean; quotedMsgId?: string; type: "audio"; viewOnce?: boolean } \| { caption?: string; quotedMsgId?: string; type: "document" }, headers?: object): Promise<MessageIdReturn \| string \| boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.sendFileFromUrl({
  to: "447123456789@c.us",
  url: "url",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | string | boolean>
MessageIdReturnView fields

Message ID or success status

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API. Message ID or success status

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, url, filename, options, headers
Aliasesmessages.sendFileFromUrl
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendFileFromUrlsendFileFromUrlActive
AliasPOST/api/sendFileFromUrlsendFileFromUrlActive

sendImage

Sends media through the native attachment pipeline, including images and videos. Options select presentation, view once, GIF playback or circular video notes; media is not transcoded. Returns submission status, not a delivery receipt.

Signature client.sendImage(to: string, file: string, filename?: string, options?: { caption?: string; quotedMsgId?: string; type?: "auto"; viewOnce?: boolean } \| { caption?: string; quotedMsgId?: string; type: "image"; viewOnce?: boolean } \| { caption?: string; isGif?: boolean; quotedMsgId?: string; type: "video"; videoNote?: boolean; viewOnce?: boolean } \| { ptt?: boolean; quotedMsgId?: string; type: "audio"; viewOnce?: boolean } \| { caption?: string; quotedMsgId?: string; type: "document" }): Promise<MessageIdReturn \| boolean>

Usage

const result = await client.sendImage("447123456789@c.us", "data:application/pdf;base64,JVBERi0xLjQK...");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, file, filename, options
Aliasesmessages.sendImage
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendImagesendImageActive
AliasPOST/api/sendImagesendImageActive
Insiders

sendInteractive

Send a portable interactive message document (Insiders and above)

Signature client.sendInteractive(to: string, content: { actions: ({ id: string; label: string; type: "reply" } \| { label: string; type: "url"; url: string } \| { label: string; phoneNumber: string; type: "call" } \| { code: string; label: string; type: "copy" })[]; body: string; footer?: string; header?: { text: string; type: "text" } \| { filename?: string; source: string; title?: string; type: "image" } \| { filename?: string; source: string; title?: string; type: "video" } \| { filename?: string; source: string; title?: string; type: "document" }; type: "buttons"; version?: 1 } \| { body: string; buttonLabel: string; footer?: string; sections: { rows: { description?: string; id: string; title: string }[]; title?: string }[]; title?: string; type: "list"; version?: 1 } \| { body: string; footer?: string; questions: ({ allowCustomAnswer?: boolean; id: string; label: string; options: { id: string; label: string }[]; type: "singleSelect" \| "multiSelect" })[]; title?: string; type: "form"; version?: 1 } \| { body: string; cards: ({ actions: ({ id: string; label: string; type: "reply" } \| { label: string; type: "url"; url: string } \| { label: string; phoneNumber: string; type: "call" } \| { code: string; label: string; type: "copy" })[]; body: string; header: { filename?: string; source: string; title?: string; type: "image" } })[]; footer?: string; type: "carousel"; version?: 1 } \| { actions?: ({ label: string; type: "url"; url: string } \| { label: string; phoneNumber: string; type: "call" } \| { code: string; label: string; type: "copy" })[]; body: string; booking: { description?: string; email?: string; endAt?: string; labels?: { addToCalendar?: string; detailsTitle?: string; language?: string; manageBooking?: string; meetingType?: string; viewOnMap?: string }; location?: string; managementUrl?: string; phoneNumber?: string; startAt: string; url?: string }; buttonLabel: string; footer?: string; title?: string; type: "booking"; version?: 1 } \| { actions: { name: string; parameters?: object }[]; body: string; footer?: string; header?: { text: string; type: "text" } \| { filename?: string; source: string; title?: string; type: "image" } \| { filename?: string; source: string; title?: string; type: "video" } \| { filename?: string; source: string; title?: string; type: "document" }; parameters?: object; type: "native"; version?: 1 }): Promise<string>

Usage

const result = await client.sendInteractive("447123456789@c.us", {});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<string>

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

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, content
Aliasesmessages.sendInteractive
Deprecated aliases-
Licenseinsiders
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendInteractivesendInteractiveActive
AliasPOST/api/sendInteractivesendInteractiveActive

sendLinkWithAutoPreview

Sends a link with auto-generated preview

Signature client.sendLinkWithAutoPreview(to: string, url: string, text?: string, thumbnail?: string, quotedMsgId?: string, customSize?: { height: number; width: number }): Promise<MessageIdReturn \| boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.sendLinkWithAutoPreview({
  to: "447123456789@c.us",
  url: "url",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, url, text, thumbnail, quotedMsgId, customSize
Aliasesmessages.sendLink, messages.sendLinkWithAutoPreview, sendLink
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendLinkWithAutoPreviewsendLinkWithAutoPreviewActive
AliasPOST/api/messages/sendLinkmessages.sendLinkActive
AliasPOST/api/sendLinksendLinkActive
AliasPOST/api/sendLinkWithAutoPreviewsendLinkWithAutoPreviewActive
Insiders

sendListMessage

Sends a list/menu message (deprecated)

Signature client.sendListMessage(to: string, sections: any[], title: string, description: string, actionText: string): Promise<MessageIdReturn \| boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.sendListMessage({
  to: "447123456789@c.us",
  sections: [],
  title: "title",
  description: "description",
  actionText: "actionText",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, sections, title, description, actionText
Aliasesmessages.sendList, sendList
Deprecated aliases-
Licenseinsiders
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendListsendListMessageActive
AliasPOST/api/sendListsendListActive
AliasPOST/api/sendListMessagesendListMessageActive

sendLocation

Sends a location to a chat

Signature client.sendLocation(to: string, lat: number \| string, lng: number \| string, loc?: string, address?: string, url?: string): Promise<MessageIdReturn \| boolean>

Usage

const result = await client.sendLocation("447123456789@c.us", 51.5074, -0.1278);

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, lat, lng, loc, address, url
Aliasesmessages.sendLocation
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendLocationsendLocationActive
AliasPOST/api/sendLocationsendLocationActive

sendMessageWithThumb

Sends a link preview message with custom thumbnail

Signature client.sendMessageWithThumb(thumb: string, url: string, title: string, description: string, content: string, to: string, quotedMsgId?: string, customSize?: { height: number; width: number }): Promise<MessageIdReturn \| boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.sendMessageWithThumb({
  thumb: "thumb",
  url: "url",
  title: "title",
  description: "description",
  content: "Hello, world!",
  to: "447123456789@c.us",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderthumb, url, title, description, content, to, quotedMsgId, customSize
Aliasesmessages.sendLinkWithThumbnail, messages.sendWithThumb, sendLinkWithThumbnail
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendLinkWithThumbnailsendMessageWithThumbActive
AliasPOST/api/messages/sendWithThumbmessages.sendWithThumbActive
AliasPOST/api/sendLinkWithThumbnailsendLinkWithThumbnailActive
AliasPOST/api/sendMessageWithThumbsendMessageWithThumbActive

sendMultipleContacts

Sends multiple contacts

Signature client.sendMultipleContacts(to: string, contactIds: string[]): Promise<MessageIdReturn \| boolean>

Usage

const result = await client.sendMultipleContacts("447123456789@c.us", ["447123456789@c.us"]);

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, contactIds
Aliasesmessages.sendContacts, messages.sendMultipleContacts, sendContacts
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendContactssendMultipleContactsActive
AliasPOST/api/messages/sendMultipleContactsmessages.sendMultipleContactsActive
AliasPOST/api/sendContactssendContactsActive
AliasPOST/api/sendMultipleContactssendMultipleContactsActive

sendPaymentRequest

Sends a payment request message

Signature client.sendPaymentRequest(to: string, amount: number, currency: string, message?: string): Promise<MessageIdReturn \| boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.sendPaymentRequest({
  to: "447123456789@c.us",
  amount: 1,
  currency: "currency",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, amount, currency, message
Aliasesmessages.sendPaymentRequest
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendPaymentRequestsendPaymentRequestActive
AliasPOST/api/sendPaymentRequestsendPaymentRequestActive

sendPoll

Sends a text poll with a selection limit, quote, optional closing time in Unix milliseconds and hidden voter names. Closing time and hidden names require native WhatsApp support for the sending account/chat. These fields select the native V6 poll payload.

Signature client.sendPoll(to: string, name: string, options: string[], config?: { endTime?: number; hideVoterNames?: boolean; quotedMsgId?: string; selectableCount?: number }): Promise<MessageIdReturn \| boolean>

Usage

const result = await client.sendPoll("447123456789@c.us", "name", ["Yes", "No"]);

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, name, options, config
Aliasesmessages.sendPoll
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendPollsendPollActive
AliasPOST/api/sendPollsendPollActive

sendPtt

Sends prepared audio as a voice note, optionally view once. It does not transcode the input; use suitable voice-note audio such as Ogg Opus.

Signature client.sendPtt(to: string, file: string, options?: { quotedMsgId?: string; viewOnce?: boolean }): Promise<MessageIdReturn \| boolean>

Usage

const result = await client.sendPtt("447123456789@c.us", "data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAA...");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, file, options
Aliasesmessages.sendPtt, messages.sendVoiceNote, sendVoiceNote
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendPttsendPttActive
AliasPOST/api/messages/sendVoiceNotemessages.sendVoiceNoteActive
AliasPOST/api/sendPttsendPttActive
AliasPOST/api/sendVoiceNotesendVoiceNoteActive
Insiders

sendRawMessage

Send a constructed WhatsApp protobuf Message payload (Insiders and above); media must already be uploaded

Signature client.sendRawMessage(to: string, payload: object): Promise<string>

Usage

const result = await client.sendRawMessage("447123456789@c.us", {});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<string>

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

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, payload
Aliasesmessages.sendRaw
Deprecated aliases-
Licenseinsiders
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendRawsendRawMessageActive
AliasPOST/api/sendRawMessagesendRawMessageActive

sendReplyWithMentions

Sends a reply to a message that includes @mentions

Signature client.sendReplyWithMentions(to: string, content: string, replyMessageId: string, hideTags?: boolean, mentions?: string[]): Promise<MessageIdReturn \| boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.sendReplyWithMentions({
  to: "447123456789@c.us",
  content: "Hello, world!",
  replyMessageId: "false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, content, replyMessageId, hideTags, mentions
Aliasesmessages.sendReplyWithMentions
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendReplyWithMentionssendReplyWithMentionsActive
AliasPOST/api/sendReplyWithMentionssendReplyWithMentionsActive

sendSeen

Mark message as seen

Signature client.sendSeen(chatId: string): Promise<boolean>

Usage

const result = await client.sendSeen("447123456789@c.us");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<boolean>

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

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionupdate
Functionalityboth
Positional parameter orderchatId
Aliasesmessages.sendSeen
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/messages/sendSeensendSeenActive
AliasPUT/api/sendSeensendSeenActive

sendSticker

Render a sticker locally using automatic whole-job backend selection and ordered effects, then submit through the private donor finalizer. Author and pack labels are configurable; donor app links are owned by the installed patch. Returns a submitted message ID, not a delivery receipt. Unknown send outcomes must be reconciled before retrying.

Signature client.sendSticker(to: string, input: string, job?: { author?: string; backend?: "auto" \| "browser" \| "standalone"; background?: string; circle?: boolean; effects?: (string \| { name: string; options?: object })[]; fit?: "contain" \| "cover"; fps?: number; loopCount?: number; pack?: string; quality?: number; quotedMsgId?: string; trim?: number[] }): Promise<MessageId>

Usage

const result = await client.sendSticker("447123456789@c.us", "input");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageId>
MessageIdView fields

Validated serialized message ID. This confirms the send returned an ID, not delivery or reading.

In-process Client resolves to Promise<MessageId>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property. Validated serialized message ID. This confirms the send returned an ID, not delivery or reading.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, input, job
Aliasesmessages.sendSticker
Deprecated aliases-
Licensenone
WAPI overridesendStickerJob
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendStickersendStickerActive
AliasPOST/api/sendStickersendStickerActive

sendText

Sends a text message and returns a validated serialized message ID. The in-process Client throws SendTextError on failure. An unknown outcome means the message may have been sent: check the chat before retrying. Starting a chat with a new number requires an applied restricted or premium license.

Signature client.sendText(to: string, content: string, options?: unknown): Promise<MessageId>

Start with await client.sendText(to, content). The registry still accepts an optional options value for compatibility, but the current Client implementation ignores it. Use reply(to, content, messageId) for quoted replies and sendTextWithMentions(to, content, hideTags, mentions) for mentions.

Usage

const messageId = await client.sendText('447123456789@c.us', 'Hello from open-wa');
console.log('Message ID:', messageId);

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageId>
MessageIdView fields

Resolves to a validated serialized MessageId string, not a delivery or read receipt. The in-process Client throws SendTextError, exported by @open-wa/wa-automate and @open-wa/client, on failure. Its code is INVALID_ARGUMENT, LICENSE_REQUIRED, SEND_REJECTED, INVALID_SEND_RESULT, or SEND_FAILED. Its outcome is not_sent for invalid arguments and known runtime rejections, or unknown when the runtime returns no valid ID or browser evaluation fails. An unknown outcome means the message may already have been sent: check the chat before retrying. The client never retries automatically. Starting a chat with a new number still requires an applied restricted or premium license. HTTP and remote clients expose failures through their own error envelopes.

In-process Client resolves to Promise<MessageId>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property. Validated serialized message ID. This confirms the send returned an ID, not delivery or reading.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, content, options
Aliasesmessages.sendText
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendTextsendTextActive
AliasPOST/api/sendTextsendTextActive

sendTextWithMentions

Sends a text message that includes @mentions

Signature client.sendTextWithMentions(to: string, content: string, hideTags?: boolean, mentions?: string[]): Promise<MessageIdReturn \| boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.sendTextWithMentions({
  to: "447123456789@c.us",
  content: "Hello, world!",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, content, hideTags, mentions
Aliasesmessages.sendTextWithMentions
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendTextWithMentionssendTextWithMentionsActive
AliasPOST/api/sendTextWithMentionssendTextWithMentionsActive

sendVCard

Sends a contact card (vCard)

Signature client.sendVCard(to: string, vcard: string, contactName?: string, contactNumber?: string): Promise<MessageIdReturn \| boolean>

Usage

const result = await client.sendVCard("447123456789@c.us", "vcard");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, vcard, contactName, contactNumber
Aliasesmessages.sendVCard
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendVCardsendVCardActive
AliasPOST/api/sendVCardsendVCardActive

sendVideoAsGif

Sends MP4 video with WhatsApp GIF playback. GIF is a video presentation flag; this method does not convert a GIF image or transcode video.

Signature client.sendVideoAsGif(to: string, file: string, filename?: string, options?: { caption?: string; quotedMsgId?: string }): Promise<MessageIdReturn \| boolean>

Usage

const result = await client.sendVideoAsGif("447123456789@c.us", "data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21...");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, file, filename, options
Aliasesmessages.sendVideoAsGif
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendVideoAsGifsendVideoAsGifActive
AliasPOST/api/sendVideoAsGifsendVideoAsGifActive

Sends a YouTube link with auto-generated preview

Signature client.sendYouTubeLink(to: string, url: string, text?: string, thumbnail?: string, quotedMsgId?: string, customSize?: { height: number; width: number }): Promise<MessageIdReturn \| boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.sendYouTubeLink({
  to: "447123456789@c.us",
  url: "url",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<MessageIdReturn | boolean>
MessageIdReturnView fields

Resolves to MessageIdReturn \| boolean. A rejected Promise indicates input validation or dispatch failure.

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter orderto, url, text, thumbnail, quotedMsgId, customSize
Aliasesmessages.sendYoutubeLink, messages.sendYouTubeLink, sendYoutubeLink
Deprecated aliasesmessages.sendYoutubeLink, sendYoutubeLink
Licensenone
WAPI overridesendYoutubeLink
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/sendYouTubeLinksendYouTubeLinkActive
Deprecated aliasPOST/api/messages/sendYoutubeLinkmessages.sendYoutubeLinkDeprecated
Deprecated aliasPOST/api/sendYoutubeLinksendYoutubeLinkDeprecated
AliasPOST/api/sendYouTubeLinksendYouTubeLinkActive

starMessage

Star a message

Signature client.starMessage(messageId: string): Promise<boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.starMessage({
  messageId: "false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<boolean>

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

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionupdate
Functionalityboth
Positional parameter ordermessageId
Aliasesmessages.star
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/messages/starstarMessageActive
AliasPUT/api/starMessagestarMessageActive

unpinMessage

Removes a message pin for everyone, subject to native chat permissions.

Signature client.unpinMessage(messageId: string): Promise<boolean>

Usage

const result = await client.unpinMessage("false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB");

Parameters

Prop

Type

Returns

PropValue
Return typePromise<boolean>

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

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionset
Functionalityboth
Positional parameter ordermessageId
Aliasesmessages.unpin
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/unpinunpinMessageActive
AliasPOST/api/unpinMessageunpinMessageActive

unstarMessage

Unstar a message

Signature client.unstarMessage(messageId: string): Promise<boolean>

Usage

import { SocketClient } from '@open-wa/socket-client';

const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.unstarMessage({
  messageId: "false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB",
});

Parameters

Prop

Type

Returns

PropValue
Return typePromise<boolean>

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

This method is not declared on the in-process Client facade. Use the remote Node.js client or HTTP API.

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionupdate
Functionalityboth
Positional parameter ordermessageId
Aliasesmessages.unstar
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/messages/unstarunstarMessageActive
AliasPUT/api/unstarMessageunstarMessageActive

voteOnPoll

Votes using option IDs returned by getPollResults; an empty array removes the current vote. The poll must be open and allow this account to vote.

Signature client.voteOnPoll(messageId: string, optionIds: number[]): Promise<boolean>

Usage

const result = await client.voteOnPoll("false_447123456789@c.us_9C4D0965EA5C09D591334AB6BDB07FEB", []);

Parameters

Prop

Type

Returns

PropValue
Return typePromise<boolean>

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

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

Advanced method metadata

Overview

PropValue
Namespacemessages
Actionsend
Functionalityboth
Positional parameter ordermessageId, optionIds
Aliasesmessages.voteOnPoll
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPOST/api/messages/voteOnPollvoteOnPollActive
AliasPOST/api/voteOnPollvoteOnPollActive

Was this helpful?

Your answer includes the page path and docs version.

On this page

deleteMessageUsageParametersReturnsOverviewRouteseditMessageUsageParametersReturnsOverviewRoutesforwardMessagesUsageParametersReturnsOverviewRoutesgetAlbumMessagesUsageParametersReturnsOverviewRoutesgetAllMessagesUsageParametersReturnsOverviewRoutesgetMessageByIdUsageParametersReturnsOverviewRoutesgetMessageInfoUsageParametersReturnsOverviewRoutesgetMessagesForLLMUsageParametersReturnsOverviewRoutesgetMyLastMessageUsageParametersReturnsOverviewRoutesgetPollResultsUsageParametersReturnsOverviewRoutesgetStarredMessagesUsageParametersReturnsOverviewRoutesgetUnsentMessagesUsageParametersReturnsOverviewRoutesgetVCardsUsageParametersReturnsOverviewRoutesloadEarlierMessagesUsageParametersReturnsOverviewRoutespinMessageUsageParametersReturnsOverviewRoutesreactUsageParametersReturnsOverviewRoutessendAdvancedButtonsUsageParametersReturnsOverviewRoutessendAlbumUsageParametersReturnsOverviewRoutessendAudioUsageParametersReturnsOverviewRoutessendBannerUsageParametersReturnsOverviewRoutessendButtonsUsageParametersReturnsOverviewRoutessendContactUsageParametersReturnsOverviewRoutessendFileUsageParametersReturnsOverviewRoutessendFileFromUrlUsageParametersReturnsOverviewRoutessendImageUsageParametersReturnsOverviewRoutessendInteractiveUsageParametersReturnsOverviewRoutessendLinkWithAutoPreviewUsageParametersReturnsOverviewRoutessendListMessageUsageParametersReturnsOverviewRoutessendLocationUsageParametersReturnsOverviewRoutessendMessageWithThumbUsageParametersReturnsOverviewRoutessendMultipleContactsUsageParametersReturnsOverviewRoutessendPaymentRequestUsageParametersReturnsOverviewRoutessendPollUsageParametersReturnsOverviewRoutessendPttUsageParametersReturnsOverviewRoutessendRawMessageUsageParametersReturnsOverviewRoutessendReplyWithMentionsUsageParametersReturnsOverviewRoutessendSeenUsageParametersReturnsOverviewRoutessendStickerUsageParametersReturnsOverviewRoutessendTextUsageParametersReturnsOverviewRoutessendTextWithMentionsUsageParametersReturnsOverviewRoutessendVCardUsageParametersReturnsOverviewRoutessendVideoAsGifUsageParametersReturnsOverviewRoutessendYouTubeLinkUsageParametersReturnsOverviewRoutesstarMessageUsageParametersReturnsOverviewRoutesunpinMessageUsageParametersReturnsOverviewRoutesunstarMessageUsageParametersReturnsOverviewRoutesvoteOnPollUsageParametersReturnsOverviewRoutes