# humanresources.node.communication.edit

URL: https://chugunov.pro/api-bitrix24/departments/node-communication/humanresources-node-communication-edit/
Проверено на Битрикс24 REST API, обновлено 11.09.2026 (ревизия источника fb39d6c).
Источник: официальная документация Битрикс24 (bitrix-tools/b24-rest-docs, лицензия MIT, © Bitrix). Справочник независимый, официальной документацией не является.

Изменить коммуникации отдела
Scope: `humanresources`
Кто может выполнять метод: пользователь с правом «Редактирование отделов» или «Редактирование команд»

## Описание

Метод относится к REST 3.0. Особенности вызова и формат ответа новой версии API описаны в [обзоре REST 3.0](https://chugunov.pro/api-bitrix24/rest-v3/).

Метод `humanresources.node.communication.edit` привязывает, отвязывает или создает чат, канал или коллаб для отдела или команды.

## Параметры

- `nodeId` `integer` — обязательный. Идентификатор отдела или команды.
  Идентификатор можно получить методом [humanresources.node.list](https://chugunov.pro/api-bitrix24/departments/node/humanresources-node-list/)
- `communicationType` `string` — обязательный. Тип коммуникации.
  Возможные значения:
  - `CHAT` — чат
  - `CHANNEL` — канал
  - `COLLAB` — коллаб
- `createDefault` `boolean` — необязательный. Создает коммуникацию по умолчанию для отдела или команды.
  Возможные значения:
  - `true` — создать коммуникацию по умолчанию
  - `false` — не создавать коммуникацию по умолчанию
  По умолчанию — `false`
- `ids` `array` — необязательный. Идентификаторы коммуникаций, которые нужно привязать.
  Идентификаторы чатов и каналов можно получить методом [im.recent.list](https://chugunov.pro/api-bitrix24/chats/im-recent-list/), а идентификаторы коллабов — методом [socialnetwork.api.workgroup.list](https://chugunov.pro/api-bitrix24/sonet-group/socialnetwork-api-workgroup-list/)
- `removeIds` `array` — необязательный. Идентификаторы коммуникаций, которые нужно отвязать.
  Идентификаторы связанных коммуникаций можно получить методом [humanresources.node.communication.list](https://chugunov.pro/api-bitrix24/departments/node-communication/humanresources-node-communication-list/)
- `withChildren` `boolean` — необязательный. Применяет изменение к дочерним отделам и командам.
  Возможные значения:
  - `true` — применить изменение к дочерним отделам и командам
  - `false` — применить изменение только к отделу или команде из параметра `nodeId`
  По умолчанию — `false`

## Ответ

HTTP-статус: 200

```json
{
    "result": {
        "success": true
    },
    "time": {
        "start": 1780407100,
        "finish": 1780407100.186404,
        "duration": 0.18640398979187012,
        "processing": 0.1328411102294922,
        "date_start": "2026-06-02T16:31:40+03:00",
        "date_finish": "2026-06-02T16:31:40+03:00",
        "operating_reset_at": 1780407700,
        "operating": 0
    }
}
```

### Возвращаемые данные

- `result` `object`. Объект с результатом операции
- `success` `boolean`. Значение `true`, если коммуникации изменены
- `time` `time`. Информация о времени выполнения запроса

## Ошибки

HTTP-статус: 400

```json
{
    "error": {
        "code": "BITRIX_REST_V3_EXCEPTION_VALIDATION_REQUESTVALIDATIONEXCEPTION",
        "message": "Ошибка при валидации объекта запроса",
        "validation": [
            {
                "message": "Parameter \"communicationType\" is required.",
                "field": "communicationType"
            }
        ]
    }
}
```

- `Поле` — **Описание ошибки**. **Как исправить**
- `nodeId` — Parameter `"nodeId"` is required.. Передайте идентификатор отдела или команды
- `communicationType` — Parameter `"communicationType"` is required.. Передайте тип коммуникации
- `communicationType` — Invalid `"communicationType"` value. Allowed: `CHAT`, `CHANNEL`, `COLLAB`.. Передайте одно из допустимых значений

## Примеры запроса

### cURL (Webhook)

```bash
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"nodeId":15,"communicationType":"CHAT","ids":[21],"removeIds":[18],"createDefault":false,"withChildren":false}' \
https://**put_your_bitrix24_address**/rest/api/**put_your_user_id_here**/**put_your_webhook_here**/humanresources.node.communication.edit
```

### cURL (OAuth)

```bash
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"nodeId":15,"communicationType":"CHAT","ids":[21],"removeIds":[18],"createDefault":false,"withChildren":false,"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/api/humanresources.node.communication.edit
```

### JS (TS)

```ts
// This snippet is an ES module: top-level await requires type="module" or a bundler.
// $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
import { Text } from '@bitrix24/b24jssdk'
import type { B24Frame } from '@bitrix24/b24jssdk'

declare const $b24: B24Frame

// Shape of the payload returned in result (match the "response handling" section of the page)
type NodeCommunicationEditResult = {
  success: boolean
}

try {
  const response = await $b24.actions.v3.call.make<NodeCommunicationEditResult>({
    method: 'humanresources.node.communication.edit',
    params: {
      nodeId: 15,
      communicationType: 'CHAT',
      ids: [21],
      removeIds: [18],
      createDefault: false,
      withChildren: false,
    },
    requestId: Text.getUuidRfc4122()
  })

  // The payload is available only on a successful response
  if (!response.isSuccess) {
    console.error(response.getErrorMessages().join('; '))
  } else {
    const result = response.getData()!.result
    console.info('Communication edited successfully:', result.success)
  }
} catch (error) {
  // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
  console.error(error)
}
```

### JS (UMD)

```html
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
<script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
<script>
  async function editNodeCommunication() {
    try {
      // Initialize the SDK inside a Bitrix24 frame
      const $b24 = await B24Js.initializeB24Frame()

      const response = await $b24.actions.v3.call.make({
        method: 'humanresources.node.communication.edit',
        params: {
          nodeId: 15,
          communicationType: 'CHAT',
          ids: [21],
          removeIds: [18],
          createDefault: false,
          withChildren: false,
        },
        requestId: B24Js.Text.getUuidRfc4122()
      })

      // The payload is available only on a successful response
      if (!response.isSuccess) {
        console.error(response.getErrorMessages().join('; '))
        return
      }

      const result = response.getData().result
      console.info('Communication edited successfully:', result.success)
    } catch (error) {
      // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
      console.error(error)
    }
  }

  document.addEventListener('DOMContentLoaded', editNodeCommunication)
</script>
```

### Python

```python
from b24pysdk.errors import BitrixAPIError, BitrixSDKException

try:
    bitrix_response = client.humanresources.node.communication.edit(
        node_id=15,
        communication_type='CHAT',
        ids=[
            21,
        ],
        remove_ids=[
            18,
        ],
        create_default=False,
        with_children=False,
    ).response
    result = bitrix_response.result
    print(result)
except BitrixAPIError as error:
    print(
        "Ошибка Bitrix API",
        f"error: {error.error}",
        f"error_description: {error.error_description}",
        sep="\n",
    )
except BitrixSDKException as error:
    print(f"Ошибка Bitrix SDK: {error.message}")
except Exception as error:
    print(f"Непредвиденная ошибка: {error}")
```

### PHP

```php
try {
    $response = $b24Service
        ->core
        ->call(
            'humanresources.node.communication.edit',
            [
                'nodeId' => 15,
                'communicationType' => 'CHAT',
                'ids' => [21],
                'removeIds' => [18],
                'createDefault' => false,
                'withChildren' => false,
            ]
        );

    $result = $response
        ->getResponseData()
        ->getResult();

    echo 'Success: ' . print_r($result, true);

} catch (Throwable $e) {
    error_log($e->getMessage());
    echo 'Error: ' . $e->getMessage();
}
```

### BX24.js

```js
BX24.callMethod(
    'humanresources.node.communication.edit',
    {
        nodeId: 15,
        communicationType: 'CHAT',
        ids: [21],
        removeIds: [18],
        createDefault: false,
        withChildren: false
    },
    function(result){
        console.info(result.data());
        console.log(result);
    }
);
```

### PHP CRest

```php
require_once('crest.php');

$result = CRest::call(
    'humanresources.node.communication.edit',
    [
        'nodeId' => 15,
        'communicationType' => 'CHAT',
        'ids' => [21],
        'removeIds' => [18],
        'createDefault' => false,
        'withChildren' => false,
    ]
);

echo '<PRE>';
print_r($result);
echo '</PRE>';
```

### Go

```go
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "humanresources.node.communication.edit", b24.Params{
	"nodeId":            15,
	"communicationType": "CHAT",
	"ids":               []int{21},
	"removeIds":         []int{18},
	"createDefault":     false,
	"withChildren":      false,
})
if err != nil {
	return fmt.Errorf("humanresources.node.communication.edit: %w", err)
}

var item struct {
	Success bool `json:"success"`
}
if err := json.Unmarshal(res.Result, &item); err != nil {
	return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println(item.Success)
```

Оригинал в официальной документации: https://apidocs.bitrix24.ru/api-reference/departments/node-communication/humanresources-node-communication-edit.html
