Views: 5151
Last Modified: 23.03.2022

Sending system notification

Revision Get current information about current API revision (platform version) – im.revision.get : 18

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.

Parameters

Parameter Example Req. Description Revision
SKIP_OPENLINES N None Skip Open Channel chats 18
SKIP_CHAT N None Skip chats 18
SKIP_DIALOG N None Skip one-on-one dialogs 18
LAST_UPDATE 2019-07-11T10:45:31+02:00 None Limit for passed data, date in ATOM format 23
ONLY_OPENLINES N None Selecting only Open Channel chats 29
LAST_SYNC_DATE 2019-07-11T10:45:31+02:00 None Previous fetch date to upload changes performed in the list from this date. Fetching returns data not older that 7 days. Date in ATOM format 29

Called method and response

JavaScript

BX24.callMethod('im.recent.get', {
	'SKIP_OPENLINES': 'Y'
}, function(result){
	if(result.error())
	{
		console.error(result.error().ex);
	}
	else
	{
		console.log(result.data());
	}
});

PHP

$result = restCommand('im.user.status.idle.start', Array(
	'SKIP_OPENLINES' => 'Y'
), $_REQUEST["auth"]);

Example of response

{
	"result": [
		{
			"id": "1",
		 	"type": "user",
		 	"avatar": {
				"url": "http://www.hazz/upload/resize_cache/main/1af/100_100_2/1464255149.png",
				"color": "#df532d"
		  	},
			"title": "John Harrington",
			"message": {
				"id": "30468",
				"text": "1",
				"file": false,
				"attach": false,
				"author_id": "1"
			},
			"counter": "3",
			"date": "2017-10-17T11:12:56+02:00",
			"user": {
				"id": "1",
				"name": "John Harrington",
				"first_name": "John",
				"last_name": "Harrington",
				"work_position": "IT specialist",
				"color": "#df532d",
				"avatar": "http://www.hazz/upload/resize_cache/main/1af/100_100_2/1464255149.png",
				"gender": "M",
				"birthday": false,
				"extranet": false,
				"network": false,
				"bot": false,
				"connector": false,
				"external_auth_id": "default",
				"status": "online",
				"idle": false,
				"last_activity_date": "2017-10-17T11:16:01+02:00",
				"mobile_last_date": "2017-05-26T12:04:58+02:00",
				"absent": "2017-11-01T00:00:00+02:00"
			}
		},
		{
			"id": "chat21191",
			"type": "chat",
			"avatar": {
				"url": "",
				"color": "#4ba984"
			},
			"title": "Mint Chat No.3",
			"message": {
				"id": "30467",
				"text": "Permission for Bitrix24 update received from [Attachment]",
				"file": false,
				"attach": true,
				"author_id": "2"
			},
			"counter": "0",
			"date": "2017-10-17T10:38:20+02:00",
			"chat": {
				"id": "21191",
				"title": "Mint chat No.3",
				"owner": "2",
				"extranet": false,
				"avatar": "",
				"color": "#4ba984",
				"type": "chat",
				"entity_type": "",
				"entity_data_1": "",
				"entity_data_2": "",
				"entity_data_3": "",
				"date_create": "2017-10-14T12:15:32+02:00",
				"message_type": "C"
			}
		}
	]
}       

Description of keys:

  • id – dialog ID (number if user, chatXXX if chat)
  • name – record type (user – if user, chat – if chat)
  • avatar – record avatar description object:
    • url – link to avatar (if empty, the avatar is not specified)
    • color – dialog color in 'hex' format
  • title – record title (First name, last name – for user, chat name - for chat)
  • messages – message description object:
    • id – message ID
    • text – message text (without BB-codes and string breaks)
    • file – file availability (true/false)
    • attach – attachment availability (true/false)
    • author_id – message author
    • date – message date in ATOM format
  • counter – counter for unread messages
  • user – user data description object (unavailable in this record type - chat):
    • id – user ID
    • name – user first and last name
    • first_name – user name
    • last_name – user last name
    • work_position – position
    • color – user color in 'hex' format
    • avatar – link to avatar (if empty, avatar is not specified)
    • gender – user gender
    • birthday – user birthday in the DD-MM format, if empty – not specified
    • extranet – extranet user attribute (true/false)
    • network – Bitrix24.Network user attribute (true/false)
    • bot – bot attribute (true/false)
    • connector – Open Channel user attribute (true/false)
    • external_auth_id – external authorization code
    • status – selected user status
    • idle – date, when user is not using his/her PC, in ATOM format (if not specified, false)
    • last_activity_date – date of the last user action, in ATOM format
    • mobile_last_date – date of the last action inside mobile app, in ATOM format (if not specified, false)
    • absent – date, to which the user has a leave of absence, in ATOM format (if not specified, false)
  • chat – chat data description object (unavailable if record type - user):
    • id – chat ID
    • title – chat name
    • owner – user-chat owner ID
    • extranet – attribute of extranet user participation in chat (true/false)
    • color – chat color in 'hex' format
    • avatar – link to avatar (if empty, avatar is not specified)
    • type – chat type (group chat, call chat, open channel chat and etc.)
    • entity_type – external code for chat – type
    • entity_id – external code for chat – identifier
    • entity_data_1 – external data for chat
    • entity_data_2 – external data for chat
    • entity_data_3 – external data for chat
    • date_create – date when chat is created in ATOM format
    • message_type – type of chat messages



Courses developed by Bitrix24