Guides

Archived ChatsUSER-ONLY

User Walkthrough 4 of 50

Users can move chats between the main and archived chat lists.

Archiving a Chat

archiveChat moves a chat to the archive.

await client.archiveChat(chatId);

Listing Archived Chats

getChats lists the archive when from is set to "archived".

const chats = await client.getChats({ from: "archived" });

for (const { chat } of chats) {
  console.log(chat.id, chat.type);
}

Unarchiving a Chat

unarchiveChat moves it back to the main list.

await client.unarchiveChat(chatId);

Moving Multiple Chats

archiveChats and unarchiveChats move several chats at once.

await client.archiveChats(chatIds);
await client.unarchiveChats(chatIds);