How to launch an installed app such an Email composer or open a What'sApp?

Trying to add buttons that will allow quickly to send a message. Does anyone know how to that or can share some sample script? Appreciate it!

Hi there,

You can use the launchUrl() function to launch a mailto link, as described in this docs article.

The following example code would launch the device’s default email application with the recipient email address pre-filled with ‘support@zappar.com’.

Z.device.launchUrl("mailto:support@zappar.com", false);

You can also use the sms non-web link to launch the device’s default sms application with the number filled in. Launching WhatsApp however is not possible.

While you can open the respective applications, and specify the recipient, you won’t be able to pre-fill the message.

Hope this helps.

All the best,
Seb

2 Likes

Hi, Seb!

Is there any other way to launch whatsApp from WebAr?

Looking for the same solution about lauching Whatsapp.

This works on iOS, ought to work on Android too:

Z.device.launchUrl("whatsapp://send?text=Zap%20rules%20yeah%20baby");

Until we have a way to disable somewhat unnecessary Launch… confirmation Zap puts up, it’ll look slightly clunky, but it does at least work. Note that you can prefill the text but you can’t choose the contact - that’s up to the user, and the first thing they’ll see after clicking through is their list of contacts so they can choose who they want to send the message to. They’re given an opportunity to edit the text before sending it too.

So it may have use for giving people a way to share a link with their friends, but you can’t use it to initiate a chat with you if you’re not already in their address book.

On iOS at least there’s a custom URI scheme so quite a few apps ought to be launchable in this way. More info here: https://ios.gadgethacks.com/how-to/always-updated-list-ios-app-url-scheme-names-paths-for-shortcuts-0184033/

Not sure how you’d tell if someone actually has the relevant app installed, though, so if something breaks please remember it’s ń̷̡̛̠̖̠̥̊͗̅͑o̵̢̗̩̰̘͕̾̿̿ť̴̺͔͕̞͋̅͛̈́̚ ̵̨̻̄͜m̴̰̙̍y̸̤̪̤̥͎͍͋͐͛͝ f̶̡̘͕̹̭̦̲̰̿͐̈́̽͆͂́͐͑̽å̶̛̞̟̮̒̿̾̈́̆͒̚͜͜ȗ̶̥̳l̸̤͋̋̆͛͌͐̿́̋̀̐̀̕t̸̡̝̼̤̳̲͍̗͙͎̜͙͚͙̭̑̎̿͛̌͘