Views: 4314
Last Modified: 09.10.2024

Gets information about dialog/chat

Revision: 24

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

Parameters

Parameter Example Required Description Revision
DIALOG_ID chat29 Yes Chat ID for image upload 24

Method call

JavaScript

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

PHP

$result = restCommand('imbot.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 to chat

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.





Courses developed by Bitrix24