If someone contacted you through WhatsApp that means you were careless with your mobile phone number, just as you are careless with your e-mail
The scammer could also be someone who knows the OP and chatting with him with another number(you may never know). I do not think the issue is even with being careless with your mobile number or email, those can be gotten very easily this days. So many users also get such messages via telegram, and that app doesn't use Mobile number.
The issue is with the users reaction to such messages, did he or she get immediately excited and greedy so as to fall for such nonsense. If one is able to curtail his or her greed, falling for all this nonsensical scams would be almost impossible.