Contents
Count Unread Leads - Plugixa Chat
GET /plugixa-chat/v1/leads/unread
Count the leads still marked new. Leads in the trash are not counted.
The signed-in user needs the plugixa_chat_view capability. Administrators have it.
Request
GET https://your-site.example/wp-json/plugixa-chat/v1/leads/unread?widget_id=2
Query parameters
| Name | Type | Default | Description |
|---|---|---|---|
widget_id |
integer |
0 |
Count only this widget’s leads. 0 counts the whole site. |
Responses
200 OK.
{
"success": true,
"data": {
"count": 3
}
}
| Field | Type | Meaning |
|---|---|---|
data.count |
integer |
Leads with the status new |
Errors
Plus the errors every endpoint can return.
Examples
curl -s "https://your-site.example/wp-json/plugixa-chat/v1/leads/unread?widget_id=2" \
-u "admin:$WP_APP_PASSWORD"
<?php
$query = http_build_query([
'widget_id' => 2,
]);
$ch = curl_init('https://your-site.example/wp-json/plugixa-chat/v1/leads/unread?' . $query);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const query = new URLSearchParams({ widget_id: '2' });
const response = await fetch(`https://your-site.example/wp-json/plugixa-chat/v1/leads/unread?${query}`, {
headers: {
'Authorization': 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`),
},
});
const { data } = await response.json();
Quick Links
Share