bolt-python

A framework to build Slack apps using Python

MIT License

Downloads
1.2M
Stars
1.1K
Committers
49

Bot releases are visible (Hide)

bolt-python - version 1.20.1 Latest Release

Published by WilliamBergamin about 2 months ago

Changes

New Contributors

References

bolt-python - version 1.20.0

Published by WilliamBergamin 2 months ago

Changes

Support for custom steps

Documentation

Speed up tests

Dependencies

Misc

New Contributors

References

bolt-python - version 1.19.1

Published by seratch 4 months ago

Changes

  • #1104 Add bot|user_scopes to context.authorize_result set by SingleTeamAuthorization - Thanks @seratch

References

bolt-python - v1.19.0

Published by WilliamBergamin 4 months ago

New Features

WSGI Adapter

https://github.com/slackapi/bolt-python/pull/1085 by @WilliamBergamin introduces an WSGI adapter, this allows bolt to be deployed in production without the need of a 3rd party WSGI compatible web framework. check out the examples in examples/wsgi

Deprecate Steps From Apps

https://github.com/slackapi/bolt-python/pull/1089 by @WilliamBergamin adds deprecation warnings to Steps from Apps components and documentation.

What's Changed

Fixes

Tests

Dependabot

Misc

New Contributors

Full Changelog: https://github.com/slackapi/bolt-python/compare/v1.18.1...v1.19.0

bolt-python - version 1.19.0 RC1

Published by WilliamBergamin 9 months ago

bolt-python - version 1.18.1

Published by seratch 11 months ago

Changes

  • #895 Add metadata to respond method - Thanks @seratch
  • #917 Add port parameter to web_app - Thanks @butsyk
  • #990 Fix #988 app.action listener should accept block_id-only constraints for bolt-js feature parity - Thanks @seratch @darkfoxprime

Test code improvements:

  • #918 Fix #892 Codecov CI job for this project hangs - Thanks @vgnshiyer
  • #987 Fix SocketMode Test - Thanks @WilliamBergamin

References

bolt-python - version 1.18.0

Published by seratch over 1 year ago

Changes

  • #891 Add url, team, user to AuthorizeResult properties (as optional ones) - Thanks @seratch

References

bolt-python - version 1.17.2

Published by seratch over 1 year ago

Changes

  • #885 Improve the default handler when raise_error_for_unhandled_request is true - Thanks @seratch

References

bolt-python - version 1.17.1

Published by seratch over 1 year ago

Changes

  • #882 Improve the default OAuth page renderers not to embed any params without escaping them - Thanks @seratch
  • Upgrade the slack-sdk package version to the latest - Thanks @seratch

References

bolt-python - version 1.17.0

Published by seratch over 1 year ago

New Features

Updates on AuthorizeResult properties

In v1.17, two new optional properties bot_scopes and user_scopes have been added to the AuthorizeResult / AsyncAuthorizeResult classes. These properties are used to associate specific scopes with bot_token and user_token, and the built-in InstallationStore automatically resolves them.

  • bot_scopes: the scopes associated with the bot_token; this can be absent when bot_token does not exist
  • user_scopes: the scopes associated with the user_token; this can be absent when user_token does not exist

These properties are optional, so all the existing Authorize / AsyncAuthorize sub classes are expected to continue functioning without any code changes.

Also, this version includes the fix for the existing bug where the user_id can be absent when both bot_token and user_token exist.

Please refer to https://github.com/slackapi/bolt-python/pull/855 or the details of the changes.

New actor IDs in context

Starting in v1.17, context objects in middleware and listeners provide a few new properties -- actor_enterprise_id, actor_team_id, and actor_user_id--, in addition to existing enterprise_id, team_id, and user_id. You should be curious about the difference. The new "actor" IDs remain the same for interactivity events such as slash commands, global shortcuts, etc. The key difference can appear when your app handles Events API subscription requests such as "app_mention" and "message" events in Slack Connect channels and/or when your app is distributed, and it has multiple workspace installations.

When your app is installed into multiple workspaces and/or by multiple users, the context.user_id can be any of the installed users' ones. Also, if your app is installed into multiple workspaces plus your app is added to a Slack Connect channel shared by those organizations, context.enterprise_id, context.team_id, and context.user_id are associated with any of the workspaces/organizations. Therefore, the tokens provided by bolt-python are still correct, as the tokens are associated with any installations for the received event.

However, when a user mentions your app's bot user in the Slack Connect channel, your app may desire to quickly check if the user (let us call this user "actor") has granted the app with the user's scopes. In this scenario, context.user_id etc. does not work. Instead, you must write your code to identify the "actor"'s workspace and user ID. The newly added "actor" IDs can easily help you handle such patterns. You can rely on the "actor" IDs as long as they exist. In other words, note that they can be absent for some events due to the lack of response data from the Slack server side. Such patterns can be improved by either SDK updates or server-side changes in future versions.

New user_token_resolution option

Related to the above, we added a new option called user_token_resolution: str for App / AsyncApp initialization. The available values for the option are "authed_user" and "actor". The default value is "authed_user", which is fully backward-compatible.

