Somehow, in order to send a response to the client, I must be able to pass the user's id as metadata or parameter, for example: The reservation request is sent to a restaurant, after that, the restaurant confirms the reservation, in the Confirmation A WhatsApp is sent to the user to inform him that his reservation is confirmed.
For it:
In the object returned by WhatsApp I have a context, however I can't find any method to get the information from the context.
I want to send the object:
"messaging_product": "whatsapp",
"to": "52" + recipient,
"metadata":{
"idUser": 60,
"idBranch": 76
},
"type": "template",
and retrieve the context to know the ID.
Unfortunately, WhatsApp Business API does not have any option to pass metadata in the send message API,
The real approach is you need to store that message-id in your database, whenever you receive webhook object, match that object's message-id in the stored message-id from the database, and do whatever further actions.