I'm working on a Next.js 13 application where a store is shown. The user then goes to certain product detail and can contact the owner of the product via WhatsApp, so far, that's ok. I can use the Universal Link from WhatsApp (https://wa.me).
The thing here is that I want to open directly WhatsApp without asking for it. I know it may sounds kind of strange as it's a privacy/security thing, but, I just found a website called Inmuebles24 where you can contact the apartments owner by WhatsApp, in a mobile browser (Safari/Chrome), ALWAYS the WhatsApp application is opened without asking me for permission and that happens in both browsers that I've tested out Safari and Google Chrome with an iPhone 14.
In my case, I've figured out that sometimes opens without asking for permission and sometimes the prompt is shown.
Before opening the link, I ask for the user a few data (name, email and phone number) once he filled up the form, I get the owner phone number to use it in the WhatsApp link.
const whatsAppLink = 'https://wa.me/REPLACEPHONENUMBER/?text=%C2%A1Hello,%20I%20am%20interested%20in%20your%20product!%20Please%20provide%20me%20with%20more%20information.%20Thank%20you!'
const onSubmitForm = async (data) => {
try {
const res = await requestOwnerPhoneNumber(data);
const phoneNumber = res?.data ?? DEFAULT_WHATSAPP_NUMBER;
const link = whatsAppLink.replace('REPLACEPHONENUMBER', phoneNumber);
window.location.href = link;
} catch (error) {
errorAlert({
content: 'Something went wrong, please try again later',
});
}
};
As you can see, once I have the WhatsApp link, I do a window.location.href which I expect, on mobile, open directly WhatsApp without asking for it.
How could I reproduce the same behavior as Inmuebles24? Any thougths?