简体   繁体   中英

iOS - Make WhatsApp voice/video call programmatically from my application

I have a requirement to make WhatsApp calls from my application. When I click the mobile number in my app then it should redirect to WhatsApp and initiate voice/video calls without user intervention. I've found a solution from the below link but it's opening application and landing on user chat window.

https://faq.whatsapp.com/en/iphone/23559013

There isn't an api for that. Whatsapp only allows interactions like sharing media such as video, audio and images as mentioned in the FAQ . I tried searching for official developer doc for one of my requirements but, was unsuccessful the FAQ seems to be the only official doc availabe:

If your application creates photos, videos, or audio notes and you'd like your users to share these media using WhatsApp, you can use the Document Interaction API to send your media to your WhatsApp contacts and groups.

The only thing you could do is open the contact page for the user. And then he has to call by manually clicking on call button. Maybe, give an info that suggests user to do so.

if #available(iOS 10.0, *) {
   UIApplication.shared.open(NSURL(string: "whatsapp://send?phone=+91phonenumber")! as URL)
} else {
   UIApplication.shared.openURL(NSURL(string: "whatsapp://send?phone=+91phonenumber")! as URL)
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM