Views: 5261
Last Modified: 14.10.2022

The method gets list of elements of the last search

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

Parameters

Parameter Example Req. Description Revision
SKIP_OPENLINES N No Skip open channel chats 18
SKIP_CHAT N No Skip chats 18
SKIP_DIALOG N No Skip one-on-one dialogs 18

Method call

JavaScript

BX24.callMethod('im.search.last.get', {}, function(result){
	if(result.error())
	{
		console.error(result.error().ex);
	}
	else
	{
		console.log(result.data());
	}
});

PHP

$result = restCommand('im.user.business.list', Array(
), $_REQUEST["auth"]);	

Example of response

{    
	"result": [
		{
			"id": 1,
			"type": "user",
			"title": "John Harrington",
			"avatar": {
				"url": "http://192.168.2.232/upload/resize_cache/main/1d3/100_100_2/Harrington.png",
				"color": "#df532d"
			}
			"user": {
				"id": 1,
				"name": "John Harrington",
				"first_name": "John",
				"last_name": "Harrington",
				"work_position": "",
				"color": "#df532d",
				"avatar": "http://192.168.2.232/upload/resize_cache/main/1d3/100_100_2/Harrington.png",
				"gender": "M",
				"birthday": "",
				"extranet": false,
				"network": false,
				"bot": false,
				"connector": false,
				"external_auth_id": "default",
				"status": "online",
				"idle": false,
				"last_activity_date": "2018-01-29T17:35:31+03:00",
				"desktop_last_date": false,
				"mobile_last_date": false,
				"departments": [
				  50
				],
				"absent": false,
				"phones": {
				  "work_phone": "",
				  "personal_mobile": "",
				  "personal_phone": ""
				}
			}
		}
	]
}              

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 not specified)
    • color – dialog color in 'hex' format
  • title – record title
  • user – user data description object (unavailable, if 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 in this record type - user):
    • id – chat ID
    • title – chat name
    • owner – chat owner user name
    • extranet – attribute of extranet user chat participation (true/false)
    • color – chat color in 'hex' format
    • avatar – link to avatar (if empty, the avatar is not specified)
    • type – chat type (group chat, call chat, open line chat and etc.)
    • entity_type – external code for chat – type
    • entity_id – external code for chat – ID
    • entity_data_1 – external data for chat
    • entity_data_2 – external data for chat
    • entity_data_3 – external data for chat
    • date_create – date of chat creation in АТОМ format
    • message_type – type chat messages

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.





Courses developed by Bitrix24