Chats Client API
Generated client method reference for the chats namespace.
This page documents 15 schema-registry client methods in the chats namespace.
archiveChat
Archive a chat
Signature client.archiveChat(chatId: string): Promise<boolean>
Usage
const result = await client.archiveChat("447123456789@c.us");Parameters
Prop
Type
Returns
| Prop | Value |
|---|---|
| Return type | Promise<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
| Prop | Value |
|---|---|
| Namespace | chats |
| Action | update |
| Functionality | both |
| Positional parameter order | chatId |
| Aliases | chats.archive |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | PUT | /api/chats/archive | archiveChat | Active |
| Alias | PUT | /api/archiveChat | archiveChat | Active |
clearChat
Clear chat history
Signature client.clearChat(chatId: string): Promise<boolean>
Usage
const result = await client.clearChat("447123456789@c.us");Parameters
Prop
Type
Returns
| Prop | Value |
|---|---|
| Return type | Promise<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
| Prop | Value |
|---|---|
| Namespace | chats |
| Action | delete |
| Functionality | both |
| Positional parameter order | chatId |
| Aliases | chats.clear |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | DELETE | /api/chats/clear | clearChat | Active |
| Alias | DELETE | /api/clearChat | clearChat | Active |
deleteChat
Delete a chat
Signature client.deleteChat(chatId: string): Promise<boolean>
Usage
const result = await client.deleteChat("447123456789@c.us");Parameters
Prop
Type
Returns
| Prop | Value |
|---|---|
| Return type | Promise<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
| Prop | Value |
|---|---|
| Namespace | chats |
| Action | delete |
| Functionality | both |
| Positional parameter order | chatId |
| Aliases | chats.delete |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | DELETE | /api/chats/delete | deleteChat | Active |
| Alias | DELETE | /api/deleteChat | deleteChat | Active |
getAllChats
Returns serialized Chat objects from the current session, optionally limited to chats with unread messages.
Signature client.getAllChats(withNewMessagesOnly?: boolean): Promise<Chat[]>
Usage
const result = await client.getAllChats();Parameters
Prop
Type
Returns
| Prop | Value |
|---|---|
| Return type | Promise<Chat[]> |
| Chat | View fields |
Resolves to Chat[]. A rejected Promise indicates input validation or dispatch failure.
In-process Client resolves to Promise<Chat[]>. The contract above is for the remote Node.js client; HTTP wraps that result in its data property.
Serialized chat returned by chat lookups and listings. Its id is an opaque ChatId; additional WhatsApp Web fields may be present.
Advanced method metadata
Overview
| Prop | Value |
|---|---|
| Namespace | chats |
| Action | read |
| Functionality | both |
| Positional parameter order | withNewMessagesOnly |
| Aliases | chats.all, chats.getAll, chats.list, listChats |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | GET | /api/chats/getAll | getAllChats | Active |
| Alias | GET | /api/chats/all | chats.all | Active |
| Alias | GET | /api/chats/list | chats.list | Active |
| Alias | GET | /api/getAllChats | getAllChats | Active |
| Alias | GET | /api/listChats | listChats | Active |
getChat
Get specific chat by ID
Signature client.getChat(chatId: string): Promise<Chat \| null \| undefined \| false>
Usage
const result = await client.getChat("447123456789@c.us");Parameters
Prop
Type
Returns
| Prop | Value |
|---|---|
| Return type | Promise<Chat | null | undefined | false> |
| Chat | View fields |
Resolves to Chat \| null \| undefined \| false. A rejected Promise indicates input validation or dispatch failure.
In-process Client resolves to Promise<Chat \| false \| undefined>. 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 | chats |
| Action | read |
| Functionality | both |
| Positional parameter order | chatId |
| Aliases | chats.get, chats.getById, getChatById |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | GET | /api/chats/get | getChat | Active |
| Alias | GET | /api/chats/getById | chats.getById | Active |
| Alias | GET | /api/getChat | getChat | Active |
| Alias | GET | /api/getChatById | getChatById | Active |
getChatWithNonContacts
Get chats with non-contacts
Signature client.getChatWithNonContacts(): Promise<Contact[]>
Usage
import { SocketClient } from '@open-wa/socket-client';
const client = await SocketClient.connect('http://localhost:8080', 'YOUR_API_KEY');
const result = await client.getChatWithNonContacts();Parameters
This method does not define input parameters.
Returns
| Prop | Value |
|---|---|
| Return type | Promise<Contact[]> |
| Contact | View fields |
Resolves to Contact[]. 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
| Prop | Value |
|---|---|
| Namespace | chats |
| Action | read |
| Functionality | both |
| Positional parameter order | - |
| Aliases | chats.getWithNonContacts |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | GET | /api/chats/getWithNonContacts | getChatWithNonContacts | Active |
| Alias | GET | /api/getChatWithNonContacts | getChatWithNonContacts | Active |
isChatOnline
Check if chat is online
Signature client.isChatOnline(chatId: string): Promise<boolean \| string>
Usage
const result = await client.isChatOnline("447123456789@c.us");Parameters
Prop
Type
Returns
| Prop | Value |
|---|---|
| Return type | Promise<boolean | string> |
Resolves to boolean \| string. 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
| Prop | Value |
|---|---|
| Namespace | chats |
| Action | read |
| Functionality | both |
| Positional parameter order | chatId |
| Aliases | chats.isOnline |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | GET | /api/chats/isOnline | isChatOnline | Active |
| Alias | GET | /api/isChatOnline | isChatOnline | Active |
markAsRead
Mark chat as read
Signature client.markAsRead(chatId: 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.markAsRead({
chatId: "447123456789@c.us",
});Parameters
Prop
Type
Returns
| Prop | Value |
|---|---|
| Return type | Promise<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
| Prop | Value |
|---|---|
| Namespace | chats |
| Action | update |
| Functionality | both |
| Positional parameter order | chatId |
| Aliases | chats.markAsRead |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | PUT | /api/chats/markAsRead | markAsRead | Active |
| Alias | PUT | /api/markAsRead | markAsRead | Active |
markAsUnread
Mark chat as unread
Signature client.markAsUnread(chatId: string): Promise<boolean>
Usage
const result = await client.markAsUnread("447123456789@c.us");Parameters
Prop
Type
Returns
| Prop | Value |
|---|---|
| Return type | Promise<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
| Prop | Value |
|---|---|
| Namespace | chats |
| Action | update |
| Functionality | both |
| Positional parameter order | chatId |
| Aliases | chats.markAsUnread |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | PUT | /api/chats/markAsUnread | markAsUnread | Active |
| Alias | PUT | /api/markAsUnread | markAsUnread | Active |
muteChat
Mute a chat
Signature client.muteChat(chatId: string, muteDuration: number \| string): Promise<string \| boolean \| number>
Usage
const result = await client.muteChat("447123456789@c.us", 1);Parameters
Prop
Type
Returns
| Prop | Value |
|---|---|
| Return type | Promise<string | boolean | number> |
Resolves to string \| boolean \| number. 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
| Prop | Value |
|---|---|
| Namespace | chats |
| Action | update |
| Functionality | both |
| Positional parameter order | chatId, muteDuration |
| Aliases | chats.mute |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | PUT | /api/chats/mute | muteChat | Active |
| Alias | PUT | /api/muteChat | muteChat | Active |
pinChat
Pin a chat
Signature client.pinChat(chatId: string): Promise<boolean>
Usage
const result = await client.pinChat("447123456789@c.us");Parameters
Prop
Type
Returns
| Prop | Value |
|---|---|
| Return type | Promise<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
| Prop | Value |
|---|---|
| Namespace | chats |
| Action | update |
| Functionality | both |
| Positional parameter order | chatId |
| Aliases | chats.pin |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | PUT | /api/chats/pin | pinChat | Active |
| Alias | PUT | /api/pinChat | pinChat | Active |
setChatEphemeral
Set ephemeral messages for chat
Signature client.setChatEphemeral(chatId: string, ephemeral: boolean \| number): 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.setChatEphemeral({
chatId: "447123456789@c.us",
ephemeral: 1,
});Parameters
Prop
Type
Returns
| Prop | Value |
|---|---|
| Return type | Promise<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
| Prop | Value |
|---|---|
| Namespace | chats |
| Action | update |
| Functionality | both |
| Positional parameter order | chatId, ephemeral |
| Aliases | chats.setEphemeral |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | PUT | /api/chats/setEphemeral | setChatEphemeral | Active |
| Alias | PUT | /api/setChatEphemeral | setChatEphemeral | Active |
unarchiveChat
Unarchive a chat
Signature client.unarchiveChat(chatId: string): Promise<boolean>
Usage
const result = await client.unarchiveChat("447123456789@c.us");Parameters
Prop
Type
Returns
| Prop | Value |
|---|---|
| Return type | Promise<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
| Prop | Value |
|---|---|
| Namespace | chats |
| Action | update |
| Functionality | both |
| Positional parameter order | chatId |
| Aliases | chats.unarchive |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | PUT | /api/chats/unarchive | unarchiveChat | Active |
| Alias | PUT | /api/unarchiveChat | unarchiveChat | Active |
unmuteChat
Unmute a chat
Signature client.unmuteChat(chatId: string): Promise<string \| boolean \| number>
Usage
const result = await client.unmuteChat("447123456789@c.us");Parameters
Prop
Type
Returns
| Prop | Value |
|---|---|
| Return type | Promise<string | boolean | number> |
Resolves to string \| boolean \| number. 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
| Prop | Value |
|---|---|
| Namespace | chats |
| Action | update |
| Functionality | both |
| Positional parameter order | chatId |
| Aliases | chats.unmute |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | PUT | /api/chats/unmute | unmuteChat | Active |
| Alias | PUT | /api/unmuteChat | unmuteChat | Active |
unpinChat
Unpin a chat
Signature client.unpinChat(chatId: string): Promise<boolean>
Usage
const result = await client.unpinChat("447123456789@c.us");Parameters
Prop
Type
Returns
| Prop | Value |
|---|---|
| Return type | Promise<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
| Prop | Value |
|---|---|
| Namespace | chats |
| Action | update |
| Functionality | both |
| Positional parameter order | chatId |
| Aliases | chats.unpin |
| Deprecated aliases | - |
| License | none |
| WAPI override | - |
| Deprecated | No |
Routes
| Type | Method | Path | Name | Status |
|---|---|---|---|---|
| Primary | PUT | /api/chats/unpin | unpinChat | Active |
| Alias | PUT | /api/unpinChat | unpinChat | Active |
Was this helpful?
Your answer includes the page path and docs version.
