Skip to content

Instantly share code, notes, and snippets.

@gekkedev
Created March 26, 2025 15:21
Show Gist options
  • Save gekkedev/a0e77af33adf23d4924b7e55c19ae866 to your computer and use it in GitHub Desktop.
Save gekkedev/a0e77af33adf23d4924b7e55c19ae866 to your computer and use it in GitHub Desktop.
Extract multiple phone numbers (private chat) from a WhatsApp group via WhatsApp Web
// 1. Log in to WhatsApp Web (http://web.whatsapp.com)
// 2. Download https://github.com/wppconnect-team/wa-js/releases/download/nightly/wppconnect-wa.js
// 3. Open the file and copy its contents.
// 4. Navigate back to WhatsApp Web and press F12
// (*allow pasting* if necessary)
// 5. Open a private chat and paste this snippet into the browser console:
function storeActiveChat() {
// Get the active chat user ID
let chatId = WPP.chat.getActiveChat().id.user;
// Retrieve existing chat IDs from localStorage or initialize an empty array
let chatArray = JSON.parse(localStorage.getItem("chatIds")) || [];
// Check if chatId already exists in the array
if (!chatArray.includes(chatId)) {
chatArray.push(chatId); // Add the new chat ID
localStorage.setItem("chatIds", JSON.stringify(chatArray)); // Save back to localStorage
}
// Output the updated array
console.log(chatArray);
}
// Call the function
storeActiveChat();
// 6. Repeat the previous for every chat (pasting `storeActiveChat()` is enough)
// as you can see, this is not suitable for bulk export but specific chats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment