Add Open Channel imopenlines.config.add

Scope: imopenlines

Who can execute the method: any user

The method imopenlines.config.add adds a new open channel.

To allow users to write to the open channel, set the connector settings using the method imconnector.connector.data.set.

Method Parameters

Name
type

Description

PARAMS
object

Object with open channel settings (detailed description)

PARAMS Parameter

Name
type

Description

LINE_NAME
string

Name of the open channel

ACTIVE
char

Channel activity. Possible values:

  • Y — channel is active
  • N — channel is inactive

QUEUE
array

Queue of operators. An array of objects with fields ENTITY_TYPE and ENTITY_ID.

Possible values:

  • ENTITY_TYPE — user user or department department
  • ENTITY_ID — identifier of the selected type object. For user, specify the ID of the user, for department — the ID of the department

Example:

[
            {
                "ENTITY_TYPE":"user",
                "ENTITY_ID":"1"
            },
            {
                "ENTITY_TYPE":"department",
                "ENTITY_ID":"10"
            }
        ]
        

QUEUE_TYPE
string

Request distribution mode. Possible values:

  • evenly — distribute requests evenly among operators
  • strictly — direct requests strictly in queue order
  • all — direct requests to all operators in the queue

QUEUE_TIME
integer

Time in seconds before the request is passed to the next operator

NO_ANSWER_TIME
integer

Time in seconds before the no-answer scenario is triggered

WELCOME_MESSAGE
char

Send a welcome message. Possible values:

  • Y — yes
  • N — no

WELCOME_MESSAGE_TEXT
string

Text of the welcome message

WORKTIME_ENABLE
char

Consider the channel's working hours. Possible values:

  • Y — yes
  • N — no

WORKTIME_FROM
string

Start of working hours in HH:MM format

WORKTIME_TO
string

End of working hours in HH:MM format

WORKTIME_TIMEZONE
string

Time zone, for example Europe/Berlin

CRM
char

Search for the client in CRM. Possible values:

  • Y — yes
  • N — no

CRM_CREATE
string

What to create in CRM for a new client

VOTE_MESSAGE
char

Request service quality rating. Possible values:

  • Y — yes
  • N — no

LANGUAGE_ID
string

Language of the channel, for example de

CRM_CREATE_SECOND
string

Additional mode for creating a CRM entity

CRM_CREATE_THIRD
char

Create a third CRM entity. Possible values:

  • Y — yes
  • N — no

CRM_CHAT_TRACKER
char

Enable chat tracker for CRM. Possible values:

  • Y — yes
  • N — no

CRM_FORWARD
char

Forward the request to the responsible person in CRM. Possible values:

  • Y — yes
  • N — no

CRM_TRANSFER_CHANGE
char

Change the responsible person in CRM when transferring the dialogue. Possible values:

  • Y — yes
  • N — no

CRM_SOURCE
string

Source for the created CRM entity

MAX_CHAT
integer

Maximum number of simultaneous dialogues for the operator

TYPE_MAX_CHAT
string

Type of MAX_CHAT restriction. Possible values:

  • answered — consider only dialogues where the operator has already responded
  • answered_new — consider dialogues with a response and new dialogues
  • closed — consider closed dialogues

CATEGORY_ENABLE
char

Enable categories. Possible values:

  • Y — yes
  • N — no

CATEGORY_ID
integer

Identifier of the category

SESSION_PRIORITY
integer

Session priority in the queue

WELCOME_BOT_ENABLE
char

Enable welcome chatbot. Possible values:

  • Y — yes
  • N — no

WELCOME_BOT_JOIN
string

When to connect the bot. Possible values:

  • first — connect the bot only at the beginning of the dialogue
  • always — connect the bot in every dialogue

WELCOME_BOT_ID
integer

Identifier of the chatbot

WELCOME_BOT_TIME
integer

After how many seconds to transfer the dialogue from the bot to the queue

WELCOME_BOT_LEFT
string

When to disconnect the bot. Possible values:

  • queue — disconnect the bot when transferring to the operators' queue
  • close — disconnect the bot when closing the dialogue

CHECK_AVAILABLE
char

Check the availability of the operator during distribution. Possible values:

  • Y — yes
  • N — no

WATCH_TYPING
char

Show typing indicator. Possible values:

  • Y — yes
  • N — no

SEND_WELCOME_EACH_SESSION
char

Send a greeting in each session. Possible values:

  • Y — yes
  • N — no

OPERATOR_DATA
string

