I'm an iPhone developer, how can I integrate WhatsApp into my app?

We provide several ways in which your iPhone application can interact with WhatsApp: through custom URL schemes, share extension and through the Document Interaction API.

Custom URL Scheme

Opening whatsapp:// URL with one of the following parameters, will open our app and perform a custom action.

app-The WhatsApp Messenger application
sendNew chat composer
textIf present, this text will be pre-filled into message text input field on a conversation screen.

The Objective-C call to open one of these URLs is as follows:

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

Be sure to include WhatsApp URL scheme in your application's Info.plist under LSApplicationQueriesSchemes key if you want to query presence of WhatsApp on user's iPhone using -[UIApplication canOpenURL:].

Share Extension

Introduced in iOS 8.0, Share Extension provides a convenient way for any app to share content with other applications installed on user's iPhone. This is now the preferred way of sharing your content onto WhatsApp. This is as simple as creating an instance of UIActivityViewController and presenting it in your app. WhatsApp accepts the following types of content:

  • text (UTI: public.plain-text)
  • photos (UTI: public.image)
  • videos (UTI: public.movie)
  • audio notes and music files (UTI: public.audio)
  • PDF documents (UTI: com.adobe.pdf)
  • contact cards (UTI: public.vcard)
  • web URLs (UTI: public.url)

Document Interaction

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.

WhatsApp Messenger can handle various types of media:

  • images of any type that conforms to public.image (for example, PNG and JPEG)
  • videos of any type that conforms to public.movie (for example, MPEG-4 video)
  • audio files (only MPEG-3, MPEG-4, AIFF, AIFF-C and Core Audio)

Alternatively, if you want to show only WhatsApp in the application list (instead of WhatsApp plus any other public/*-conforming apps) you can specify a file of one of aforementioned types saved with the extension that is exclusive to WhatsApp:

  • images - «.wai» which is of type net.whatsapp.image
  • videos - «.wam» which is of type net.whatsapp.movie
  • audio files - «.waa» which is of type net.whatsapp.audio

When triggered, WhatsApp will immediately present the user with the contact/group picker screen. The media will be automatically sent to a selected contact/group.

See the Apple documentation articles: Previewing and Opening Files and the UIDocumentInteractionController Class Reference for more information.

WhatsApp Support Team