'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



Solution 1:[1]

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)
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Frankenstein