Format of operator data. Possible values:

  • profile — show operator profile
  • queue — show operator data from the queue
  • hide — hide operator data

DEFAULT_OPERATOR_DATA
object

Default operator data. Possible fields:

  • NAME — operator's name
  • AVATAR — link to the operator's avatar
  • AVATAR_ID — identifier of the avatar file

NO_ANSWER_RULE
string

Scenario if the operator did not respond. Possible values:

  • none — do not execute the scenario
  • text — send a text message

NO_ANSWER_FORM_ID
integer

Identifier of the CRM form for the no-answer scenario

NO_ANSWER_BOT_ID
integer

Identifier of the chatbot for the no-answer scenario

NO_ANSWER_TEXT
string

Text for the no-answer scenario

WORKTIME_DAYOFF
array

Days off. Possible values of elements:

  • MO — Monday
  • TU — Tuesday
  • WE — Wednesday
  • TH — Thursday
  • FR — Friday
  • SA — Saturday
  • SU — Sunday

WORKTIME_HOLIDAYS
string

Holidays in string format, listed as DD.MM,DD.MM

WORKTIME_DAYOFF_RULE
string

Scenario during non-working hours. Possible values:

  • none — do not execute the scenario
  • text — send a text message

WORKTIME_DAYOFF_FORM_ID
integer

Identifier of the CRM form for non-working hours

WORKTIME_DAYOFF_BOT_ID
integer

Identifier of the chatbot for non-working hours

WORKTIME_DAYOFF_TEXT
string

Text message during non-working hours

CLOSE_RULE
string

Scenario upon closure. Possible values:

  • none — do not execute the scenario
  • text — send a text message

CLOSE_FORM_ID
integer

Identifier of the CRM form upon closure

CLOSE_BOT_ID
integer

Identifier of the chatbot upon closure

CLOSE_TEXT
string

Text message upon closure

VOTE_TIME_LIMIT
integer

Time limit for voting

VOTE_CLOSING_DELAY
char

Close the session immediately after rating. Possible values:

  • Y — yes
  • N — no

VOTE_BEFORE_FINISH
char

Request rating before completion. Possible values:

  • Y — yes
  • N — no

VOTE_MESSAGE_1_TEXT
string

Text for rating request in the widget

VOTE_MESSAGE_1_LIKE
string

Text after positive rating in the widget

VOTE_MESSAGE_1_DISLIKE
string

Text after negative rating in the widget

VOTE_MESSAGE_2_TEXT
string

Text for rating request in external channels

VOTE_MESSAGE_2_LIKE
string

Text after positive rating in external channels

VOTE_MESSAGE_2_DISLIKE
string

Text after negative rating in external channels

AUTO_CLOSE_RULE
string

Auto-closing scenario. Possible values:

  • none — do not execute the scenario
  • text — send a text message

FULL_CLOSE_TIME
integer

Time for full closure after manual closure

AUTO_CLOSE_TIME
integer

Time until auto-closure

AUTO_CLOSE_FORM_ID
integer

Identifier of the CRM form for auto-closure

AUTO_CLOSE_BOT_ID
integer

Identifier of the chatbot for auto-closure

AUTO_CLOSE_TEXT
string

Text upon auto-closure

AUTO_EXPIRE_TIME
integer

Lifetime of automatically closed session

TEMPORARY
char

Create a temporary channel. Possible values:

  • Y — create a temporary channel
  • N — create a permanent channel

QUICK_ANSWERS_IBLOCK_ID
integer

Identifier of the quick answers info block

KPI_FIRST_ANSWER_TIME
integer

Control of the first response time

KPI_FIRST_ANSWER_ALERT
char

Enable notification for the first response. Possible values:

  • Y — yes
  • N — no

KPI_FIRST_ANSWER_LIST
array

List of recipients for the first response notification

KPI_FIRST_ANSWER_TEXT
string

Text of the first response notification

KPI_FURTHER_ANSWER_TIME
integer

Control of subsequent response times

KPI_FURTHER_ANSWER_ALERT
char

Enable notification for subsequent responses. Possible values:

  • Y — yes
  • N — no

KPI_FURTHER_ANSWER_LIST
array

List of recipients for subsequent response notifications

KPI_FURTHER_ANSWER_TEXT
string

Text of the subsequent response notification

KPI_CHECK_OPERATOR_ACTIVITY
char

Monitor operator activity. Possible values:

  • Y — yes
  • N — no

USE_WELCOME_FORM
char

Use welcome CRM form. Possible values:

  • Y — yes
  • N — no

