2024-10-15 10:50:56 +03:00
---
2024-10-15 10:16:04 +03:00
sidebar_position: 5
2025-05-05 11:15:20 +03:00
description: Send file 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
2025-05-05 09:49:19 +03:00
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Bitrix24]
2024-10-15 10:16:04 +03:00
---
2024-10-15 10:50:56 +03:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2024-10-15 10:16:04 +03:00
# Send file
Send disk file to chat
`Function SendFile(Val URL, Val ChatID, Val FileID, Val Description = "", Val Token = "") Export`
2024-10-15 15:15:47 +03:00
| Parameter | CLI option | Type | Required | Description |
|-|-|-|-|-|
| URL | --url | String | ✔ | URL of webhook or a Bitrix24 domain, when token used |
| ChatID | --chat | String, Number | ✔ | Chat ID |
| FileID | --fileid | String, Number | ✔ | File ID from UploadFileToFolder method |
| Description | --description | String | ✖ | File description |
| Token | --token | String | ✖ | Access token, when app auth method used |
2024-10-15 10:16:04 +03:00
Returns: Map Of KeyAndValue - serialized JSON of answer from Bitrix24 API
<br/>
:::tip
2024-11-21 13:27:18 +03:00
Method at API documentation: [im.disk.file.commit](https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=93&LESSON_ID=11485)
2024-10-15 10:16:04 +03:00
:::
<br/>
2024-10-15 21:15:56 +03:00
```bsl title="1C:Enterprise/OneScript code example"
2025-10-20 19:41:52 +03:00
URL = FunctionParameters["Bitrix24_URL"];
ChatID = FunctionParameters["Bitrix24_HookChatID"];
File = FunctionParameters["Document"]; // Binary Data, URL or path to file
2024-10-15 10:16:04 +03:00
Description = "Very important file";
Directory = OPI_Bitrix24.GetChatFilesFolder(URL, ChatID);
FolderID = Directory["result"]["ID"];
UploadedFile = OPI_Bitrix24.UploadFileToFolder(URL, "Imortant doc.docx", File, FolderID);
FileID = UploadedFile["result"]["ID"];
Result = OPI_Bitrix24.SendFile(URL, ChatID, FileID, Description);
2025-10-20 19:41:52 +03:00
URL = FunctionParameters["Bitrix24_Domain"];
Token = FunctionParameters["Bitrix24_Token"];
ChatID = FunctionParameters["Bitrix24_ChatID"];
2024-10-15 10:16:04 +03:00
Directory = OPI_Bitrix24.GetChatFilesFolder(URL, ChatID, Token);
FolderID = Directory["result"]["ID"];
UploadedFile = OPI_Bitrix24.UploadFileToFolder(URL, "Imortant doc.docx", File, FolderID, Token);
FileID = UploadedFile["result"]["ID"];
Result = OPI_Bitrix24.SendFile(URL, ChatID, FileID, Description, Token);
```
2024-10-20 22:36:03 +03:00
<Tabs>
<TabItem value="bash" label="Bash" default>
```bash
oint bitrix24 SendFile \
2025-10-07 19:27:04 +03:00
--url "b24-ar17wx.bitrix24.by" \
2025-10-15 14:32:00 +03:00
--chat 3266 \
--fileid 44978 \
2025-10-07 19:27:04 +03:00
--description "Very important file" \
2024-10-22 08:59:24 +03:00
--token "***"
2024-10-20 22:36:03 +03:00
```
</TabItem>
<TabItem value="bat" label="CMD/Bat" default>
```batch
oint bitrix24 SendFile ^
2025-10-07 19:27:04 +03:00
--url "b24-ar17wx.bitrix24.by" ^
2025-10-15 14:32:00 +03:00
--chat 3266 ^
--fileid 44978 ^
2025-10-07 19:27:04 +03:00
--description "Very important file" ^
2024-10-22 08:59:24 +03:00
--token "***"
2024-10-20 22:36:03 +03:00
```
</TabItem>
</Tabs>
2024-10-15 10:16:04 +03:00
```json title="Result"
{
"result": {
"FILES": {
2025-10-15 14:32:00 +03:00
"upload44978": {
"id": 44978,
"chatId": 3266,
2024-10-15 10:16:04 +03:00
"date": {},
"type": "file",
"name": "Imortant doc.docx",
"extension": "docx",
"size": 24071,
"image": false,
"status": "done",
"progress": 100,
"authorId": 1,
"authorName": "Антон Титовец",
"urlPreview": "",
2025-10-15 14:32:00 +03:00
"urlShow": "https://b24-ar17wx.bitrix24.by/bitrix/services/main/ajax.php?action=disk.api.file.download&SITE_ID=s1&humanRE=1&fileId=44978&width=1280&height=1280&signature=368b8cdef3e72a6311d281b7551dc05cf27ff27a0786bf6cc08cd477f95f1ea0&exact=N&fileName=Imortant%20doc.docx",
"urlDownload": "https://b24-ar17wx.bitrix24.by/bitrix/services/main/ajax.php?action=disk.api.file.download&SITE_ID=s1&humanRE=1&fileId=44978&width=1280&height=1280&signature=368b8cdef3e72a6311d281b7551dc05cf27ff27a0786bf6cc08cd477f95f1ea0&exact=N&fileName=Imortant%20doc.docx",
2024-10-15 10:16:04 +03:00
"viewerAttrs": {
"viewer": null,
"viewerType": "cloud-document",
2025-10-15 14:32:00 +03:00
"src": "https://b24-ar17wx.bitrix24.by/bitrix/services/main/ajax.php?action=disk.api.file.download&SITE_ID=s1&humanRE=1&fileId=44978&width=1280&height=1280&signature=368b8cdef3e72a6311d281b7551dc05cf27ff27a0786bf6cc08cd477f95f1ea0&exact=N&fileName=Imortant%20doc.docx",
2024-10-15 10:16:04 +03:00
"viewerTypeClass": "BX.Messenger.Integration.Viewer.OnlyOfficeChatItem",
"viewerSeparateItem": true,
"viewerExtension": "im.integration.viewer",
2025-10-15 14:32:00 +03:00
"objectId": "44978",
"imChatId": 3266,
2024-10-15 10:16:04 +03:00
"title": "Imortant doc.docx",
2025-10-15 14:32:00 +03:00
"actions": "[{\"type\":\"download\"},{\"type\":\"copyToMe\",\"text\":\"Сохранить на Диск\",\"action\":\"BXIM.disk.saveToDiskAction\",\"params\":{\"fileId\":\"44978\"},\"extension\":\"disk.viewer.actions\",\"buttonIconClass\":\"ui-btn-icon-cloud\"}]"
2025-09-12 20:23:31 +03:00
},
"mediaUrl": {
"preview": {
"250": ""
}
2025-10-10 09:59:43 +03:00
},
"isTranscribable": false
2024-10-15 10:16:04 +03:00
}
},
"DISK_ID": [
2025-10-15 14:32:00 +03:00
"44978"
2024-10-15 10:16:04 +03:00
],
"FILE_MODELS": {
2025-10-15 14:32:00 +03:00
"upload44978": {
"id": 44978,
2024-10-15 10:16:04 +03:00
"name": "Imortant doc.docx",
"createTime": {},
"updateTime": {},
"deleteTime": null,
"code": null,
"xmlId": null,
"storageId": 6,
2025-10-15 14:32:00 +03:00
"realObjectId": 44978,
"parentId": 44974,
2024-10-15 10:16:04 +03:00
"deletedType": 0,
"createdBy": "1",
"updatedBy": "1",
"deletedBy": "0",
2025-10-15 14:32:00 +03:00
"uniqueCode": "B6BIsHdI7WsUao0PDVfG",
2024-10-15 10:16:04 +03:00
"typeFile": 4,
"globalContentVersion": 2,
2025-10-15 14:32:00 +03:00
"fileId": 30322,
2024-10-15 10:16:04 +03:00
"size": 24071,
2025-10-15 14:32:00 +03:00
"etag": "27d5d5b06cd060fd11fb92271c4c0f31",
2024-10-15 10:16:04 +03:00
"links": {
2025-10-15 14:32:00 +03:00
"download": "/bitrix/services/main/ajax.php?action=disk.file.download&SITE_ID=s1&fileId=44978",
"showInGrid": "/bitrix/tools/disk/focus.php?objectId=44978&action=showObjectInGrid&ncc=1"
2024-10-15 10:16:04 +03:00
}
}
},
2025-10-15 14:32:00 +03:00
"MESSAGE_ID": 64730
2024-10-15 10:16:04 +03:00
},
"time": {
2025-10-15 14:32:00 +03:00
"start": 1760522419,
"finish": 1760522422.56019,
"duration": 3.5601909160614,
2025-10-07 19:27:04 +03:00
"processing": 0,
2025-10-15 14:32:00 +03:00
"date_start": "2025-10-15T10:00:19+00:00",
"date_finish": "2025-10-15T10:00:22+00:00",
"operating_reset_at": 1760523022,
"operating": 0.275109052658081
2024-10-15 10:16:04 +03:00
}
}
```