title: WhatsApp VS WhatsApp Business in SWIFT
body: <p>We would really appreciate any help on the following. Through our app, the user can initiate a WhatsApp message (what happens is that the WhatsApp client starts with the phone + text preloaded, so the user just needs to tap the "send" button from the WhatsApp application). </p>
  
  <p>We have an Android and an iOS app. In Android we are using the following code to select between WhatsApp and WhatsApp Business. </p>
  
  <pre><code>  String url = "https://api.whatsapp.com/send?phone=" + phoneNumberToUse + "&amp;text=" + 
    URLEncoder.encode(messageText, "UTF-8");
    if(useWhatsAppBusiness){
      intent.setPackage("com.whatsapp.w4b");
    } else {
      intent.setPackage("com.whatsapp");
    }
    URLEncoder.encode(messageText, "UTF-8");
    intent.setPackage("com.whatsapp");
    intent.setData(Uri.parse(url));
  
    if (intent.resolveActivity(packageManager) != null) {
      startActivity(intent);
    } else {
      Toast.makeText(this, "WhatsApp application not found", Toast.LENGTH_SHORT).show();
    }
  
  </code></pre>
  
  <p>We are trying to achieve the same functionality on Swift for iOS, however, we did not find any way to programmatically define whether the OS should start WhatsApp or WhatsApp Business. The code listed below, always starts the one or other depending on which is installed. If both are installed, it starts the WhatsApp application. </p>
  
  <pre><code>  let whatsApp = "https://wa.me/\(phoneNumber)/?text=\(shareableMessageText)"
  
    guard let url = URL(string: whatsApp) else {
        return
    }
    if #available(iOS 10.0, *) {
        UIApplication.shared.open(url, options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]), completionHandler: nil)
    } else {
        UIApplication.shared.openURL(url)
    }
  </code></pre>
  
  <p>So in simple words, is there any way, from our app, to select which WhatsApp application (WhatsApp or WhatsApp Business) is going to be launched?</p>
  
  <p>Thanks</p>