WhatsApp Inc. does not provide an open API but a reverse-engineered library is made available on GitHub by the team Venomous on the GitHub. This however according to my knowledge is made possible in PHP. You can check the link here: https://github.com/venomous0x/WhatsAPI
After trying everything, Yowsup library worked for me. The bug that I was facing was recently fixed. Anyone trying to do something with Whatsapp should try it.
For some of my technical experiments, I was trying to figure out how beneficial and feasible it is to implement bots for different chat platforms in terms of market share and so possibilities of adaptation. Especially when you have bankruptly failed twice, it's important to validate ideas and fail more faster.
Popular chat platforms like Messenger, Slack, Skype etc. have happily (in the sense officially) provided APIs for bots to interact with, but WhatsApp has not yet provided any API.
However, since many years, a lot of activities has happened around this - struggle towards automated interaction with WhatsApp platform:
Bots App
Bots App is interesting because it shows that something is really tried and tested.
Yowsup
A project still actively developed to interact with WhatsApp platform.
Yallagenie
Yallagenie claim that there is a demo bot which can be interacted with at +971 56 112 6652
Hubtype
Hubtype is working towards having a bot platform for WhatsApp for business.
Fred
Fred's task was to automate WhatsApp conversations, however since it was not officially supported by WhatsApp - it was shut down.