releases.shpreview
Slack/Python SDK

Python SDK

$npx -y @buildinternet/releases show slack-python-sdk
Mon
Wed
Fri
AprMayJunJulAugSepOctNovDecJanFebMarApr
Less
More
Releases4Avg1/moVersionsv3.40.0.dev0 → v3.41.0
Feb 17, 2022
version 3.15.0

Changes


Feb 8, 2022
version 3.14.1

Changes

  • #1173 Fix a bug where some of the files.remote API parameters do not work since v3.10 - Thanks @seratch

Feb 7, 2022
version 3.14.0

Changes

  • #1172 #1169 The built-in SocketMode client fails to establish WS connections via proxy server - Thanks @seratch @Lordshinjo
  • #1161 Add admin.apps.requests.cancel API method support - Thanks @seratch
  • #1152 Stop raising asyncio.CancelledError if the connection is already closed - Thanks @seratch @vectoralpha
  • #1167 Add accessibility_label to button block element - Thanks @seratch
  • #1171 Fix #1170 Add TimePickerElement to BlockElement.parse - Thanks @iress-willygo

Document Updates

  • #1163 #1160 Links in README don't render properly on PyPi project page - Thanks @seratch @misscoded

Dec 15, 2021
version 3.13.0b1

What's Changed

Add Support for Subscribe in Slack (apps.manifest.*) by @srajiang in #1151

Subscribe in Slack

This release includes support for apps.notifications.subscriptions.* endpoints and adds message metadata field to the chat.postMessage and chat.update arguments.

apps.notifications.subscriptions.create apps.notifications.subscriptions.update apps.notifications.subscriptions.delete


Full Changelog: v3.13.0...v3.130b1

Dec 10, 2021
version 3.13.0

Changes

  • #1140 Add focus_on_load support in Block Kit - Thanks @seratch
  • #1147 Add cursor parameter to Audit Logs API method - Thanks @seratch
  • #1143 #1148 Capitalized Retry-After header missing since 3.12.0 - Thanks @joekohlsdorf @seratch
  • #1141 Add GitHub stale action for better triaging issues - Thanks @srajiang @seratch
  • #1149 Upgrade black, flake8, and pytype - Thanks @seratch

Document Updates

  • #1139 #1086 Add interactivity patterns in SocketModeClient document - Thanks @ruberVulpes

Nov 24, 2021
version 3.12.0

Changes

  • #1129 Add Python 3.10 to the supported versions - Thanks @seratch
  • #1132 Add team.* & admin.users.session.resetBulk APIs - Thanks @seratch
  • #1127 #1135 Add more docstrings to slack_sdk.models classes - Thanks @seratch
  • #1134 Make the aiohttp-based SocketModeClient's debug logging more consistent with the built-in one (#1122) - Thanks @seratch
  • #1131 #1137 Add the method to check equality in Block Kit model classes - Thanks @kokko-san @uroboro
  • #1130 Audit Logs API: Add new details properties for channel_posting_permissions_updated action - Thanks @seratch
  • #1128 #1136 Enable pytype and fix detected issues - Thanks @seratch

Oct 8, 2021
version 3.12.0b1

What's Changed

App Manifests

This release includes support for app manifests. The apps.manifest.* endpoints can be used to create, delete, update, and copy your Slack apps with ease. New endpoints include:

Full Changelog: https://github.com/slackapi/python-slack-sdk/compare/v3.11.2...v3.12.0b1

Sep 21, 2021
version 3.11.2

Changes

  • #1120 Change a websockets import to make it compatible with older versions - Thanks @seratch

Sep 18, 2021
version 3.11.1

Changes

  • #1117 asyncio-based Socket Mode client improvements - Thanks @seratch @matthieucan

Sep 14, 2021
version 3.11.0

