Search code examples
iosswiftcallwhatsapp

How can I place a WhatsApp call from an iOS app?


I would like to be able to place a call using a WhatsApp number from my iOS app. How can I do that?


Solution

  • You should ask WhatsApp how to do so. The solution lies in URL Schema: https://www.whatsapp.com/faq/de/iphone/23559013

    Here the code copied from their site, in Objective-C. I'll keep it as an exercise to do so in Swift:

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

    And just to make it sure: They won't let you send messages directly to someone, and even more: They won't let you send you messages silently, without WhatsApp being opened before.