Views: 4188
Last Modified: 26.01.2024

Gets chat ID

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
ENTITY_TYPE CRM - for CRM,
LINES From agent/operator or LIVECHAT From user - for open lines
Yes Entity ID. Can be used for chat search or defining context in event handlers ONIMBOTMESSAGEADD, ONIMBOTMESSAGEUPDATE, ONIMBOTMESSAGEDELETE 18
ENTITY_ID LEAD|13 - for CRM,
facebook|2|1647215182041969|862 - for open lines ENTITY_ID matches with USER_CODE from session.
Yes Entity numerical ID. Can be used for chat search or defining context in event handlers ONIMBOTMESSAGEADD, ONIMBOTMESSAGEUPDATE, ONIMBOTMESSAGEDELETE 18

Called method and response

PHP

$result = restCommand('im.chat.get', Array(

   'ENTITY_TYPE' => 'CRM',
   'ENTITY_ID' => 'LEAD|13',
   
), $_REQUEST["auth"]);

Response example

{
	"result": 10
}
Result: returns CHAT_ID or null.



Courses developed by Bitrix24