Releases: slackapi/bolt-python
version 1.21.2
Changes
References
- Release Milestone: https://github.com/slackapi/bolt-python/milestone/88?closed=1
- All Diff: v1.21.1...v1.21.2
version 1.21.1
Changes
- #1184 Fix a bug where parsing assistant thread message event fails for beta feature enabled apps - Thanks @seratch
References
- Release Milestone: https://github.com/slackapi/bolt-python/milestone/87?closed=1
- All Diff: v1.21.0...v1.21.1
version 1.21.0
New Features
Agents & Assistants
A better Agents & Assistants support in Bolt is now available!
While you already can implement your agents using app.event(...)
listeners for assistant_thread_started
, assistant_thread_context_changed
, and message
events, Bolt offers a simpler approach. You just need to create an Assistant
instance, attach the needed event handlers to it, and then add the assistant to your App
instance.
assistant = Assistant()
# This listener is invoked when a human user opened an assistant thread
@assistant.thread_started
def start_assistant_thread(say: Say, set_suggested_prompts: SetSuggestedPrompts):
# Send the first reply to the human who started chat with your app's assistant bot
say(":wave: Hi, how can I help you today?")
# Setting suggested prompts is optional
set_suggested_prompts(
prompts=[
# If the suggested prompt is long, you can use {"title": "short one to display", "message": "full prompt"} instead
"What does SLACK stand for?",
"When Slack was released?",
],
)
# This listener is invoked when the human user sends a reply in the assistant thread
@assistant.user_message
def respond_in_assistant_thread(
payload: dict,
logger: logging.Logger,
context: BoltContext,
set_status: SetStatus,
say: Say,
client: WebClient,
):
try:
# Tell the human user the assistant bot acknowledges the request and is working on it
set_status("is typing...")
# Collect the conversation history with this user
replies_in_thread = client.conversations_replies(
channel=context.channel_id,
ts=context.thread_ts,
oldest=context.thread_ts,
limit=10,
)
messages_in_thread: List[Dict[str, str]] = []
for message in replies_in_thread["messages"]:
role = "user" if message.get("bot_id") is None else "assistant"
messages_in_thread.append({"role": role, "content": message["text"]})
# Pass the latest prompt and chat history to the LLM (call_llm is your own code)
returned_message = call_llm(messages_in_thread)
# Post the result in the assistant thread
say(text=returned_message)
except Exception as e:
logger.exception(f"Failed to respond to an inquiry: {e}")
# Don't forget sending a message telling the error
# Without this, the status 'is typing...' won't be cleared, therefore the end-user is unable to continue the chat
say(f":warning: Sorry, something went wrong during processing your request (error: {e})")
# Enable this assistant middleware in your Bolt app
app.use(assistant)
Please refer to https://tools.slack.dev/bolt-python/concepts/assistant/ and https://github.com/slack-samples/bolt-python-assistant-template for more details.
Changes
- #1162 Add Agents & Assistants support - Thanks @seratch
- #1142 Add listener_runner to context object to enable developers to leverage lazy listeners in middleware - Thanks @seratch
- #1170 Fix double quoted img alt text in the default OAuth page rendering - @toofishes
- #1173 Expose
auto_acknowledge
option for custom function handlers - Thanks @WilliamBergamin - #1143 Remove
Optional
typing ofcontext.client
- Thanks @WilliamBergamin - #1164 Simplify Python code snippets in authorization.md - Thanks @arkid15r
References
- Release Milestone: https://github.com/slackapi/bolt-python/milestone/86?closed=1
- All Diff: v1.20.1...v1.21.0
version 1.20.1
Changes
- bug: Fix #1131, async classes with "__call__" method are now accepted as middleware by @seratch in #1132
- health: Use the mypy type analyzer by @WilliamBergamin in #1130
- feat: Add option for additional context to Sanic adapter handler by @RohanArepally in #1135
- chore: naming of is_coroutine_function by @WilliamBergamin in #1134
- chore: version 1.20.1 by @WilliamBergamin in #1137
New Contributors
- @RohanArepally made their first contribution in #1135
References
- Release Milestone: https://github.com/slackapi/bolt-python/milestone/83?closed=1
- All Diff: v1.20.0...v1.20.1
version 1.20.0
Changes
Support for custom steps
- feat: add custom step support by @WilliamBergamin in #1021
- docs: document custom step usage by @WilliamBergamin in #1125
Documentation
- docs: adds Docusaurus site by @lukegalbraithrussell in #1113
- docs: sidebar reference link needs to be full URL by @lukegalbraithrussell in #1117
- docs: docusaurus migration nits by @lukegalbraithrussell in #1118
- docs: google analytics tag by @lukegalbraithrussell in #1123
- docs: document custom step usage by @WilliamBergamin in #1125
- chore: purge the "workflow step" terminology by @WilliamBergamin in #1124
Speed up tests
- chore: improve unit test speed by @WilliamBergamin in #1109
Dependencies
- Update pytest requirement from <8.2,>=6.2.5 to >=6.2.5,<8.4 by @dependabot in #1116
Misc
- chore: version 1.20.0 by @WilliamBergamin in #1128
New Contributors
- @lukegalbraithrussell made their first contribution in #1113
References
- Release Milestone: https://github.com/slackapi/bolt-python/milestone/84?closed=1
- All Diff: v1.19.1...v1.20.0
version 1.19.1
Changes
- #1104 Add bot|user_scopes to context.authorize_result set by SingleTeamAuthorization - Thanks @seratch
References
- Release Milestone: https://github.com/slackapi/bolt-python/milestone/84?closed=1
- All Diff: v1.19.0...v1.19.1
version 1.19.0
New Features
WSGI Adapter
#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
#1089 by @WilliamBergamin adds deprecation warnings to Steps from Apps components and documentation.
What's Changed
Fixes
- Fix typo in ja_listening_events.md by @johtani in #1022
- Fix #1074 Customize user-facing message sent when an installation is not managed by bolt-python app by @seratch in #1077
Tests
- Improve socket mode tests by @WilliamBergamin in #991
- remove unused multiprocessing test mode by @WilliamBergamin in #1011
- Replace Flask-Sockets with aiohttp for testing by @WilliamBergamin in #1012
- feat: improve test speed by @WilliamBergamin in #1017
Dependabot
- Bump actions/checkout from 3 to 4 by @dependabot in #1038
- Bump actions/setup-python from 4 to 5 by @dependabot in #1040
- Bump actions/stale from 4.0.0 to 9.0.0 by @dependabot in #1042
- Update werkzeug requirement from <3,>=2 to >=2,<4 by @dependabot in #1041
- Update pytest requirement from <7,>=6.2.5 to >=6.2.5,<9 by @dependabot in #1043
- Update flask requirement from <3,>=1 to >=1,<4 by @dependabot in #1044
- Update gunicorn requirement from <21,>=20 to >=20,<22 by @dependabot in #1045
- Update moto requirement from <5,>=3 to >=3,<6 by @dependabot in #1046
- Bump codecov/codecov-action from 3 to 4 by @dependabot in #1039
- Update django requirement from <5,>=3 to >=3,<6 by @dependabot in #1051
- Update docker requirement from <6,>=5 to >=5,<8 by @dependabot in #1052
- Update websockets requirement from <11 to <13 by @dependabot in #1054
- Update sanic requirement from <23,>=22 to >=22,<24 by @dependabot in #1055
- Update click requirement from <=8.0.4 to <=8.1.7 by @dependabot in #1057
- Update pytest-cov requirement from <5,>=3 to >=3,<6 by @dependabot in #1067
- Update gunicorn requirement from <22,>=20 to >=20,<23 by @dependabot in #1073
Misc
- Configuring with pyproject.toml by @WilliamBergamin in #996
- Maintain metadata by @WilliamBergamin in #999
- feat: use dependabot to maintain packages by @WilliamBergamin in #1037
- release: version 1.19.0 by @WilliamBergamin in #1091
New Contributors
- @johtani made their first contribution in #1022
- @dependabot made their first contribution in #1038
Full Changelog: v1.18.1...v1.19.0
version 1.19.0 RC1
version 1.18.1
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
- Release Milestone: https://github.com/slackapi/bolt-python/milestone/79?closed=1
- All Diff: v1.18.0...v1.18.1
version 1.18.0
Changes
References
- Release Milestone: https://github.com/slackapi/bolt-python/milestone/77?closed=1
- All Diff: v1.17.2...v1.18.0