Routes and Access
Main Route
The main path to view the messages is located in the index.js file in this same file there is a line that shows where you can see the processed messages which is:
`https://${appname}.fly.dev/whatsapp/api/messages`If we enter the url and we have sent a message to the bot, the corresponding messages will appear as in this case:

We can see that the database select brings us the last message from the client with the following information:
Database id
The customer's phone number (wa_id)
A message id (wam_id)
The message type (type)
The output of the message which if a message is sent is true and if not is false (outgoing)
The message body (body)
The status of the message (status)
Whether the message contains a picture and the picture itself a description written as a message (caption)
If the message is from the chatbot then it will be true (bot)
When the message was created (created at)
When the message was “sent” > “viewed” (updated at)
This information is useful to check if the messages are being saved correctly in the database because if we want to use the api we must know these fields to understand how to connect them with our front-end.
Accessing the information of a specific number
If we want to access the messages that were received and sent from a specific user just go to this path:
It is enough to make a GET request or place it in a browser and it will bring us all the information that was collected from that user in the database.
Send message to a user
This is more useful when using the api for front-end but I still put it here to understand how it works since I made it as simple as possible.
To send a message just make a post request and pass by parameters the whatsapp number to send the message and the body or content as in this case:
It should be noted that for the user or customer to receive the message, he/she must have contacted us at least 24 hours before if we try to send a message after the 24 hours that the user contacted us, the message will not arrive and we will have to send a template message in order to re-establish communication (this is a requirement of the meta api).
Última actualización