Views: 1880
Last Modified: 30.08.2018
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! The method is specified with using of the
restCommand function. This method is used to send data in
Bitrix24 and is available in the
EchoBot example as well as in this article. You can use your own function or
BX24.callMethod, or
bitrix24-php-sdk JavaScript methods.