You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-11-27 22:18:36 +02:00
118 lines
3.3 KiB
Plaintext
Vendored
118 lines
3.3 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 2
|
|
description: Upload file and other functions to work with Slack 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, Slack]
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# Upload file
|
|
Uploads a file to Slack servers
|
|
|
|
|
|
|
|
`Function UploadFile(Val Token, Val File, Val FileName, Val Title, Val Channel = "") Export`
|
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|-|-|-|-|-|
|
|
| Token | --token | String | ✔ | Bot token |
|
|
| File | --file | String, BinaryData | ✔ | File for upload |
|
|
| FileName | --filename | String | ✔ | File name with extension |
|
|
| Title | --title | String | ✔ | File name in Slack |
|
|
| Channel | --channel | String | ✖ | Channel ID |
|
|
|
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Slack
|
|
|
|
<br/>
|
|
|
|
:::tip
|
|
Parameters with Binary data type can also accept file paths on disk and URLs
|
|
:::
|
|
<br/>
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
Token = "xoxb-6965308400114-696804637...";
|
|
Channel = "C06UFNUTKUL";
|
|
File = "https://hut.openintegrations.dev/test_data/document.docx"; // URL, Binary Data or File path
|
|
|
|
FileName = "megadoc.docx";
|
|
Title = "NewFile";
|
|
|
|
Result = OPI_Slack.UploadFile(Token, File, FileName, Title);
|
|
|
|
Result = OPI_Slack.UploadFile(Token, File, FileName, Title, Channel);
|
|
```
|
|
|
|
|
|
<Tabs>
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
```bash
|
|
oint slack UploadFile \
|
|
--token "***" \
|
|
--file "https://hut.openintegrations.dev/test_data/document.docx" \
|
|
--filename "megadoc.docx" \
|
|
--title "NewFile" \
|
|
--channel "C06UFNUTKUL"
|
|
```
|
|
</TabItem>
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
```batch
|
|
oint slack UploadFile ^
|
|
--token "***" ^
|
|
--file "https://hut.openintegrations.dev/test_data/document.docx" ^
|
|
--filename "megadoc.docx" ^
|
|
--title "NewFile" ^
|
|
--channel "C06UFNUTKUL"
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"ok": true,
|
|
"files": [
|
|
{
|
|
"id": "F09MFCE1U4Q",
|
|
"created": 1760521348,
|
|
"timestamp": 1760521348,
|
|
"name": "megadoc.docx",
|
|
"title": "NewFile",
|
|
"mimetype": "",
|
|
"filetype": "",
|
|
"pretty_type": "",
|
|
"user": "U06UG1CAYH2",
|
|
"user_team": "T06UD92BS3C",
|
|
"editable": false,
|
|
"size": 24069,
|
|
"mode": "hosted",
|
|
"is_external": false,
|
|
"external_type": "",
|
|
"is_public": false,
|
|
"public_url_shared": false,
|
|
"display_as_bot": false,
|
|
"username": "",
|
|
"url_private": "https://files.slack.com/files-pri/T06UD92BS3C-F09MFCE1U4Q/megadoc.docx",
|
|
"url_private_download": "https://files.slack.com/files-pri/T06UD92BS3C-F09MFCE1U4Q/download/megadoc.docx",
|
|
"media_display_type": "unknown",
|
|
"permalink": "https://openintegrationsgroup.slack.com/files/U06UG1CAYH2/F09MFCE1U4Q/megadoc.docx",
|
|
"permalink_public": "https://slack-files.com/T06UD92BS3C-F09MFCE1U4Q-0d45fbe1c2",
|
|
"comments_count": 0,
|
|
"is_starred": false,
|
|
"shares": {},
|
|
"channels": [],
|
|
"groups": [],
|
|
"ims": [],
|
|
"has_more_shares": false,
|
|
"has_rich_preview": false,
|
|
"file_access": "visible"
|
|
}
|
|
]
|
|
}
|
|
```
|