May be they are reading the notification using notifications reading service (Feature in Android) and use intents to send messages.
But from intent you can either share (user action) a message to a particular contact or automatically open whatsapp on a particular contact and prefill the message in text box.
May be whatapp may have exposed an intent to directly send message or they are just prefilling the text box