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)