How to add WhatsApp click-to-chat universally on iOS and Android PWA or SPA apps
Hello,
Today, I am writing this article to help people, individuals and business to be more close to their beloved ones and their client as well, participating WhatsApp vision:
WhatsApp vision
(Behind every product decision is our desire to let people communicate anywhere in the world without barriers.)
Simply, most of the developers struggle applying click-to-chat feature which forwards a user from an native app, PWA, progressive web app, or a single web app to WhatsApp
I did so many codes, I tried so many times to make it work on both iOS as well as Android but I failed several times, or as Edison said:
Edison
I haven’t failed — I’ve just found 10,000 that won’t work
so lets get straight to the solution without the need to make different version for iOS and Android to implement successful click-to-chat
below an example using JavaScript
const url = `https://api.whatsapp.com/send?phone=${phoneNumber}&text=${message}`;
window.open(url, '_self');
All you need to do, use WhatsApp official API link and make sure to use ‘_self’. Using ‘_self’ method along with official API link will work as test on our apps universally for iOS and Android users
That’s All for today
by Mohannad Haddad
Comments are closed.