WhatsApp implemented end-to-end encryption (whitepaper) in their latest update.

How is it possible for WhatsApp to send push notifications with message contents to the Apple Push Notification service?

One possible solution would be to send the unencrypted message to APNs from within the app itself but this would be open to abuse and would defeat the purpose of end-to-end encryption.

Update:
I have just tested it a bit more, according to Apple's documentation:


  However, the system does not automatically launch your app if the user has force-quit it. In that situation, the user must relaunch your app or restart the device before the system attempts to launch your app automatically again.


Which I tested, and resulted in me still receiving the plain text push notifications. This would lead me to believe the app is not running in the background to decrypt any notifications received and then repost them.

Update May-2017:

I have now used the VoIP API ( as mentioned in the answers below ) to effectively achieve the same result myself in a demo app. Works very well.

Update July-2017:

Apple no longer allows the usage of the API for push notifications of non-VOIP apps. They do however allow WhatsApp to do it in their infinite fairness.

Update September 2018:

A notification application extension can now be used to decrypt push notifications. However, dynamic libraries are discouraged from use in such extensions so you must have a codebase that can be compiled statically for decryption etc.

WhatsApp could be using VOIP background mode along with PushKit for solving this problem.

Voip pushes are:  


delivered directly to the app.  
considered high-priority notifications and are delivered without delay.  
delivered even if the app was force-quit by the user.


For details refer to Voice Over IP (VoIP) Best Practices

Once the encrypted payload of VOIP push is decrypted they show a “Local Notification” with the decrypted message.

There is one small issue though, PushKit is available only on iOS 8 and later. So, how is Whatsapp doing it for earlier versions of iOS?
Well, it isn’t. They don’t allow you to see message preview in notifications on versions earlier that iOS 8 (Verified it on iOS 7, see screenshot)    


