How can WhatsApp do both targeted advertisement and end-to-end encryption?

Your WhatsApp account is linked to your Facebook account. They know lots about you from your Facebook activity, and can use that to direct targeted ads at you on WhatsApp, without knowing anything at all about the content of your WhatsApp messages.

End-to-end encryption is not peer-to-peer. There is a centralised XMPP server which handles delivery of messages. What's app client communicates with the server to send and receive messages between you and your contacts.

This server can also push ads to the WhatsApp client without interfering with message delivery system. WhatsApp will likely put ads on Status tab. Your contacts' status is also end to end encrypted and only you can decipher their status media. Without interfering with E2E, WhatsApp client can use a separate channel to download ads.

Targeted advertisement can work without reading your messages. Users give Location access to WhatsApp to share their live location so ads based on location is still possible. How much time you spend on WhatsApp and what is the best time you likely to use WhatsApp can be used to fingerprint your online behaviour. I'm not saying that they will make WhatsApp that much intrusive to display ads but possibilities exist and metadata information is enough for them.

Personalized ads which are only shown to you may not be that much accurate if you are not a facebook user but if they want to monetize the service just to keep it funding, then they don't have to be accurate.

I don't know if WhatsApp uses this technique---and I hope not, but technically, the app can and already does decrypt your messages once they're on your device. You could then:

  • Send the raw decrypted messages back to the WhatsApp servers, a terrible choice but nevertheless technically possible;
  • Do some machine learning on-device, creating a local advertising profile tailored to your preferences, and send limited data based on this data. This means Facebook could know you're interested in cats without actually knowing the exact content of any of your messages.