I think you can use WhatsApp own API which help you to do this easily because when I tried integrate this (gb whatsapp https colon slash slash gbapps.net slash gbwhatsapp-apk) application with WhatsApp so I also used it's own API.
Moderator note: URL made human readable. This URL has not been evaluated for security or usefulness. Please use at your own risk.