Optionalkey: string// Basic lookup
const result = await WPP.contact.queryUsernameExists('someusername');
if (result && 'keyRequired' in result) {
// Username is PIN-protected — prompt the user for the PIN
} else if (result) {
console.log(result.wid); // The contact's WID
}
// With PIN
const result = await WPP.contact.queryUsernameExists('someusername', '1234');
Check if a WhatsApp username (@username) exists
Some accounts protect their username with a PIN. When the account has PIN protection enabled, this function returns
{ keyRequired: true }instead of contact info. Pass the numeric PIN askeyto unlock the result.