Closed tradename closed 3 years ago
AFAIK you can not check it without sending a message. I suggest you to send a test message and if the function returns with false then it is not a WhatsApp number and if it returns with true then it is a WhatsApp number. but be cautious about this. if you query for so many numbers like this then there is a high amount of chances that your number might get banned.
Its not then sending a message if the number is not saved and or never had a chat with the number, sendMessage and sendMessage2 won't send to non contacts, any other way i can go about it?
I have seen people using sendMessage2
for that use case. haven't tried myself but it works for others.
okay thanks, thoush i have tried sendMessage2 to a valid whatsapp number number@c.us but wont send unless i save it first
In that case use https://contacts.google.com/ to save the phone number remotely.
a new version has a function now to check the number.
WAPI.checkNumberStatus("XXXXXXXXXX@c.us",function(){console.log(arguments[0])})
@tradename
Thanks so much. working perfect
@vasani-arpit
Firstly, thanks a lot for this WBOT!
Do I have to be cautious when using checkNumberStatus
method?
I thought that method works if I have valid contact saved on my mobile, but it seems like even if I don't have a contact saved on my mobile, it checks and giving the correct output.
Could you tell me, how checkNumberStatus
method actually works?
@ChinkyPrinceCarey checkNumbStatus
checked for the number in WA database and returns if the number is WA number or not.
yes be cautious with this make sure you don't send too much requests. WA might be checking how many requests are coming from which number if it exceeds certain threshold and time then it might ban your number. less then 900 in 12 hour would be an idle number. I am just guessing based on what people have reported.
have made a small modification to : WAPI.sendMessage2(message.chatId._serialized, itemResponse.text);
to: WAPI.sendMessage2(itemResponse.to, itemResponse.text);
Now How can i check if itemResponse.to is a valid whatsapp number before i execute WAPI.sendMessage2(itemResponse.to, itemResponse.text);