WELCOME_FORM_ID
integer

Identifier of the welcome CRM form

WELCOME_FORM_DELAY
char

Show the form with a delay. Possible values:

  • Y — yes
  • N — no

CONFIRM_CLOSE
char

Request confirmation for closure. Possible values:

  • Y — yes
  • N — no

IGNORE_WELCOME_FORM_RESPONSIBLE
char

Ignore the responsible person in the welcome form. Possible values:

  • Y — yes
  • N — no

Code Examples

How to Use Examples in Documentation

curl -X POST \
          -H "Content-Type: application/json" \
          -H "Accept: application/json" \
          -d '{
            "PARAMS": {
              "LINE_NAME": "Online Store Support Line",
              "QUEUE": [
                {
                  "ENTITY_TYPE": "user",
                  "ENTITY_ID": "1"
                },
                {
                  "ENTITY_TYPE": "user",
                  "ENTITY_ID": "15"
                },
                {
                  "ENTITY_TYPE": "user",
                  "ENTITY_ID": "23"
                }
              ],
              "QUEUE_TYPE": "strictly",
              "QUEUE_TIME": 45,
              "NO_ANSWER_TIME": 120,
              "WELCOME_MESSAGE": "Y",
              "WELCOME_MESSAGE_TEXT": "Hello! We will respond within a couple of minutes",
              "CRM": "Y",
              "CRM_CREATE": "deal",
              "CRM_SOURCE": "openline_web",
              "CRM_FORWARD": "Y",
              "MAX_CHAT": 4,
              "TYPE_MAX_CHAT": "answered_new",
              "WORKTIME_ENABLE": "Y",
              "WORKTIME_FROM": "09:00",
              "WORKTIME_TO": "21:00",
              "WORKTIME_TIMEZONE": "Europe/Berlin",
              "WORKTIME_DAYOFF": [
                "SA",
                "SU"
              ],
              "WORKTIME_DAYOFF_RULE": "text",
              "WORKTIME_DAYOFF_TEXT": "The line is currently closed. Please write, and we will respond during working hours"
            }
          }' \
          https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/imopenlines.config.add
        
curl -X POST \
          -H "Content-Type: application/json" \
          -H "Accept: application/json" \
          -d '{
            "PARAMS": {
              "LINE_NAME": "Online Store Support Line",
              "QUEUE": [
                {
                  "ENTITY_TYPE": "user",
                  "ENTITY_ID": "1"
                },
                {
                  "ENTITY_TYPE": "user",
                  "ENTITY_ID": "15"
                },
                {
                  "ENTITY_TYPE": "user",
                  "ENTITY_ID": "23"
                }
              ],
              "QUEUE_TYPE": "strictly",
              "QUEUE_TIME": 45,
              "NO_ANSWER_TIME": 120,
              "WELCOME_MESSAGE": "Y",
              "WELCOME_MESSAGE_TEXT": "Hello! We will respond within a couple of minutes",
              "CRM": "Y",
              "CRM_CREATE": "deal",
              "CRM_SOURCE": "openline_web",
              "CRM_FORWARD": "Y",
              "MAX_CHAT": 4,
              "TYPE_MAX_CHAT": "answered_new",
              "WORKTIME_ENABLE": "Y",
              "WORKTIME_FROM": "09:00",
              "WORKTIME_TO": "21:00",
              "WORKTIME_TIMEZONE": "Europe/Berlin",
              "WORKTIME_DAYOFF": [
                "SA",
                "SU"
              ],
              "WORKTIME_DAYOFF_RULE": "text",
              "WORKTIME_DAYOFF_TEXT": "The line is currently closed. Please write, and we will respond during working hours"
            },
            "auth": "**put_access_token_here**"
          }' \
          https://**put_your_bitrix24_address**/rest/imopenlines.config.add
        
