Mark message as read
curl --request POST \
--url https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/read-message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "5511999999999",
"messageId": "019E6F1A93FE78DCB54332F9FF0CCAE7"
}
'import requests
url = "https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/read-message"
payload = {
"phone": "5511999999999",
"messageId": "019E6F1A93FE78DCB54332F9FF0CCAE7"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({phone: '5511999999999', messageId: '019E6F1A93FE78DCB54332F9FF0CCAE7'})
};
fetch('https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/read-message', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/read-message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone' => '5511999999999',
'messageId' => '019E6F1A93FE78DCB54332F9FF0CCAE7'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/read-message"
payload := strings.NewReader("{\n \"phone\": \"5511999999999\",\n \"messageId\": \"019E6F1A93FE78DCB54332F9FF0CCAE7\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/read-message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"5511999999999\",\n \"messageId\": \"019E6F1A93FE78DCB54332F9FF0CCAE7\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/read-message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"5511999999999\",\n \"messageId\": \"019E6F1A93FE78DCB54332F9FF0CCAE7\"\n}"
response = http.request(request)
puts response.read_body{
"value": true
}Messages
Mark message as read
Mark as read a message received from the contact
POST
/
read-message
Mark message as read
curl --request POST \
--url https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/read-message \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"phone": "5511999999999",
"messageId": "019E6F1A93FE78DCB54332F9FF0CCAE7"
}
'import requests
url = "https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/read-message"
payload = {
"phone": "5511999999999",
"messageId": "019E6F1A93FE78DCB54332F9FF0CCAE7"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({phone: '5511999999999', messageId: '019E6F1A93FE78DCB54332F9FF0CCAE7'})
};
fetch('https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/read-message', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/read-message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'phone' => '5511999999999',
'messageId' => '019E6F1A93FE78DCB54332F9FF0CCAE7'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/read-message"
payload := strings.NewReader("{\n \"phone\": \"5511999999999\",\n \"messageId\": \"019E6F1A93FE78DCB54332F9FF0CCAE7\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/read-message")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"phone\": \"5511999999999\",\n \"messageId\": \"019E6F1A93FE78DCB54332F9FF0CCAE7\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://zapi.omni.z-api.io/channels/{channel_id}/token/{channel_token}/read-message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"phone\": \"5511999999999\",\n \"messageId\": \"019E6F1A93FE78DCB54332F9FF0CCAE7\"\n}"
response = http.request(request)
puts response.read_body{
"value": true
}Overview
Method for marking as read a message the channel received from the contact. It works on Official WhatsApp channels (Meta official API) and on WhatsApp Web channels, with WhatsApp Web enabled in the workspace.Attributes
| Attribute | Use |
|---|---|
messageId | Required. The messageId that came in the received message webhook. |
phone | Required, as in Z-API, but not used: the message is found by the messageId. |
application/x-www-form-urlencoded or multipart/form-data).
The success response is 200:
{ "value": true }
Differences from Z-API
- The
messageIdis the message id in Omni Z-API, the same one that comes in the webhook. In the default webhook format, it ismessage._id. It is not the message id in WhatsApp. - On Official WhatsApp, Meta’s API (Cloud API) also marks as read the earlier messages of the conversation.
- A message sent by the channel itself answers
200, with no effect.
On Official WhatsApp,
send-text with delayTyping also marks as read the last message received from the contact, because Meta only shows “typing” together with the read. If you use that option, the message shows as read without a call to this route.Errors
| Status | error | When |
|---|---|---|
400 | phone is required / messageId is required | phone or messageId missing or empty |
400 | messageId is invalid | messageId is . or .. |
400 | Varies, such as invalid character 'n' looking for beginning of object key string | The body could not be read, such as malformed JSON |
404 | message not found | The message does not exist or belongs to another channel, with the channel connected |
422 | message cannot be marked as read: it has no id at the channel provider | The message has no WhatsApp id |
422 | channel is disconnected | The channel is disconnected. It applies to any messageId, even one that does not exist: the connection is checked before the message |
422 | the channel provider refused the request | The channel provider refused the read |
422 | instance subscription is not active | The channel subscription is not active |
422 | Z-API (WhatsApp Web) instances are not enabled for this workspace | WhatsApp Web channel, with WhatsApp Web not enabled in the workspace |
422 | the Z-API instance of this channel is not provisioned | WhatsApp Web channel whose instance is not provisioned yet. It is checked before the message |
422 | message cannot be marked as read: its chat is not supported | WhatsApp Web channel, with a message from a chat the route does not serve |
422 | message action route is not available for <type> channels; ... | The channel is neither Official WhatsApp nor WhatsApp Web, such as a Telegram channel |
502 | failed to mark message as read | Failed to mark as read |
available only on Z-API (WhatsApp Web) instances. That ending is the same for every refused route. This route also works on Official WhatsApp.
The API does not repeat the call after a 502. You can call again.Authorizations
Body
application/json