#checking info about phone

9 messages · Page 1 of 1 (latest)

gentle pumice
#

hello I am working on a new project with this library and I can't figure out how to make it work my goal is to get the user's WhatsApp name plus the last time he was online(only if he is enabled it) the problem is that i am trying to do it on phones that are not in my contacts but only managing to do it if I text them and they text me back
I will add my code if can someone help me it would be great and i also can pay if someone knows how to do it
my goal for the code is first to check if the account is registered to WhatsApp and then check his last time and name(the phone is not in my contacts)

#

even if the name and the last time seen is showing in the WhatsApp web(without texting with him at all) the code still don't get it

#

this is my code =>
const fs = require('fs');
const qrcode = require('qrcode-terminal');
const { Client } = require('C:\Users\yehok\OneDrive\desktop\ws\whatsapp-web.js-main');

const client = new Client();

client.on('qr', (qr) => {
qrcode.generate(qr, {small: true});
console.log('QR RECEIVED', qr);
});

const phones = ["917800290159"]

client.on('ready', async () => {
console.log('Client is ready!');
for(let i = 0; i < phones.length; i++) {
const currentphone = phones[i]
const id = await client.getNumberId(currentphone);
if(id) {
console.log(currentphone + ' registered');
const chat = await client.getChatById(id._serialized);
await chat.sendMessage('Hello');
const contact = await client.getContactById(id._serialized);
console.log(contact)
console.log(chat);

  } else {
   console.log(currentphone + 'not registered');
  }
}

});

client.initialize()

uneven knoll
#

check the query titled 'last seen' , i think it'll help you

gentle pumice
#

can you explain more please

uneven knoll
#

i have not tried this yet but @desert perch is saying that we can do this with the help of puppeteer, but we have to first find the html class of html chat element and last seen html element, then we can click on desired chat and get the value of last seen html element.

i'm also working on whatsapp-clone application but at this time i'm working on other part of this application.

gentle pumice
#

do you guys can help me out
i dont mind paying

open mica
#

it's a security feature by whatsapp