try
        {
            const response = await $b24.callMethod(
                'imopenlines.config.add',
                {
                    PARAMS: {
                        LINE_NAME: 'Online Store Support Line',
                        QUEUE: [
                            {
                                ENTITY_TYPE: 'user',
                                ENTITY_ID: '1'
                            },
                            {
                                ENTITY_TYPE: 'user',
                                ENTITY_ID: '15'
                            },
                            {
                                ENTITY_TYPE: 'user',
                                ENTITY_ID: '23'
                            }
                        ],
                        QUEUE_TYPE: 'strictly',
                        QUEUE_TIME: 45,
                        NO_ANSWER_TIME: 120,
                        WELCOME_MESSAGE: 'Y',
                        WELCOME_MESSAGE_TEXT: 'Hello! We will respond within a couple of minutes',
                        CRM: 'Y',
                        CRM_CREATE: 'deal',
                        CRM_SOURCE: 'openline_web',
                        CRM_FORWARD: 'Y',
                        MAX_CHAT: 4,
                        TYPE_MAX_CHAT: 'answered_new',
                        WORKTIME_ENABLE: 'Y',
                        WORKTIME_FROM: '09:00',
                        WORKTIME_TO: '21:00',
                        WORKTIME_TIMEZONE: 'Europe/Berlin',
                        WORKTIME_DAYOFF: ['SA', 'SU'],
                        WORKTIME_DAYOFF_RULE: 'text',
                        WORKTIME_DAYOFF_TEXT: 'The line is currently closed. Please write, and we will respond during working hours'
                    }
                }
            );
        
            const result = response.getData().result;
            console.log(result);
        }
        catch (error)
        {
            console.error(error);
        }
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'imopenlines.config.add',
                    [
                        'PARAMS' => [
                            'LINE_NAME' => 'Online Store Support Line',
                            'QUEUE' => [
                                [
                                    'ENTITY_TYPE' => 'user',
                                    'ENTITY_ID' => '1',
                                ],
                                [
                                    'ENTITY_TYPE' => 'user',
                                    'ENTITY_ID' => '15',
                                ],
                                [
                                    'ENTITY_TYPE' => 'user',
                                    'ENTITY_ID' => '23',
                                ],
                            ],
                            'QUEUE_TYPE' => 'strictly',
                            'QUEUE_TIME' => 45,
                            'NO_ANSWER_TIME' => 120,
                            'WELCOME_MESSAGE' => 'Y',
                            'WELCOME_MESSAGE_TEXT' => 'Hello! We will respond within a couple of minutes',
                            'CRM' => 'Y',
                            'CRM_CREATE' => 'deal',
                            'CRM_SOURCE' => 'openline_web',
                            'CRM_FORWARD' => 'Y',
                            'MAX_CHAT' => 4,
                            'TYPE_MAX_CHAT' => 'answered_new',
                            'WORKTIME_ENABLE' => 'Y',
                            'WORKTIME_FROM' => '09:00',
                            'WORKTIME_TO' => '21:00',
                            'WORKTIME_TIMEZONE' => 'Europe/Berlin',
                            'WORKTIME_DAYOFF' => ['SA', 'SU'],
                            'WORKTIME_DAYOFF_RULE' => 'text',
                            'WORKTIME_DAYOFF_TEXT' => 'The line is currently closed. Please write, and we will respond during working hours',
                        ],
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            print_r($result);
        } catch (Throwable $e) {
            echo $e->getMessage();
        }
        