Changes

  • #1110 #1112 Socket Mode disconnection issue with the aiohttp-based client - Thanks @matthieucan @seratch @filmaj
  • #1114 Improve Socket Mode client implementations to be more robust while reconnecting - Thanks @seratch @filmaj
  • #1115 Remove confusing warning from FileInstallationStore - Thanks @seratch @filmaj
  • #1113 Add missing properties in Audit Logs details data class - Thanks @seratch
  • #1108 #1109 Add support for admin.conversations.* for retention settings - Thanks @ruberVulpes

Sep 9, 2021
version 3.11.0rc1
Aug 26, 2021
version 3.10.1

Changes

  • #1106 Fix WebClient#files_upload does not send channels since v3.10.0 - Thanks @seratch

version 3.10.0

New Features

All argument supports in WebClient / AsyncWebClient

Since this version, all the methods in WebClient / AsyncWebClient have not only required arguments but also all possible ones in the method signature for better developer experience. Refer to the pull request enabling this #1099 for details.

Easier way to test if a key exists in a Web API response

Now that SlackResponse / AsyncSlackResponse now have __contains__ method, you can test if a key exists in WebClient responses. Refer to the pull request enabling this #1104 for details.

token = "xoxb-"
response = WebClient(token).auth_test()
"error" in response  # True / False

Changes

  • #1099 Fix #1018 Add optional arguments in WebClient methods - Thanks @seratch
  • #1104 Fix #1102 Add __contains__ method in slack_sdk.web.SlackResponse / AsyncSlackResponse - Thanks @seratch
  • #1097 Fix #1056 by changing the default type for Option values - Thanks @weallwegot @seratch
  • #1096 Fix #1095 by correcting ContextBlock element type hint - Thanks @uroboro @seratch
  • #1103 Fix #1100 by improving the get/__getitem__ method behavior when response body is empty - Thanks @janeliang0522 @seratch
  • #1105 Update the entity name in metadata / documents - Thanks @seratch

Aug 17, 2021
version 3.9.1

Changes

  • #1094 Improve #1084 to run rate limited error retry handler correctly - Thanks @seratch
  • #1083 Fix #1082 by ignoring proxy parameter if env parameter is set but empty - Thanks @y-adachi-00one

Aug 13, 2021
version 3.9.0

New Features

Sign in with Slack (OpenID Connect)

Sign in with Slack helps users log into your service using their Slack profile. The platform feature was recently upgraded to be compatible with the standard OpenID Connect specification. With this version of slack-sdk, implementing the auth flow is much easier.

When you create a new Slack app, set the following user scopes:

oauth_config:
  redirect_urls:
    - https://{your-domain}/slack/oauth_redirect
  scopes:
    user:
      - openid   # required
      - email    # optional
      - profile  # optional

