---
sidebar_position: 1
description: Create chat and other functions to work with Bitrix24 in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Bitrix24]
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Create chat
 Creates a new chat based on the field structure



`Function CreateChat(Val URL, Val ChatStructure, Val Token = "") Export`

  | Parameter | CLI option | Type | Required | Description |
  |-|-|-|-|-|
  | URL | --url | String | &#x2714; | URL of webhook or a Bitrix24 domain, when token used |
  | ChatStructure | --fields | Structure Of KeyAndValue | &#x2714; | Chat fields structure. See GetChatStructure |
  | Token | --token | String | &#x2716; | Access token, when app auth method used |

  
  Returns:  Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API

:::tip
Method at API documentation: [im.chat.add](https://dev.1c-bitrix.ru/learning/course/?COURSE_ID=93&LESSON_ID=12093)
:::
<br/>


```bsl title="1C:Enterprise/OneScript code example"
    Image = "https://hut.openintegrations.dev/test_data/picture.jpg";
    OPI_TypeConversion.GetBinaryData(Image);

    B64Image = GetBase64StringFromBinaryData(Image);

    MembersArray = New Array;
    MembersArray.Add(10);
    MembersArray.Add(1);

    ChatStructure = New Structure;
    ChatStructure.Insert("TYPE"       , "OPEN");
    ChatStructure.Insert("TITLE"      , "New chat");
    ChatStructure.Insert("DESCRIPTION", "This is a new chat");
    ChatStructure.Insert("COLOR"      , "GREEN");
    ChatStructure.Insert("MESSAGE"    , "Welcome to new chat");
    ChatStructure.Insert("USERS"      , MembersArray);
    ChatStructure.Insert("AVATAR"     , B64Image);
    ChatStructure.Insert("OWNER_ID"   , 1);

    URL = "https://b24-ar17wx.bitrix24.by/rest/1/h0m...";

    Result = OPI_Bitrix24.CreateChat(URL, ChatStructure);

    URL   = "b24-ar17wx.bitrix24.by";
    Token = "6ad03969006e9f06006b12e400000001000...";

    ChatStructure = New Structure;
    ChatStructure.Insert("TYPE" , "CHAT");
    ChatStructure.Insert("TITLE", "Private chat");
    ChatStructure.Insert("USERS", MembersArray);

    Result = OPI_Bitrix24.CreateChat(URL, ChatStructure, Token);
```
 

 <Tabs>
  
    <TabItem value="bash" label="Bash" default>
        ```bash
            # JSON data can also be passed as a path to a .json file
            
            oint bitrix24 CreateChat \
             --url "b24-ar17wx.bitrix24.by" \
             --fields "{'TYPE':'CHAT','TITLE':'Private chat','USERS':['10','1']}" \
             --token "***"
        ```
    </TabItem>
  
    <TabItem value="bat" label="CMD/Bat" default>
        ```batch
            :: JSON data can also be passed as a path to a .json file
            
            oint bitrix24 CreateChat ^
             --url "b24-ar17wx.bitrix24.by" ^
             --fields "{'TYPE':'CHAT','TITLE':'Private chat','USERS':['10','1']}" ^
             --token "***"
        ```
    </TabItem>
</Tabs>


```json title="Result"
{
 "result": 3522,
 "time": {
  "start": 1765396618,
  "finish": 1765396618.67572,
  "duration": 0.675724983215332,
  "processing": 0,
  "date_start": "2025-12-10T19:56:58+00:00",
  "date_finish": "2025-12-10T19:56:58+00:00",
  "operating_reset_at": 1765397218,
  "operating": 0
 }
}
```
