Releases: slackapi/bolt-python
v1.26.0
AI-Enabled Features: Loading States, Text Streaming, and Feedback Buttons
🍿 Preview
2025-10-06-loading-state-text-streaming-feedback.mov
📚 Changelog
⚡ Getting Started
Try the AI Agent Sample app to explore the AI-enabled features and existing Assistant helper:
# Create a new AI Agent app
$ slack create slack-ai-agent-app --template slack-samples/bolt-python-assistant-template
$ cd slack-ai-agent-app/
# Initialize Python Virtual Environment
$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt
# Add your OPENAI_API_KEY
$ export OPENAI_API_KEY=sk-proj-ahM...
# Run the local dev server
$ slack run
After the app starts, send a message to the "slack-ai-agent-app" bot for a unique response.
⌛ Loading States
Loading states allows you to not only set the status (e.g. "My app is typing...") but also sprinkle some personality by cycling through a collection of loading messages.
Bolt Assistant Class usage:
@assistant.user_message
def respond_in_assistant_thread(
client: WebClient,
context: BoltContext,
get_thread_context: GetThreadContext,
logger: Logger,
payload: dict,
say: Say,
set_status: SetStatus,
):
set_status(
status="thinking...",
loading_messages=[
"Teaching the hamsters to type faster…",
"Untangling the internet cables…",
"Consulting the office goldfish…",
"Polishing up the response just for you…",
"Convincing the AI to stop overthinking…",
],
)
Web Client SDK usage:
@app.message()
def handle_message(client, context, event, message):
client.assistant_threads_setStatus(
channel_id=channel_id,
thread_ts=thread_ts,
status="thinking...",
loading_messages=[
"Teaching the hamsters to type faster…",
"Untangling the internet cables…",
"Consulting the office goldfish…",
"Polishing up the response just for you…",
"Convincing the AI to stop overthinking…",
],
)
# Start a new message stream
🔮 Text Streaming Helper
The chat_stream()
helper utility can be used to streamline calling the 3 text streaming methods:
# Start a new message stream
streamer = client.chat_stream(
channel=channel_id,
recipient_team_id=team_id,
recipient_user_id=user_id,
thread_ts=thread_ts,
)
# Loop over OpenAI response stream
# https://platform.openai.com/docs/api-reference/responses/create
for event in returned_message:
if event.type == "response.output_text.delta":
streamer.append(markdown_text=f"{event.delta}")
else:
continue
feedback_block = create_feedback_block()
streamer.stop(blocks=feedback_block)
🔠 Text Streaming Methods
Alternative to the Text Streaming Helper is to call the individual methods.
1) client.chat_startStream
First, start a chat text stream to stream a response to any message:
@app.message()
def handle_message(message, client, context, event, message):
# Start a new message stream
stream_response = client.chat_startStream(
channel=channel_id,
recipient_team_id=team_id,
recipient_user_id=user_id,
thread_ts=thread_ts,
)
stream_ts = stream_response["ts"]
2) client.chat_appendStream
After starting a chat text stream, you can then append text to it in chunks (often from your favourite LLM SDK) to convey a streaming effect:
for event in returned_message:
if event.type == "response.output_text.delta":
client.chat_appendStream(
channel=channel_id,
ts=stream_ts,
markdown_text=f"{event.delta}"
)
else:
continue
3) client.chat_stopStream
Lastly, you can stop the chat text stream to finalize your message:
client.chat_stopStream(
channel=channel_id,
ts=stream_ts,
blocks=feedback_block
)
👍🏻 Feedback Buttons
Add feedback buttons to the bottom of a message, after stopping a text stream, to gather user feedback:
def create_feedback_block() -> List[Block]:
blocks: List[Block] = [
ContextActionsBlock(
elements=[
FeedbackButtonsElement(
action_id="feedback",
positive_button=FeedbackButtonObject(
text="Good Response",
accessibility_label="Submit positive feedback on this response",
value="good-feedback",
),
negative_button=FeedbackButtonObject(
text="Bad Response",
accessibility_label="Submit negative feedback on this response",
value="bad-feedback",
),
)
]
)
]
return blocks
@app.message()
def handle_message(message, client):
# ... previous streaming code ...
# Stop the stream and add feedback buttons
feedback_block = create_feedback_block()
client.chat_stopStream(
channel=channel_id,
ts=stream_ts,
blocks=feedback_block
)
- https://docs.slack.dev/reference/block-kit/blocks/context-actions-block/
- https://docs.slack.dev/reference/block-kit/block-elements/feedback-buttons-element/
- https://docs.slack.dev/reference/block-kit/block-elements/icon-button-element/
Ⓜ️ Markdown Text Support
chat_postMessage
supports markdown_text
response = client.chat_postMessage(
channel="C111",
markdown_text=markdown_content,
)
Learn more in slackapi/python-slack-sdk#1718
🧩 Markdown Block
📚 https://docs.slack.dev/reference/block-kit/blocks/markdown-block/
from slack_sdk.models.blocks import MarkdownBlock
...
@app.message("hello")
def message_hello(say):
say(
blocks=[
MarkdownBlock(text="**lets's go!**"),
],
text="let's go!",
)
Learn more in slackapi/python-slack-sdk#1748
🎞️ Workflows Featured Methods
Add support for the workflows.featured.{add|list|remove|set}
methods:
- https://docs.slack.dev/reference/methods/workflows.featured.add
- https://docs.slack.dev/reference/methods/workflows.featured.list
- https://docs.slack.dev/reference/methods/workflows.featured.remove
- https://docs.slack.dev/reference/methods/workflows.featured.set
app.client.workflows_featured_add(channel_id="C0123456789", trigger_ids=["Ft0123456789"])
app.client.workflows_featured_list(channel_ids="C0123456789")
app.client.workflows_featured_remove(channel_id="C0123456789", trigger_ids=["Ft0123456789"])
app.client.workflows_featured_set(channel_id="C0123456789", trigger_ids=["Ft0123456789"])
Learn more in slackapi/python-slack-sdk#1712
What's Changed
👾 Enhancements
- feat: add ai-enabled features text streaming methods, feedback blocks, and loading state in #1387 - Thanks @zimeg!
📚 Documentation
- docs: add ai provider token instructions in #1340 - Thanks @zimeg!
- docs: updates for combined quickstart in #1378 - Thanks @haleychaas!
- docs: replace links from api.slack.com to docs.slack.dev redirects in #1383 - Thanks @zimeg!
🤖 Dependencies
- chore(deps): update pytest-cov requirement from <7,>=3 to >=3,<8 in #1365 - Thanks @dependabot[bot]!
- chore(deps): bump actions/setup-python from 5.6.0 to 6.0.0 in #1363 - Thanks @dependabot[bot]!
- chore(deps): bump actions/checkout from 4.2.2 to 5.0.0 in #1362 - Thanks @dependabot[bot]!
- chore(deps): bump actions/stale from 9.1.0 to 10.0.0 in #1361 - Thanks @dependabot[bot]!
- chore(deps): bump codecov/codecov-action from 5.4.3 to 5.5.1 in #1364 - Thanks @dependabot[bot]!
- build: require cheroot<11 with adapter test dependencies in #1375 - Thanks @zimeg!
- build(deps): remove pytest lower bounds from testing requirements in #1333 - Thanks @zimeg!
- chore(deps): bump mypy from 1.17.1 to 1.18.2 in #1379 - Thanks @dependabot[bot]!
🧰 Maintenance
- ci: post regression notifications if scheduled tests do not succeed in #1376 - Thanks @zimeg!
- build: install dependencies needed to autogenerate reference docs in #1377 - Thanks @zimeg!
- version 1.26.0 in #1388 - Thanks @zimeg!
Milestone: https://github.com/slackapi/bolt-python/milestone/94?closed=1
Full Changelog: v1.25.0...v1.26.0
Package: https://pypi.org/project/slack-bo...
version 1.25.0
What's Changed
Changes ⚠️
- chore: remove 3.6 support by @WilliamBergamin in #1359
Docs 📖
- docs: updates gif and enterprise paths by @lukegalbraithrussell in #1358
Maintenance 🏗️
- chore: move dependencies to pyproject.toml by @WilliamBergamin in #1360
- chore: version 1.25.0 by @WilliamBergamin in #1366
References
- Release Milestone: https://github.com/slackapi/bolt-python/milestone/93?closed=1
- All Diff: v1.24.0...v1.25.0
version 1.24.0
Changes
Beta feature
- feat: surface
ack_timeout
on thefunction
handler by @WilliamBergamin in #1351
maintenance 🏗️
- health: increase CI coverage by @WilliamBergamin in #1276
- health: publish test results to code cov by @WilliamBergamin in #1282
- chore: remove 3.6 CI support by @WilliamBergamin in #1290
- ci: pin actions workflow step hashes and use minimum permissions by @zimeg in #1303
- fix: sanic dependencies for tests by @WilliamBergamin in #1320
- ci: run unit tests on main once a day by @zimeg in #1319
- chore: run CI tests from the Github UI by @WilliamBergamin in #1322
- ci: send a notification of scheduled failing tests by @zimeg in #1323
- build: remove docusaurus configuration files by @lukegalbraithrussell in #1342
docs 📚
- docs: Update links to go to new docs site by @haleychaas in #1293
- docs: Fixed incorrect link by @haleychaas in #1300
- docs: moved over custom steps dynamic options page. by @technically-tracy in #1307
- docs: Updated links to match Bolt JS. by @technically-tracy in #1308
- docs: updated nav by @technically-tracy in #1313
- docs: add quick start guide using the slack cli and terminal by @technically-tracy in #1317
- docs: Updates Modals tutorial to not use Glitch by @lukegalbraithrussell in #1334
- docs: Update language around AI Apps by @haleychaas in #1335
- docs: filter against bot_id in listener middleware example by @zimeg in #1339
- docs: Update language around AI Apps by @haleychaas in #1335
- docs: filter against bot_id in listener middleware example by @zimeg in #1339
- docs: adds updated bolt-py image to README by @lukegalbraithrussell in #1352
dependabot 
- chore(deps): update sanic requirement from <25,>=21 to >=21,<26 by @dependabot[bot] in #1285
- chore(deps): update falcon requirement from <4,>=2 to >=2,<5 by @dependabot[bot] in #1286
- chore(deps): bump the react group in /docs with 2 updates by @dependabot[bot] in #1288
- chore(deps): bump flake8 from 7.1.2 to 7.2.0 by @dependabot[bot] in #1287
- chore(deps): bump image-size from 1.2.0 to 1.2.1 in /docs by @dependabot[bot] in #1291
- chore(deps): bump estree-util-value-to-estree from 3.3.2 to 3.3.3 in /docs by @dependabot[bot] in #1294
- chore(deps): bump http-proxy-middleware from 2.0.7 to 2.0.9 in /docs by @dependabot[bot] in #1299
- chore(deps): bump codecov/test-results-action from 1.1.0 to 1.1.1 by @dependabot[bot] in #1310
- chore(deps): bump the docusaurus group in /docs with 5 updates by @dependabot[bot] in #1311
- chore(deps): bump mypy from 1.15.0 to 1.16.0 by @dependabot[bot] in #1309
- chore(deps): bump brace-expansion from 1.1.11 to 1.1.12 in /docs by @dependabot[bot] in #1321
- chore(deps): bump the docusaurus group in /docs with 5 updates by @dependabot[bot] in #1325
- chore(deps): bump flake8 from 7.2.0 to 7.3.0 by @dependabot[bot] in #1326
- chore(deps): bump mypy from 1.16.0 to 1.16.1 by @dependabot[bot] in #1327
- chore(deps): bump on-headers and compression in /docs by @dependabot[bot] in #1336
- chore(deps): update pytest requirement from <8.4,>=6.2.5 to >=6.2.5,<8.5 by @dependabot[bot] in #1328
- chore(deps): bump mypy from 1.16.1 to 1.17.1 by @dependabot[bot] in #1343
- chore(deps): bump the react group in /docs with 2 updates by @dependabot[bot] in #1344
- chore(deps): bump slackapi/slack-github-action from 2.1.0 to 2.1.1 by @dependabot[bot] in #1345
References
- Release Milestone: https://github.com/slackapi/bolt-python/milestone/92?closed=1
- All Diff: v1.23.0...v1.24.0
version 1.23.0
Changes
fixes 🏗️
- fix: honor passing bolt logger in default web client installation by @WilliamBergamin in #1272
- test: fix broken tests due to wild card import by @WilliamBergamin in #1240
- fix: configure dependabot to group react deps by @WilliamBergamin in #1263
- test: add tests around the logger experience of bolt by @WilliamBergamin in #1270
docs 📚
- docs: Syncing config files with Deno Slack SDK and Slack CLI docs by @slackapi in #1228
- docs - nested sidebar by @lukegalbraithrussell in #1230
- docs: fix broken link to the WebClient by @WilliamBergamin in #1235
- docs: Update Bolt Python Assistant doc to match JS structure. by @technically-tracy in #1239
- docs: reorganizes nav to match Bolt JS style by @lukegalbraithrussell in #1241
- docs: Reorganize nav to match Bolt JS follow-up. by @technically-tracy in #1242
- docs: fix broken link in commands.md by @WilliamBergamin in #1248
- docs: Move Modals tutorial to Bolt for Python site. by @technically-tracy in #1250
- docs: Migrate custom steps tutorials. by @technically-tracy in #1253
- docs: remove mention of assistants and replace with AI apps by @haleychaas in #1254
- docs: matches site css to slack.dev and docs.slack.dev by @slackapi in #1256
- docs: fixes broken apps navbar link by @slackapi in #1264
- docs: Update reference to "Concepts guides". by @technically-tracy in #1266
- docs: update packaging notation for local development requirements by @zimeg in #1271
dependabot 
- chore(deps): bump mypy from 1.13.0 to 1.14.1 by @dependabot in #1234
- chore(deps): bump prism-react-renderer from 2.4.0 to 2.4.1 in /docs by @dependabot in #1232
- chore(deps): update sanic requirement from <24,>=22 to >=22,<25 by @dependabot in #1233
- chore(deps): bump actions/stale from 9.0.0 to 9.1.0 by @dependabot in #1244
- chore(deps): bump the docusaurus group in /docs with 5 updates by @dependabot in #1243
- chore(deps): bump mypy from 1.14.1 to 1.15.0 by @dependabot in #1258
- chore(deps): update websockets requirement from <15 to <16 by @dependabot in #1260
- chore(deps): bump flake8 from 6.0.0 to 7.1.2 by @dependabot in #1259
- chore(deps): bump the react group in /docs with 2 updates by @dependabot in #1265
- chore(deps): bump prismjs from 1.29.0 to 1.30.0 in /docs by @dependabot in #1269
- chore(deps): bump @babel/runtime from 7.26.0 to 7.26.10 in /docs by @dependabot in #1275
- chore(deps): bump @babel/helpers from 7.26.0 to 7.26.10 in /docs by @dependabot in #1273
- chore(deps): bump @babel/runtime-corejs3 from 7.26.9 to 7.26.10 in /docs by @dependabot in #1274
Relevant changes
We've fixed a regression around the logger
, by default the logger used by the WebClient
will be the same as the one used by the Bolt application. If the WebClient
defines its own logger then it will be used:
my_logger = logging.getLogger("my_logger")
app = App(client=WebClient(token=os.environ.get("SLACK_BOT_TOKEN"), logger=my_logger))
@app.command("/sample-command")
def sample_command(ack: Ack, client: WebClient):
ack()
assert client.logger.name == my_logger.name
New Contributors
- @haleychaas made their first contribution in #1254
References
- Release Milestone: https://github.com/slackapi/bolt-python/milestone/91?closed=1
- All Diff: v1.22.0...v1.23.0
version 1.22.0
Changes
- docs: Custom steps for JIRA tutorial. by @technically-tracy in #1214
- feat: support python 3.13 by @WilliamBergamin in #1221
- docs(examples): update aws lambda tooling and iam role names by @zimeg in #1224
- chore: improve maintainers docs by @WilliamBergamin in #1226
Dependabot
- chore(deps): bump path-to-regexp and express in /docs by @dependabot in #1218
- chore(deps): bump nanoid from 3.3.7 to 3.3.8 in /docs by @dependabot in #1223
References
- Release Milestone: https://github.com/slackapi/bolt-python/milestone/90?closed=1
- All Diff: v1.21.3...v1.22.0
version 1.21.3
Changes
- #1187 Add title argument to SetSuggestedPrompts arguments - Thanks @seratch
- #1216 Expose loop param on asyncio-based AsyncSocketModeHandler - Thanks @jantman
- #1202 Socket Mode: Failed to connect (error: string argument without an encoding) w/ Azure App Service + aiohttp 3.11.2 - Thanks @seratch @jeremybeeman
- #1199 Resolve Falcon 5.x type hint compatibility issue - Thanks @seratch
References
- Release Milestone: https://github.com/slackapi/bolt-python/milestone/89?closed=1
- All Diff: v1.21.2...v1.21.3
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