Mark a message read
/messaging/v1/messages/{id}/readMarks a WhatsApp message from a customer as read and shows them "typing…". The customer sees blue ticks.
Path parameters
- The id of a WhatsApp message the customer sent you, from the
message.receivedwebhook.Example:550e8400-e29b-41d4-a716-446655440000
There's no request body. WhatsApp shows "typing…" until your reply is delivered, for up to 25 seconds. You can't mark a message read without showing "typing…". This call isn't charged.
Example request
- curl
- Node.js
- Python
- PHP
curl -X POST "https://sandbox-api.ponitor.com/messaging/v1/messages/550e8400-e29b-41d4-a716-446655440000/read" \
-H "apiKey: $PONITOR_API_KEY"
const response = await fetch('https://sandbox-api.ponitor.com/messaging/v1/messages/550e8400-e29b-41d4-a716-446655440000/read', {
method: 'POST',
headers: { apiKey: process.env.PONITOR_API_KEY },
});
console.log(response.status, await response.json());
import os
import requests
response = requests.post(
"https://sandbox-api.ponitor.com/messaging/v1/messages/550e8400-e29b-41d4-a716-446655440000/read",
headers={"apiKey": os.environ["PONITOR_API_KEY"]},
timeout=30,
)
print(response.status_code, response.json())
<?php
$ch = curl_init('https://sandbox-api.ponitor.com/messaging/v1/messages/550e8400-e29b-41d4-a716-446655440000/read');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['apiKey: ' . getenv('PONITOR_API_KEY')],
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
echo $status, ' ', $body, PHP_EOL;
Responses
- 200
- 400
- 401
- 404
- 429
OK. The message is marked read. The body is the customer's message.
Bad Request. The message wasn't sent to you by a customer on WhatsApp, its WhatsApp number is no longer connected, or WhatsApp refused the request (E01002).
{
"error": {
"type": "bad_request_error",
"code": "E01002",
"name": "BadRequest",
"message": "Only a WhatsApp message a customer sent can be marked read.",
"doc_url": "https://docs.ponitor.com/api/errors#E01002",
"request_id": "3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f"
}
}
Every error has this error object. The body also still carries fields from before codes, which are deprecated. See The error body.
Unauthorized. The API key is missing (E02001), wrong or revoked (E02002), or sent to the other base URL (E02003). See API keys and base URLs.
Not Found. Your team has no message with this id (E01005).
Too Many Requests. Your team went over its rate limit (E01011). Wait, then try again.