WhatsApp url scheme for iPhone app

2019-02-02 15:59发布

We are developing an iPhone app and planning to integrate Whatsapp.

Is there a way to enable click to call / message from the iPhone app? Skype allows this by following:

<a href="skype:skypehandle?call"> Skype </a>

Is there an equivalent for Whatsapp ?

5条回答
狗以群分
2楼-- · 2019-02-02 16:08
NSURL *whatsappURL = [NSURL URLWithString:@"whatsapp://location?id=1"];

 if ([[UIApplication sharedApplication] canOpenURL:whatsappURL]) {
        [[UIApplication sharedApplication] openURL:whatsappURL]]];
 }
查看更多
Root(大扎)
3楼-- · 2019-02-02 16:18

currently Whatsapp doesn't have a registered URL scheme.

You can check if you favourite apps support them by inspecting the contents of the apps info.plist.

I'm sure there are windows equivalents but I use a mac, so have a free app called iPhone Explorer (now renamed to iExplorer) installed which mounts the phone as a drive and allows you to view app contents via a tree structure. No jailbreak required. The info.plist is in the chosen apps appname.app folder. copy this to your desktop and open the file. Look for the 'URL types' key and expand. This is the URL that when :// is added will open in safari or with the UIApplication openURL method.

update - November 2012 - latest version now adds URL scheme.
whatsapp://

don't know if it has any 'actions' associated with it though.

update - Nov 2013 Whatsapp blog has info on the actions that can be performed http://www.whatsapp.com/faq/en/iphone/23559013

查看更多
贪生不怕死
4楼-- · 2019-02-02 16:18

There are a few sites that list numerous iPhone app URL Schemes. http://handleopenurl.com/scheme?page=27 is the largest one that I know of. It doesn't seem to contain anything for WhatsApp.

http://wiki.akosma.com/IPhone_URL_Schemes is another list, but also doesn't include WhatsApp. It's up to the developer of the app to create and publish their own URL Schemes, and it doesn't look like WhatsApp have done so yet.

查看更多
霸刀☆藐视天下
5楼-- · 2019-02-02 16:20

With the new iPhone v2.10.1 release WhatsApp now supports its own url scheme. E.g. to open a new chat composer with the text "Hello World" you have to do this:

NSURL *whatsappURL = [NSURL URLWithString:@"whatsapp://send?text=Hello%20World!"];
 if ([[UIApplication sharedApplication] canOpenURL: whatsappURL]) {
    [[UIApplication sharedApplication] openURL: whatsappURL];
 }

More information can be found in this FAQ on their site: http://www.whatsapp.com/faq/en/iphone/23559013

查看更多
我欲成王,谁敢阻挡
6楼-- · 2019-02-02 16:23

17/07/2013 Since yesterday's update, whatsapp has a public URL Scheme:

Whatsapp official URL Scheme

查看更多
登录 后发表回答