I am trying to launch WhatsApp Business app using Flutter and have written below code:
whatsAppBusiness(phone) {
print(phone);
return launchUrl(
Uri.parse(
'whatsapp-business://send?phone=$phone',
// 'https://api.whatsapp.com/$phone', //put your number here
),
);
}
but it is not getting launched.
2
Answers
Interesting question because there’re 2 kinds of WhatsApp. Here what I’ve tried:
When my phone have only WA Messenger, I tried to type "whatsapp://" in Safari & it open WA Messenger app. But when I install more WA Business, this "whatsapp://" open WA Business.
I go to WA document: https://faq.whatsapp.com/5913398998672934, it tells us to use deep linking like this:
https://wa.me/{phone}?text={text}
. I followed it & it open WA Messenger!OK so what come to conclusion? If your phone contains 2 WA apps:
"whatsapp://send?phone=$phone"
https://wa.me/{phone}?text={text}
"whatsapp://send?phone=$phone"
P/s: Your
whatsapp-business://
not working, maybe because it doesn’t exist?!P/s 2: Don’t forget to config
info.plist
& Android manifest as url launcher requires.No need to specify whatsapp business.
just open whatsapp.
if you have both apps installed (whatsapp, whatsapp business), you will be given the choice of which one to open
so, just open whatsapp, here an example: