Documentation

imconnector.send.messages

The method sends messages in Open Channel.

Parameters

Parameter Description Available from version
CONNECTOR Connector ID (specified when handler was registered).
LINE Open Channel ID.
MESSAGES Array of messages, described by array of the following format:
array(
  array(
     //User description array
     'user' => array(
        'id',//User ID in external system*
        'last_name',//Last name
        'name',//Name
        'picture' =>
           array(
              'url'//Link to user avatar, available for portal 
           ),
        'url',//Link to user profile
        'sex',//Gender. Male and female are available        
        'email', //email
        'phone', //phone number
        'skip_phone_validate' => 'Y', //The 'Y' value allows avoiding validation of
                                      //user phone number. Default value 'N'.

     ),
     //Array with message description
     'message' => array(
        'id', //Message ID in external system.*
        'date', //Message date in the timestamp format*
        'disable_crm' => 'Y' ,//disable chat tracker (CRM tracker)
        'text', //Message text. Element text or files must be specified. 
                //Available formatting (BB codes) are described  
                //here: https://training.bitrix24.com/support/training/course/index.php?COURSE_ID=115&LESSON_ID=9757
        'files' => array(//Array of files description, where each file is described by 
                              //the array, with link, available to Bitrix24 account
           array('url'),
           array('url'),
           ...
        )
     ),
     //Chat description array
     'chat' => array(
        'id',//Chat ID in external system*
        'name', //Chat name in external system
        'url', //Link to chat in external system
     ),
  ),
  array(...),
);

Format of passed file doesn't have limits. Inside the chat, the message attachment can be formatted as image for types: jpe, jpg, jpeg, png, webp, gif, bmp.

Messages can be sent on behalf of manager name, by indicating 'user_id' in the 'message' array.

The parameter skip_phone_validate from the user structure is recommended in exceptional instances only. This parameter - is a forced measure for overruling limits of phone number validator.


Errors when calling the method and error reasons

CodeError print textClarification
WRONG_AUTH_TYPE Current authorization type is denied for this methodIncorrect authorization type. Required oauth type
CONNECTOR Argument 'CONNECTOR' is null or emptyRequired parameter is not indicated in 'CONNECTOR'
LINE Argument 'LINE' is null or emptyRequired parameter is not indicated in 'LINE'
MESSAGES Argument 'MESSAGES' is null or emptyRequired parameter is not indicated in 'MESSAGES'
The value of an argument 'MESSAGES' must be an array type
IMCONNECTOR_NO_CORRECT_PROVIDER Unable to find a suitable provider for connectorIncorrect value in parameter 'CONNECTOR'
IMCONNECTOR_COULD_NOT_GET_PROVIDER_OBJECT Unable to get provider object Required parameter is not indicated in 'CONNECTOR'
IMCONNECTOR_NOT_SPECIFIED_CORRECT_COMMAND Command is incorrectSomething rare. Developer made a mistake somewhere.
IMCONNECTOR_NOT_SPECIFIED_CORRECT_CONNECTOR Connector not indicatedIncorrect value in the parameter 'CONNECTOR'
NOT_ACTIVE_LINE Open channel with such ID is inactive or doesn't existOpen channel is deleted or disabled
PROVIDER_UNSUPPORTED_TYPE_INCOMING_MESSAGE Incoming message type is not supported by serverIncorrect value in the parameter 'type_message', if passed
IMCONNECTOR_NOT_ALL_THE_REQUIRED_DATA Not all required data is passedEmpty or incorrect value in the parameter 'user'
CONNECTOR_PROXY_NO_ADD_USER Unable create or get system user, matched with user of deleted messengerOpen channel requires a special technical user added with attribute designating this user for messenger connector, disabled for authorization
CONNECTOR_PROXY_NO_USER_IM Messenger user ID is not receivedIncorrect 'ID' field value in the 'user' parameter. This следствие предыдущей ошибки
IMCONNECTOR_NOT_ALL_THE_REQUIRED_DATA Not all necessary data is passedIncorrect 'text' or 'files' field value in the 'message' parameter. No data is passed for message sending
100 The MESSAGES parameter must be an array of messages (arrays).
The incorrect structure of a message inside MESSAGES parameter.


© «Bitrix24», 2001-2024