Views: 3347
Last Modified: 23.03.2022

Gets information about dialog/chat

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 Required Description Revision
DIALOG_ID chat29 Yes Dialog ID. Format:
chatXXX – recipient chat, in case of chat message
or XXX – recipient ID in case of private conversation message
24


Method call and response

JavaScript

BX24.callMethod('im.dialog.get', {
	DIALOG_ID: 'chat29'
}, function(result){
	if(result.error())
	{
		console.error(result.error().ex);
	}
	else
	{
		console.log(result.data());
	}
});

PHP

$result = restCommand('im.dialog.get', Array(
	'DIALOG_ID': 'chat29'
), $_REQUEST["auth"]);

Response example

{
    "result": 
  {
    "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"
  }
}

Key description:

  • id – chat ID
  • title – chat name
  • owner – chat owner ID
  • extranet – extranet user chat participation attribute (true/false)
  • color – chat color in hex format
  • avatar – link to avatar (when empty - avatar is not defined)
  • type – chat type (group chat, chat for call, Open Channel chat, etc)
  • entity_type – chat external code - type
  • entity_id – chat external code – ID
  • entity_data_1 – external data for chat
  • entity_data_2 – external data for chat
  • entity_data_3 – external data for chat
  • date_create – chat created date in АТОМ format
  • message_type – chat message type

Example of response with error

{
    "error": "DIALOG_ID_EMPTY",
    "error_description": "Dialog ID can't be empty"
}

Key description:

  • error – returned error code
  • error_description – error brief description

Possible error codes

Code Description
DIALOG_ID_EMPTY Chat ID not passed
ACCESS_ERROR Current user doesn't have access permissions for chat



Courses developed by Bitrix24