Receive WhatsApp messages via APIs
How to be notified about new messages with Webhooks.
If you're looking for an easy solution to manage WhatsApp messages with the APIs, then you've come to the right place.
Let's try to understand what we are talking about...
Everyone knows WhatsApp, but not everyone knows how to send and receive messages via the WhatsApp API. We at Mercury know this well, which is why we want to provide a tool for automatically sending and receiving WhatsApp messages.
Let's see how to do it by using Mercury platform. 🤔
First of all, you need to get the API token. Log in to Mercury and reach the Developer section. Then enable the REST API service to get the token.
Let's see this step in the image below.
To start the authentication you have to pass the api_token parameter in the query string parameter. You can find the token API within the dashboard.
How to receive a WhatsApp message through the Webhook. ⚓️
Use the webhooks to be notified about message, ack or chat update that happen in a instance_whatsapp.
You can set a http or https url and Mercury can sends the event-object, via HTTP POST request to any endpoint URLs that you have defined in your account’s Webhooks settings.
The webhook event object have this structure:
You can try the webhook with the service https://webhook.site
Copy your unique URL that was created:
Open Mercury dashboard in the Developer menu and set the webhook url.
Now you can see the notification of new message and the ack in the webiste https://webhook.site
Let's look at an example of the API calls in NodeJs 👇
Get webhook Url.
Set webhook Url.
Remember that the Mercury APIs are available in your favorite programming language. For example, Java, C #, Ruby, Go, Python and many others. Find out all the features of Mercury's WhatsApp API.