Twilio has created an API to integrate applications with Whatsapp. So you can send Whatsapp messages for marketing campaigns (for example) through another application. We have integrated this into CorebosCRM.
It works both ways. First you send the whatsapp message and a Message record is created into CorebosCRM and then when the message is opened and read Twilio sends a push notification and the Open field is updated in the Message record of Corebos.
First thing you should do is create a Twilio account. It is free at the beginning and you have a sandbox where you can test the integration before going live. Twilio will provide you with a number from which you can start testing the API. You have to register also some numbers you want to send the test message to.
Get the Sid, token and from number from Twilio
and put it in Corebos in the Utilities extension (index.php?module=Utilities&action=integration)
We have created a Workflow Task type for Whatsapp messages. So we are going to create a new Workflow. For example we want to send a message while saving a Contact that fulfills some conditions. We choose the phone fields of the module to which we are sending the message and we write the message body. We can also attach one ore more files to the message. In this case we are sending two ore more messages. One with the message and the others with the attachments. You can send only attachments of a maximum size of 5MB. We are also creating multiple messages records in Corebos. One for the text message and the others for the attachments.
After these steps we can make a test and see the message arriving in Whatsapp and the records created in the CRM.
On the other hand to get the message status, we have to register a Callback URL in Twilio.
There is a file in Corebos that gets the Twilio push notifications and updates the Open field in the Message with +1 each time a message is opened and read.
If we want to go live, we should upgrade the Twilio account, register one ore more phone numbers as from numbers and wait for Twilio to confirm them.
Next | Chapter 12: WordPress Woocommerce Integration