English
Get Channel Messages
GET/channel/messageFetch the message history of a WhatsApp channel (newsletter), newest first. Each page holds up to 100 messages. For the next page, pass along the before value from the previous response.
Endpoint Details
- Base URL:
https://api-zawa.azickri.com - Headers:
idandsession-id - Requires: a connected session (
isConnected: true)
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | header | string | Yes | The id from Create Session. |
session-id | header | string | Yes | The sessionId from Create Session. |
channelId | query | string | Yes | Channel ID, e.g. 120363000000000000@newsletter. |
before | query | string | No | The before value from the previous response. Leave it out to get the newest messages. |
Example Request
bash
curl "https://api-zawa.azickri.com/channel/message?channelId=120363000000000000@newsletter" \
-H "id: YOUR_ID" \
-H "session-id: YOUR_SESSION_ID"javascript
import axios from 'axios';
const response = await axios.get('https://api-zawa.azickri.com/channel/message', {
params: {
channelId: '120363000000000000@newsletter',
},
headers: {
'id': 'YOUR_ID',
'session-id': 'YOUR_SESSION_ID',
},
});
console.log(response.data);javascript
const params = new URLSearchParams({
channelId: '120363000000000000@newsletter',
});
const response = await fetch(`https://api-zawa.azickri.com/channel/message?${params}`, {
headers: {
'id': 'YOUR_ID',
'session-id': 'YOUR_SESSION_ID',
},
});
const data = await response.json();
console.log(data);Response
json
{
"docs": [
{
"id": "A5F44C62B3E3772251002D42C45ACC87",
"serverId": 182,
"url": "https://whatsapp.com/channel/0029VaXXXXXXXXXXXXXXXX/182",
"type": "text",
"text": "A new Zawa version is out! 🎉",
"created": "2025-06-07T15:15:51.000Z"
},
{
"id": "B7C1D9E2F3A4B5C6D7E8F9A0B1C2D3E4",
"serverId": 181,
"url": "https://whatsapp.com/channel/0029VaXXXXXXXXXXXXXXXX/181",
"type": "image",
"text": "Image caption",
"image": {
"url": "https://mmg.whatsapp.net/...",
"thumbnail": "https://mmg.whatsapp.net/...",
"mimetype": "image/jpeg"
},
"created": "2025-06-06T10:02:11.000Z"
},
{
"id": "C9D8E7F6A5B4C3D2E1F0A9B8C7D6E5F4",
"serverId": 180,
"url": "https://whatsapp.com/channel/0029VaXXXXXXXXXXXXXXXX/180",
"type": "poll",
"text": "",
"polling": {
"name": "Which feature are you waiting for?",
"options": ["Webhooks", "Sending polls", "All of them"]
},
"created": "2025-06-05T08:30:00.000Z"
}
],
"before": 0
}json
// channelId is missing
{
"statusCode": 400,
"message": "channelId should not be empty\nchannelId must be a string"
}
// Missing headers
{
"statusCode": 400,
"message": "invalid header"
}json
{
"statusCode": 404,
"message": "session not found"
}json
// Channel not found
{
"statusCode": 500,
"message": "channel not found"
}
// Session isn't connected
{
"statusCode": 500,
"message": "session not connected"
}| Field | Type | Description |
|---|---|---|
docs | array | The list of messages, newest first. |
docs[].id | string | Message ID. |
docs[].serverId | number | The message's sequence number in the channel. Higher means newer. |
docs[].url | string | Public link to the message on WhatsApp. |
docs[].type | string | Message type: text, image, video, poll, or sticker. |
docs[].text | string | The text message, or the caption for images and videos. |
docs[].image | object | Present when type is image: url, thumbnail, mimetype. |
docs[].video | object | Present when type is video: url, thumbnail, duration (seconds), mimetype. |
docs[].sticker | object | Present when type is sticker: url, mimetype. |
docs[].polling | object | Present when type is poll: name (the question) and options (the choices). |
docs[].created | string | When the message was sent (ISO 8601). |
before | number | Send this as the before query parameter to fetch the next page. 0 means there are no more pages. |
Other types
Messages of types that aren't supported yet still show up, but with type: "text" and text: "UNSUPPORTED TYPE".
Pagination
It's simple: call without before for the first page, then pass the before from each response into the next request. Stop when before is 0.
javascript
const BASE_URL = 'https://api-zawa.azickri.com';
const headers = {
'id': 'YOUR_ID',
'session-id': 'YOUR_SESSION_ID',
};
async function getAllChannelMessages(channelId) {
const messages = [];
let before = '';
do {
const params = new URLSearchParams({ channelId });
if (before) params.set('before', before);
const response = await fetch(`${BASE_URL}/channel/message?${params}`, { headers });
const data = await response.json();
if (!response.ok) throw new Error(data.message);
messages.push(...data.docs);
before = String(data.before);
} while (before !== '0');
return messages;
}
const messages = await getAllChannelMessages('120363000000000000@newsletter');
console.log(`${messages.length} messages in total`);You don't need all of them
Older channels can have thousands of messages. If you only need the latest ones, the first page is enough.