Skip to content

Releases: slackapi/bolt-python

version 1.3.0

05 Feb 02:49

Choose a tag to compare

This release upgrades the underlying slack-sdk package from 3.2 to 3.3. Refer to the package's release note for more details: https://github.com/slackapi/python-slack-sdk/releases/tag/v3.3.0

Changes

References

version 1.2.3

20 Jan 08:29

Choose a tag to compare

Changes

References

version 1.2.2

19 Jan 04:21

Choose a tag to compare

Changes

References

version 1.2.1

12 Jan 23:54

Choose a tag to compare

Changes

  • #203 Fix #198 bug where str subtype constraint does not work - Thanks @seratch

References

version 1.2.0

12 Jan 22:30

Choose a tag to compare

New Features

Socket Mode

This version includes support for Socket Mode, which enables developers to receive interactivy payalods and events through WebSocket connections.

https://api.slack.com/socket-mode

For WebSocket connection handling, there are four implementations including major 3rd party open-source libraries.

PyPI Project Bolt Adapter
skack_sdk slack_bolt.adapter.socket_mode.SocketModeHandler
websocket_client slack_bolt.adapter.socket_mode.websocket_client.SocketModeHandler
aiohttp (asyncio-based) slack_bolt.adapter.socket_mode.aiohttp.AsyncSocketModeHandler
websockets (asyncio-based) slack_bolt.adapter.socket_mode.websockets.AsyncSocketModeHandler

Here is a minimal working example with the built-in WebSocket client. You can switch to other implementation by changing the imports and adding the extra dependencies (websocket_client, aiohttp, websockets).

import os
from slack_bolt import App
from slack_bolt.adapter.socket_mode import SocketModeHandler

# Install the Slack app and get xoxb- token in advance
app = App(token=os.environ["SLACK_BOT_TOKEN"])

if __name__ == "__main__":
    # export SLACK_APP_TOKEN=xapp-***
    # export SLACK_BOT_TOKEN=xoxb-***
    SocketModeHandler(app, os.environ["SLACK_APP_TOKEN"]).start()

If you want to use asyncio for everything, you can use aiohttp or websockets (along with aiohttp for AsyncWebClient). AsyncSocketModeHandler requires all of your middleware/listeners to be compatible with the async/await programming style.

from slack_bolt.app.async_app import AsyncApp
# The default is the aiohttp based implementation
from slack_bolt.adapter.socket_mode.async_handler import AsyncSocketModeHandler

app = AsyncApp(token=os.environ["SLACK_BOT_TOKEN"])

async def main():
    handler = AsyncSocketModeHandler(app, os.environ["SLACK_APP_TOKEN"])
    await handler.start_async()

if __name__ == "__main__":
    import asyncio
    asyncio.run(main())

Changes

References

version 1.1.5

07 Jan 03:36

Choose a tag to compare

Changes

References

version 1.1.4

19 Dec 03:53

Choose a tag to compare

Changes

  • #180 Fix #158 by adding token_verification_enabled option to App - Thanks @seratch
  • #167 Upgrade black (code formatter) to the latest version - Thanks @seratch

References

version 1.1.3

16 Dec 08:13

Choose a tag to compare

This patch version is a hotfix release for v1.1.2. If you use installation_store_bot_only option, please upgrade to this version.

Changes

  • #177 #178 Enable to use installation_store_bot_only flag not only as the top-level arg - Thanks @seratch

References

version 1.1.2

08 Dec 07:17

Choose a tag to compare

New Features

v1.0 authorize compatible mode

Now you can use InstallationStore's v1.0 compatible mode in authorize.

Setting App/AsyncApp's installation_store_bot_only constructor argument as True works in the same manner as v1.0 authorize. If you manually initialize InstallationStoreAuthorize, bot_only flag in it is the one you can configure. See the pull request #171 for more details.

installation_store = MyInstallationStore()
oauth_state_store = MyOAuthStateStore()

app = App(
    # If you want to keep using only `#find_bot` for token retrieval,
    # you can configure installation_store_bot_only as True
    installation_store_bot_only=True,
    oauth_settings=OAuthSettings(
        installation_store=installation_store,
        state_store=oauth_state_store,
    ),
)

NOTE: If you use installation_store_bot_only flag in OAuthFlow or OAuthSettings, please upgrade to v1.1.3 or higher.

Changes

References

version 1.1.1

03 Dec 10:33

Choose a tag to compare

Changes

  • #165 #168 Provide a way to easily use aiohttp-devtools for AsyncApp apps - Thanks @stevegill @seratch
  • #169 Improve request parser to safely extract values from payloads in any case - Thanks @seratch

References