Documentation

imopenlines.crm.message.add

Scope: imopenlines Permissions: for all

Sending message from user to CRM entity chat.

Parameters

Parameter Required Description
CRM_ENTITY_TYPE yesCRM entity type (lead/deal/company/contact).
CRM_ENTITY_ID yesCRM entity ID.
USER_ID yesUser or bot ID to be added to chat.
CHAT_ID yesChat ID.
MESSAGE yesMessage text.

Example

BX24.callMethod('imopenlines.crm.message.add', {
	CRM_ENTITY_TYPE: 'deal', //lead|deal|company|contact
	CRM_ENTITY: 288,
	USER_ID: 12,
	CHAT_ID: 8773,
	MESSAGE: 'Message text'
}, function(result) {
	if(result.error())
	{
		console.error(result.error().ex);
	}
	else
	{
		console.log(result.data());
	}
});

Response

Returns sent message ID.

Response example

19880117

Possible error codes

Code Description
ACCESS_DENIED User doesn't have access.
ERROR_ARGUMENT One of arguments isn't specified or specified incorrectly.
CHAT_NOT_IN_CRM Chat doesn't belong to a CRM entity.
MESSAGE_ADD_ERROR Error while sending message.


© «Bitrix24», 2001-2024