Check the Flask example in the repository. It does the following:

  • Build the OpenID Connect comaptible authorize URL
    • slack_sdk.oauth.OpenIDConnectAuthorizeUrlGenerator helps you easily do this
    • OAuthStateStore is still available for generating state parameter value (it's available for nonce management too)
  • WebClient can perform openid.connect.token API calls with given code parameter

If you want to know the way with asyncio, check the Sanic app example in the same directory.

Built-in Retry Handlers

This version introduces a built-in retry functionalities to the following API clients:

  • slack_sdk.web.WebClient
  • slack_sdk.webhook.WebhookClient
  • slack_sdk.audit_logs.AuditLogsClient
  • slack_sdk.scim.SCIMClient
  • slack_sdk.web.async_client.AsyncWebClient (aiohttp/asyncio compatible)
  • slack_sdk.webhook.async_client.AsyncWebhookClient (aiohttp/asyncio compatible)
  • slack_sdk.audit_logs.async_client.AsyncAuditLogsClient (aiohttp/asyncio compatible)
  • slack_sdk.scim.async_client.AsyncSCIMClient (aiohttp/asyncio compatible)

With the default settings, only slack_sdk.http_retry.builtin_handlers.ConnectionErrorRetryHandler (AsyncConnectionErrorRetryHandler for asyncio clients) with its default configuratio (=only one retry in the manner of exponential backoff and jitter) is enabled in the above clients. The retry handler retries if an API client encounters a connectivity-related failure (e.g., Connection reset by peer).

import os
from slack_sdk.web import WebClient

# Only ConnectionErrorRetryHandler is enabled
client = WebClient(token=os.environ["SLACK_BOT_TOKEN"])

Another built-in retry handler is the one that handles rate limited errors.

# --------------------------------
# Use the built-in handlers
# --------------------------------

client = WebClient(token=os.environ["SLACK_BOT_TOKEN"])

# This handler does retries when HTTP status 429 is returned
from slack_sdk.http_retry.builtin_handlers import RateLimitErrorRetryHandler
rate_limit_handler = RateLimitErrorRetryHandler(max_retry_count=1)
# Enable rate limited error retries as well
cient.retry_handlers.append(rate_limit_handler)

Creating your own ones is also quite simple. Defining a new class that inherits slack_sdk.http_retry.RetryHandler and implements required methods (internals of can_retry / prepare_for_next_retry). Check the built-in ones' source code for learning how to properly implement.

# --------------------------------
# Create your own one
# --------------------------------

import socket
from typing import Optional
from slack_sdk.http_retry import (RetryHandler, RetryState, HttpRequest, HttpResponse)
from slack_sdk.http_retry.builtin_interval_calculators import (
    BackoffRetryIntervalCalculator,
)
from slack_sdk.http_retry.jitter import RandomJitter

class MyRetryHandler(RetryHandler):
    def _can_retry(
        self,
        *,
        state: RetryState,
        request: HttpRequest,
        response: Optional[HttpResponse] = None,
        error: Optional[Exception] = None
    ) -> bool:
        # [Errno 104] Connection reset by peer
        return (
            error is not None and isinstance(error, socket.error) and error.errno == 104
        )

# Customize the settings
my_handler = MyRetryHandler(
    max_retry_count=2,  # retry twice at maximum; the default is 1
    interval_calculator=BackoffRetryIntervalCalculator(  # exponential backoff and jitter is the default
        backoff_factor=1.0,  # 1, 2, 4, 8, 16 seconds later ...
        jitter=RandomJitter(),  # will add 0.0 -- 1.0 second to the backoff duration
    ),
)

client = WebClient(
    token=os.environ["SLACK_BOT_TOKEN"],
    retry_handlers=[rate_limit_handler, my_handler],
)

For asyncio apps, Async prefixed corresponding modules are available. All the methods in those methods are async/await compatible. Check the source code and tests for more details.

Changes

  • #1079 Fix #1078 Add Sign in with Slack (OpenID Connect) support - Thanks @seratch
  • #1084 Fix #887 Enable automatic retry by a handy way - Thanks @seratch
  • #1089 #1058 Add Slack Connect API support - Thanks @srajiang
  • #1067 Fix #1065 by having lock for async Socket Mode client reconnection - Thanks @seratch @matthieucan
  • #1091 #1055 Socket Mode: ENOTSOCK every 300 minutes on Windows - Thanks @dubois @seratch
  • #1077 Fix the wrong column data size for bot_token in the built-in SQLAlchemy data model - Thanks @geeorgey
  • #1081 Fix a data deletion bug in AmazonS3InstallationStore - Thanks @seratch
  • #1085 Add explicit arguments for files_* methods - Thanks @jaebradley
  • #1076 Update example code for rate limiting in documents - Thanks @tjstum
  • #1071 #1070 Link to Contributor's Guide from README + expand Maintainer's Guide - Thanks @filmaj
  • #1072 Fix WebSocket related unit test failures - Thanks @seratch

version 3.9.0rc2
Aug 7, 2021
version 3.9.0rc1
Jul 15, 2021
version 3.8.0

New Features

Token Rotation Support

This version includes the token rotation feature support for better security. Refer to the API document for the general information about the feature.

How to enable token rotation with this SDK

Apart from the column additions for the feature (specifically, refresh token + expiration date time) and the corresponding changes in your app code, no significant code is needed. Checking the example apps using Flask, Sanic in this directory can be helpful to learn what to do.

In a nutshell, you can call the following rotate_tokens method before handling every single incoming request from Slack. As long as your InstallationStore support the token rotation patterns, the code below should work as-is.

from slack_sdk.oauth.token_rotation import TokenRotator
from slack_sdk.oauth.installation_store import FileInstallationStore

# This instance can be singleton; thread-safe
token_rotator = TokenRotator(
    # These are required for refreshing tokens
    client_id=client_id,
    client_secret=client_secret,
)
# Your own InstallationStore here
installation_store = FileInstallationStore()

def rotate_tokens(
    enterprise_id: Optional[str] = None,
    team_id: Optional[str] = None,
    user_id: Optional[str] = None,
    is_enterprise_install: Optional[bool] = None,
):
    installation = installation_store.find_installation(
        enterprise_id=enterprise_id,
        team_id=team_id,
        user_id=user_id,
        is_enterprise_install=is_enterprise_install,
    )
    if installation is not None:
        # If rotation does not occur, refreshed_installation is None
        refreshed_installation = token_rotator.perform_token_rotation(installation=installation)
        if refreshed_installation is not None:
            # Save the new access token for the following processes
            installation_store.save(refreshed_installation)

Migration guide for SQLAlchemyInstallationStore users

If your app uses the built-in SQLAlchemyInstallationStore for managing Slack app installations, adding the following database columns is required for this version upgrade. Refer to the code to check the complete ones.

Also, since this version, all the table columns for string data have their max length for better compatibility with MySQL. We recommend setting the same ones for your models.

slack_installations
  • Column("bot_refresh_token", String(200)),
  • Column("bot_token_expires_at", DateTime),
  • Column("user_refresh_token", String(200)),
  • Column("user_token_expires_at", DateTime),
slack_bots
  • Column("bot_refresh_token", String(200)),
  • Column("bot_token_expires_at", DateTime),

Changes

  • #1060 Add token rotation feature support - Thanks @seratch
  • #1040 Set max length for string columns in SQLAlchemy models for MySQL compatibility - Thanks @tattee
  • #1047 Make WebhookClient (sync/async) #send method accept link unfurl params - Thanks @srajiang
  • #1061 WebClient's paginated response iterator does not work for admin.conversations.search API - Thanks @seratch
  • #1054 #1053 conversations_invite() fails with "error: no_user" - Thanks @seratch @noperator
  • #1044 Updates PythOnBoardingBot tutorial sample to use bolt-python - Thanks @srajiang
  • #1048 Update command in maintainers guide - Thanks @srajiang

Jun 16, 2021
version 3.7.0

Changes

  • #1035 IntervalRunner: don't wait for interval_seconds on shutdown - Thanks @KostyaEsmukov
  • #1036 Add support for IPv6 in the built-in Socket Mode client - Thanks @KostyaEsmukov
  • #1029 Update Audit Logs API response properties - Thanks @seratch
  • #1039 Fix #1038 by adding admin.auth.policy.* API support - Thanks @seratch
  • #1032 Remove confusing warning messages #1030 - Thanks @ido-vcita @seratch
  • #1034 Remove an outdated link from README - Thanks @personalcomputer

Jun 4, 2021
version 3.6.0

Changes

  • #1011 Add admin.apps.uninstall support - Thanks @seratch
  • #876 Add timepicker block element support - Thanks @seratch
  • #1022 Fix #1021 by updating View constructor to convert state as dict to class object - Thanks @rei-0 @seratch
  • #1026 Fix #1025 websocket_client based SocketModeClient may fail in on_close callback - Thanks @seratch
  • #1028 [#1027] Update websockets package version requirements - Thanks @ggml1

Latest
v3.41.0
Tracking Since
Oct 22, 2020
Last checked Apr 19, 2026