I've found two ways to open the Whatsapp app from a webpage,
I understand the first one works on phone only but apart from that what are the differences between the two?
In my trials I've found that the api method doesn't always work properly in certain mobile browsers. In some cases it doesn't detect the installed app and takes me to the Appstore to install the app.
Does the first method work across all platforms and browsers?
Juan Pablo Isaza
The first approach usually requires the browser / OS to understand how to handle the
whatsapp:// protocol. This usually requires some setup beforehand (e.g. registering a protocol in Chrome, or a deep link schema in Android), and the browser / OS will pass the request to whatever app / program can handle it.
The second approach doesn't require any setup, and passes the request to WhatsApp's API directly. This is less likely to completely fail, but as you've seen may have issues on mobile when an app claims it should handle all requests to the domain.
You're better off following WhatsApp's documentation, and using their
wa.me domain for a universal link:
Universal links can also include a pre-filled message that will automatically appear in the text field of a chat. Use
whatsappphonenumberis a full phone number in international format and
urlencodedtextis the URL-encoded pre-filled message.
This will handle all the complexities for you. For example, on Android that URL opens the WhatsApp app, on Windows that universal link redirects to the
api.whatsapp.com URL, and Chrome asks if I want to use my installed WhatsApp program for it: