Views: 5326
Last Modified: 23.03.2022
The method gets counter data
Revision: 18
Get information on the current API revision (platform version) – im.revision.get.
Parameters
None
Method call
JavaScript
BX24.callMethod('im.counters.get', {}, function(result){
if(result.error())
{
console.error(result.error().ex);
}
else
{
console.log(result.data());
}
});
PHP
$result = restCommand('im.counters.get', Array(
), $_REQUEST["auth"]);
Example of response
{
"result": {
"CHAT": {18: 1},
"DIALOG": {1: 3, 5: 1},
"LINES": {},
"TYPE" {
"ALL": 5,
"CHAT": 1,
"DIALOG": 4,
"LINES": 0,
"NOTIFY": 0
}
}
}
Description of keys:
CHAT
– object, containing list of chats that have unread messages
DIALOG
– object, containing list of dialogs that have unread messages
LINES
– object, containing list of Open Channel chats that have unread messages
TYPE
– object, containing cumulative counters
ALL
– cumulative counter for all entities
CHAT
– cumulative counter for chats
DIALOG
– cumulative counter for dialogs
LINES
– cumulative counter for Open Channels
NOTIFY
– cumulative counter for notifications
Attention:
restCommand function is used here for illustration purposes only. It is taken from the
EchoBot example. You can send a REST command with your own function, or use the
BX24.callMethod or
bitrix24-php-sdk methods.