Releases: slackapi/python-slack-sdk
version 3.19.2
Changes
- #1282 Add request_file_info arg to files_upload_v2 method - Thanks @seratch @eddyg
- #1278 Improve clarity of 'content' error message for files_upload_v2 - Thanks @eddyg
- #1283 Improve typing when using 'get' on an API response - Thanks @eddyg
- #1284 Add Python 3.11 support - Thanks @seratch
- #1281 Fix selected_option type hint - Thanks @taekop
- All issues/pull requests: https://github.com/slackapi/python-slack-sdk/milestone/71?closed=1
- All changes: v3.19.1...v3.19.2
version 3.19.1
Changes
- Improve
WebClient#files_upload_v2()
to use given filename as the default title value - Thanks @seratch @mattpr
- All changes: v3.19.0...v3.19.1
version 3.19.0
New Features
files.upload v2 in WebClient
/ AsyncWebClient
We've received many reports on the performance issue of the existing files.upload
API (refer to #1191 #1165 for details). So, to cope with the problem, our platform team decided to unlock a new way to upload files to Slack via public APIs. To utilize the new approach, developers need to implement the following steps on their code side:
- Call
WebClient#files_getUploadURLExternal()
method to receive a URL to use for each file - Perform an HTTP POST request to the URL you received in step 1 for each file
- Call
WebClient#files_completeUploadExternal()
method with the pairs of file ID and title to complete the whole process, plus share the files in a channel If you need the full metadata of the files, callUPDATE: Since v3.23.0, this API call is no longer requiredWebClient#files_info()
method for each file
We do understand that writing the above code requires many lines of code. Also, the existing WebClient#files_upload()
users have to take a certain amount of time for migration. To mitigate the pain, we've added a wrapper method named WebClient#files_upload_v2()
on the SDK side.
Also, in addition to the performance improvements, another good news is that 3rd party apps can now upload multiple files at a time!
See the following code examples demonstrating how the wrapper method works:
import os
from slack_sdk import WebClient
client = WebClient(token=os.environ["SLACK_BOT_TOKEN"])
# Legacy way
response = client.files_upload(
file="./logo.png",
title="New company logo",
channels=["C12345"],
initial_comment="Here is the latest version of our new company logo :wave:",
)
response.get("file") # returns the full metadata of the uploaded file
# New way - the same parameters works in most cases
response = client.files_upload_v2(
file="./logo.png",
title="New company logo",
# Note that channels still works but going with channel="C12345" is recommended
# channels=["C111", "C222"] is no longer supported. In this case, an exception can be thrown
channels=["C12345"],
initial_comment="Here is the latest version of our new company logo :wave:",
)
response.get("file") # returns the full metadata of the uploaded file
# New way with multiple files!
response = client.files_upload_v2(
file_uploads=[
{
"file": "./logo.png",
"title": "New company logo",
},
{
"content": "Minutes ....",
"filename": "team-meeting-minutes-2022-03-01.md",
"title": "Team meeting minutes (2022-03-01)",
},
],
channel="C12345",
initial_comment="Here is the latest version of our new company logo :wave:",
)
response.get("files") # returns the full metadata of all the uploaded files
When migrating to the v2 method, please note that the new method requires both UPDATE: Since v3.23.0, files:write
and files:read
scopes. If your existing apps have only files:write
scope for uploading files, you need to add files:read
to the scopes plus re-install the app to issue an updated token.files:read
scope is no longer required.
Changes
- All issues/pull requests: https://github.com/slackapi/python-slack-sdk/milestone/64?closed=1
- All changes: v3.18.5...v3.19.0
version 3.18.5
Changes
- #1271 Add more revert to #1269 - Thanks @seratch @yardensachs
- All issues/pull requests: https://github.com/slackapi/python-slack-sdk/milestone/68?closed=1
- All changes: v3.18.4...v3.18.5
version 3.18.4
Changes
- #1264 Fix retry_handlers type hint in AsyncBaseClient - Thanks @ronyb29
- #1265 #1266 Add selected_time (timepicker) to ViewStateValue class - Thanks @rei-0
- #1270 Add include_all_metadata to conversations.replies API arguments - Thanks @seratch
- #1269 Adjust the logic added by #1246 - Thanks @seratch @eddyg
- All issues/pull requests: https://github.com/slackapi/python-slack-sdk/milestone/67?closed=1
- All changes: v3.18.3...v3.18.4
version 3.18.3
Changes
- #1262 Fix #1261 blocks/attachments as str for chat.* API calls should be clearly supported - Thanks @seratch
- All issues/pull requests: https://github.com/slackapi/python-slack-sdk/milestone/66?closed=1
- All changes: v3.18.2...v3.18.3
version 3.18.2
Changes
- #1259 Fix #1258 Tuple value for blocks argument does not work for Web API calls - Thanks @tommasobertoni
- #1253 Minor update: max elements in ActionsBlock to 25 - Thanks @YSaxon
- #1249 #1251 Add in timezone property for timepicker element - Thanks @hello-ashleyintech
- All issues/pull requests: https://github.com/slackapi/python-slack-sdk/milestone/65?closed=1
- All changes: v3.18.1...v3.18.2
version 3.18.1
Changes
- #1246 rtm_v2 api spins in infinite loop under gevent - Thanks @mattbillenstein
Document Changes
- #1244 #1245 Update aiohttp documentation sampleUpdate aiohttp documentation sample - Thanks @srajiang @DonDebonair
- All issues/pull requests: https://github.com/slackapi/python-slack-sdk/milestone/63?closed=1
- All changes: v3.18.0...v3.18.1
version 3.18.0
Changes
- #1237 Fix #1236 Add video block to Block Kit model classes - Thanks @seratch
- #1241 Fix #1240 Update chat_unfurl to support source/unfurl_id parameters - Thanks @seratch @angrychimp
- #1234 #1235 Fix many type hint errors - Thanks @ehdgua01
- All issues/pull requests: https://github.com/slackapi/python-slack-sdk/milestone/54?closed=1
- All changes: v3.17.2...v3.18.0
version 3.17.2
Changes
- #1232 Fix #1230 "unpack requires a buffer of 2 bytes" error when we have many options / option groups - Thanks @seratch @adamtheturtle
- All issues/pull requests: https://github.com/slackapi/python-slack-sdk/milestone/61?closed=1
- All changes: v3.17.1...v3.17.2