open-wa
DocsAPI reference

Chats Client API

Generated client method reference for the chats namespace.

Chats Client API

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

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
Namespacechats
Actionupdate
Functionalityboth
Positional parameter orderchatId
Aliaseschats.archive
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/chats/archivearchiveChatActive
AliasPUT/api/archiveChatarchiveChatActive

clearChat

Clear chat history

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

Usage

const result = await client.clearChat("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
Namespacechats
Actiondelete
Functionalityboth
Positional parameter orderchatId
Aliaseschats.clear
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryDELETE/api/chats/clearclearChatActive
AliasDELETE/api/clearChatclearChatActive

deleteChat

Delete a chat

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

Usage

const result = await client.deleteChat("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
Namespacechats
Actiondelete
Functionalityboth
Positional parameter orderchatId
Aliaseschats.delete
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryDELETE/api/chats/deletedeleteChatActive
AliasDELETE/api/deleteChatdeleteChatActive

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

PropValue
Return typePromise<Chat[]>
ChatView 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

PropValue
Namespacechats
Actionread
Functionalityboth
Positional parameter orderwithNewMessagesOnly
Aliaseschats.all, chats.getAll, chats.list, listChats
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/chats/getAllgetAllChatsActive
AliasGET/api/chats/allchats.allActive
AliasGET/api/chats/listchats.listActive
AliasGET/api/getAllChatsgetAllChatsActive
AliasGET/api/listChatslistChatsActive

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

PropValue
Return typePromise<Chat | null | undefined | false>
ChatView 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

PropValue
Namespacechats
Actionread
Functionalityboth
Positional parameter orderchatId
Aliaseschats.get, chats.getById, getChatById
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/chats/getgetChatActive
AliasGET/api/chats/getByIdchats.getByIdActive
AliasGET/api/getChatgetChatActive
AliasGET/api/getChatByIdgetChatByIdActive

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

PropValue
Return typePromise<Contact[]>
ContactView 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

PropValue
Namespacechats
Actionread
Functionalityboth
Positional parameter order-
Aliaseschats.getWithNonContacts
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/chats/getWithNonContactsgetChatWithNonContactsActive
AliasGET/api/getChatWithNonContactsgetChatWithNonContactsActive

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

PropValue
Return typePromise<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

PropValue
Namespacechats
Actionread
Functionalityboth
Positional parameter orderchatId
Aliaseschats.isOnline
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryGET/api/chats/isOnlineisChatOnlineActive
AliasGET/api/isChatOnlineisChatOnlineActive

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

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
Namespacechats
Actionupdate
Functionalityboth
Positional parameter orderchatId
Aliaseschats.markAsRead
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/chats/markAsReadmarkAsReadActive
AliasPUT/api/markAsReadmarkAsReadActive

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

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
Namespacechats
Actionupdate
Functionalityboth
Positional parameter orderchatId
Aliaseschats.markAsUnread
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/chats/markAsUnreadmarkAsUnreadActive
AliasPUT/api/markAsUnreadmarkAsUnreadActive

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

PropValue
Return typePromise<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

PropValue
Namespacechats
Actionupdate
Functionalityboth
Positional parameter orderchatId, muteDuration
Aliaseschats.mute
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/chats/mutemuteChatActive
AliasPUT/api/muteChatmuteChatActive

pinChat

Pin a chat

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

Usage

const result = await client.pinChat("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
Namespacechats
Actionupdate
Functionalityboth
Positional parameter orderchatId
Aliaseschats.pin
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/chats/pinpinChatActive
AliasPUT/api/pinChatpinChatActive

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

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
Namespacechats
Actionupdate
Functionalityboth
Positional parameter orderchatId, ephemeral
Aliaseschats.setEphemeral
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/chats/setEphemeralsetChatEphemeralActive
AliasPUT/api/setChatEphemeralsetChatEphemeralActive

unarchiveChat

Unarchive a chat

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

Usage

const result = await client.unarchiveChat("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
Namespacechats
Actionupdate
Functionalityboth
Positional parameter orderchatId
Aliaseschats.unarchive
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/chats/unarchiveunarchiveChatActive
AliasPUT/api/unarchiveChatunarchiveChatActive

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

PropValue
Return typePromise<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

PropValue
Namespacechats
Actionupdate
Functionalityboth
Positional parameter orderchatId
Aliaseschats.unmute
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/chats/unmuteunmuteChatActive
AliasPUT/api/unmuteChatunmuteChatActive

unpinChat

Unpin a chat

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

Usage

const result = await client.unpinChat("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
Namespacechats
Actionupdate
Functionalityboth
Positional parameter orderchatId
Aliaseschats.unpin
Deprecated aliases-
Licensenone
WAPI override-
DeprecatedNo

Routes

TypeMethodPathNameStatus
PrimaryPUT/api/chats/unpinunpinChatActive
AliasPUT/api/unpinChatunpinChatActive

Was this helpful?

Your answer includes the page path and docs version.

On this page