Web to mobile whatsapp message

I created a simple form with a submit button, text and phone entries. When I press the send button, whatsapp web opens and when I enter it from a mobile phone, whatsapp.com opens.
I’m trying to open mobile whatsapp with the text I wrote

let number = mobileNumber.replace(/[^d]/g, "");
  let url = `whatsapp://send?phone=${number}&text=${encodeURIComponent(message)}`;

and chatGPT already tell me https://wa.me/15551234567 that will work

let number = mobileNumber.replace(/[^d]/g, "");
  let url = `whatsapp://send?phone=${number}&text=${encodeURIComponent(message)}`;