BX24.callMethod(
            'imopenlines.config.add',
            {
                PARAMS: {
                    LINE_NAME: 'Online Store Support Line',
                    QUEUE: [
                        {
                            ENTITY_TYPE: 'user',
                            ENTITY_ID: '1'
                        },
                        {
                            ENTITY_TYPE: 'user',
                            ENTITY_ID: '15'
                        },
                        {
                            ENTITY_TYPE: 'user',
                            ENTITY_ID: '23'
                        }
                    ],
                    QUEUE_TYPE: 'strictly',
                    QUEUE_TIME: 45,
                    NO_ANSWER_TIME: 120,
                    WELCOME_MESSAGE: 'Y',
                    WELCOME_MESSAGE_TEXT: 'Hello! We will respond within a couple of minutes',
                    CRM: 'Y',
                    CRM_CREATE: 'deal',
                    CRM_SOURCE: 'openline_web',
                    CRM_FORWARD: 'Y',
                    MAX_CHAT: 4,
                    TYPE_MAX_CHAT: 'answered_new',
                    WORKTIME_ENABLE: 'Y',
                    WORKTIME_FROM: '09:00',
                    WORKTIME_TO: '21:00',
                    WORKTIME_TIMEZONE: 'Europe/Berlin',
                    WORKTIME_DAYOFF: ['SA', 'SU'],
                    WORKTIME_DAYOFF_RULE: 'text',
                    WORKTIME_DAYOFF_TEXT: 'The line is currently closed. Please write, and we will respond during working hours'
                }
            },
            function(result)
            {
                if (result.error())
                {
                    console.error(result.error());
                }
                else
                {
                    console.log(result.data());
                }
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'imopenlines.config.add',
            [
                'PARAMS' => [
                    'LINE_NAME' => 'Online Store Support Line',
                    'QUEUE' => [
                        [
                            'ENTITY_TYPE' => 'user',
                            'ENTITY_ID' => '1',
                        ],
                        [
                            'ENTITY_TYPE' => 'user',
                            'ENTITY_ID' => '15',
                        ],
                        [
                            'ENTITY_TYPE' => 'user',
                            'ENTITY_ID' => '23',
                        ],
                    ],
                    'QUEUE_TYPE' => 'strictly',
                    'QUEUE_TIME' => 45,
                    'NO_ANSWER_TIME' => 120,
                    'WELCOME_MESSAGE' => 'Y',
                    'WELCOME_MESSAGE_TEXT' => 'Hello! We will respond within a couple of minutes',
                    'CRM' => 'Y',
                    'CRM_CREATE' => 'deal',
                    'CRM_SOURCE' => 'openline_web',
                    'CRM_FORWARD' => 'Y',
                    'MAX_CHAT' => 4,
                    'TYPE_MAX_CHAT' => 'answered_new',
                    'WORKTIME_ENABLE' => 'Y',
                    'WORKTIME_FROM' => '09:00',
                    'WORKTIME_TO' => '21:00',
                    'WORKTIME_TIMEZONE' => 'Europe/Berlin',
                    'WORKTIME_DAYOFF' => ['SA', 'SU'],
                    'WORKTIME_DAYOFF_RULE' => 'text',
                    'WORKTIME_DAYOFF_TEXT' => 'The line is currently closed. Please write, and we will respond during working hours',
                ],
            ]
        );
        
        print_r($result);
        

Response Handling

HTTP Status: 200

{
            "result": 15,
            "time": {
                "start": 1741688359.737944,
                "finish": 1741688360.028349,
                "duration": 0.2904050350189209,
                "processing": 0.16270899772644043,
                "date_start": "2025-03-11T10:25:59+01:00",
                "date_finish": "2025-03-11T10:26:00+01:00",
                "operating_reset_at": 1741688960,
                "operating": 0
            }
        }
        

Returned Data

Name
type

Description

result
integer

Identifier of the created open channel

time
time

Information about the request execution time

Error Handling

Name
type

Description

error
string

String error code. It may consist of digits, Latin letters, and underscores

error_description
error_description

Textual description of the error. The description is not intended to be shown to the end user in its raw form

Statuses and System Error Codes

HTTP Status: 20x, 40x, 50x

The errors described below may occur when calling any method.

Status

Code
Error Message

Description

500

INTERNAL_SERVER_ERROR
Internal server error

An internal server error has occurred, please contact the server administrator or Bitrix24 technical support

500

ERROR_UNEXPECTED_ANSWER
Server returned an unexpected response

An internal server error has occurred, please contact the server administrator or Bitrix24 technical support

503

QUERY_LIMIT_EXCEEDED
Too many requests

The request intensity limit has been exceeded

405

ERROR_BATCH_METHOD_NOT_ALLOWED
Method is not allowed for batch usage

The current method is not allowed to be called using batch

400

ERROR_BATCH_LENGTH_EXCEEDED
Max batch length exceeded

The maximum length of parameters passed to the batch method has been exceeded

401

NO_AUTH_FOUND
Wrong authorization data

Invalid access token or webhook code

400

INVALID_REQUEST
Https required

The methods must be called using the HTTPS protocol

503

OVERLOAD_LIMIT
REST API is blocked due to overload

The REST API is blocked due to overload. This is a manual individual block, to remove it you need to contact Bitrix24 technical support

403

ACCESS_DENIED
REST API is available only on commercial plans

The REST API is available only on commercial plans

403

INVALID_CREDENTIALS
Invalid request credentials

The user whose access token or webhook was used to call the method lacks permissions

404

ERROR_MANIFEST_IS_NOT_AVAILABLE
Manifest is not available

The manifest is not available

403

insufficient_scope
The request requires higher privileges than provided by the webhook token

The request requires higher privileges than those provided by the webhook token

401

expired_token
The access token provided has expired

The provided access token has expired

403

user_access_error
The user does not have access to the application

The user does not have access to the application. This means that the application is installed, but the account administrator has allowed access to this application only for specific users

500

PORTAL_DELETED
Portal was deleted

The public part of the site is closed. To open the public part of the site on an on-premise installation, disable the option "Temporary closure of the public part of the site". Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site

Continue Learning