When you set "actor" for the option, your OAuth-enabled app's authorize function can behave differently. More specifically, the authorize function receives all the "actor" IDs. The built-in InstallationStore-based authorize tries to resolve the user token per request using "actor" IDs instead of context.user_id.

Setting "actor" for this option can be beneficial for the apps that require all the users to grant the app some use scopes. In this scenario, your app can easily identify the users who haven't installed the app with sufficient user scopes just by checking the existence of the user token and user scopes in the context.authorize_result object.

If your app does not request any user scopes when installing the app into a workspace, configuring this option does not have any effect on your app.

New before_authorize option

To skip unnecessary workload in a bolt-python app, now you can use before_authorize middleware function for it. Let's say your app receives "message" events but there is nothing to do with subtyped ones such as "message_changed" and "message_deleted". Your authorize function looks up installation data in your database and performs auth.test API calls. In this case, before_authorize can enable the app to skip the authorize operations for subtyped message events this way:

def skip_message_changed_events(payload: dict, next_):
    if payload.get("type") == "message" and payload.get("subtype") in ["message_changed", "message_deleted"]:
        # acknowledge the request and skip all the following middleware/listeners
        return BoltResponse(status=200, body="")
    next_()

Changes

  • #855 #858 Enhance AuthorizeResult to have bot/user_scopes & resolve user_id for user token - Thanks @seratch
  • #854 Introduce actor enterprise/team/user_id for Slack Connect events - Thanks @seratch
  • #869 Add before_authorize middleware - Thanks @seratch
  • #856 Update optional chalice dependency version range - Thanks @seratch
  • #861 Improve token rotation error handling and installation error text - Thanks @seratch

References

bolt-python - version 1.17.0 RC4

Published by seratch over 1 year ago

bolt-python - version 1.17.0 RC3

Published by seratch over 1 year ago

bolt-python - version 1.17.0 RC2

Published by seratch over 1 year ago

bolt-python - version 1.17.0 RC1

Published by seratch over 1 year ago

bolt-python - version 1.16.4

Published by seratch over 1 year ago

Changes

  • #853 Add team param support to the /slack/install endpoint - Thanks @seratch
  • #851 Enable developers to pass fully implemented authorize along with installation_store - Thanks @seratch
  • #848 Enable developers to define app.message listener without args to capture all messages - Thanks @seratch
  • #852 Fix #850 by upgrading slack-sdk version to the latest - Thanks @seratch @garymalaysia

References

bolt-python - version 1.16.3

Published by seratch over 1 year ago

Changes

  • #844 Fix #842 Cannot pass thread_ts to respond() utilit - Thanks @athlindemark @seratch

Document Changes

  • #835 Add documention for injected 'args' param option - Thanks @YSaxon
  • #831 Added redirect url to readme - Thanks @Smyja

References

bolt-python - version 1.16.2

Published by seratch over 1 year ago

Changes

  • #825 Fix perform_bot_token_rotation call in AsyncInstallationStoreAuthorize - Thanks @ccaruceru

References

bolt-python - version 1.16.1

Published by seratch almost 2 years ago

Changes

  • #794 Fix #793 by adding pyramid_request property to Bolt context - Thanks @dz0ny @seratch

Document / Project Updates

  • #792 Adding Handling views on close documentation - Thanks @BrandonDalton
  • #762 Add documentation related to how to handle view_closed events - Thanks @filmaj

References

bolt-python - version 1.16.0

Published by seratch almost 2 years ago

New Features

ASGI Adapter

Since this version, a new adapter that implements the ASGI standard is available. The novel adapter brings the following benefits to developers:

  • A builtin way to deploy HTTP apps to production using the ASGI standard
  • Allow bolt to be deployed on a web servers such as daphne, uvicorn and hypercorn without other dependencies
  • A way to create small, lightweight and efficient docker images for bolt python

The adapter is compatible with both App and AsyncApp. You can run both of the following app code by running uvicorn app:api --reload --port 3000 --log-level debug:


from slack_bolt import App
from slack_bolt.adapter.asgi import SlackRequestHandler

app = App()

@app.event("app_mention")
def handle_app_mentions(say):
    say("What's up?")

api = SlackRequestHandler(app)

Here is an asyncio-based app:

from slack_bolt.async_app import AsyncApp
from slack_bolt.adapter.asgi.async_handler import AsyncSlackRequestHandler

app = AsyncApp()

@app.event("app_mention")
async def handle_app_mentions(say):
    await say("What's up?")

api = AsyncSlackRequestHandler(app)

To learn more on the implementation and grab more code examples, please check @WilliamBergamin's pull request adding the feature: https://github.com/slackapi/bolt-python/pull/780

Changes

  • #780 Add ASGI adapter - Thanks @WilliamBergamin

Document / Project Updates

  • #779 Fixing link to message event subtypes docs - Thanks @filmaj
  • #776 CI python 3.6 bug fix - Thanks @WilliamBergamin
  • #770 Fix #757 by using Falcon 3.1.1 - Thanks @seratch

References

bolt-python - version 1.15.5

Published by seratch almost 2 years ago

Changes

  • #769 Fix #768 The client arg in a listener does not respect the singleton WebClient's retry_handlers - Thanks @seratch

References