It seems like WhatsApp does not really want automated messages sent through it: https://www.quora.com/Why-doesnt-WhatsApp-have-an-API
However, someone seems to have made a PHP library: https://github.com/mgp25/Chat-API, so it would probably be possible to make a message output plugin for Moodle, so users can choose to send some Moodle notifications to WhatsApp. https://docs.moodle.org/dev/Messaging_2.0#Message_outputs_.28processors.29