New features designed for Slack apps sending AI responses
We've introduced a new suite of features to help Slack apps provide an end-user experience typical of LLM tools:
- Slack apps can now stream in their responses to the end user using three new API methods.
- There are new Block Kit components to allow end users to quickly interact with AI responses.
- The Node and Python SDKs have new utilities to streamline integration of these new features.
Read on for more info!
Streaming messages
Three Web API methods work together to enable Slack apps to provide end users a text streaming experience similar to typical LLM tools:
- The
chat.startStream
method starts the text stream. - The
chat.appendStream
method appends text to the stream. - The
chat.stopStream
method stops the text stream.
Interacting with AI responses
Three new Block Kit components allow more user interaction with agent responses:
-
The
feedback_buttons
block element allows users to provide feedback on whether an AI response was positive or negative. -
The
icon_button
provides a way for users to quickly trigger actions like deleting AI responses. -
The
context_actions
block provides a container for these interactive elements.
Supported by Slack SDKs and Bolt framework
The Python Slack SDK and Node Slack SDK each fully support these new features — with a new streamer
helper utility to aid developers in tying them all together.
Here's a simplified example in Python:
streamer = client.chat_stream(
channel=channel_id,
recipient_team_id=team_id,
recipient_user_id=user_id,
thread_ts=thread_ts,
)
for event in returned_message:
streamer.append(markdown_text=f"{chunk-received-from-llm}")
streamer.stop(blocks=feedback_block)
This utility can also be used in the Bolt frameworks based upon these SDKs. Read more in the Using AI in apps section of your preferred Bolt flavor: Python or JavaScript.
We've also updated our app agent template repos to use these new features. Pick your flavor of Bolt and give it a try.
Get started with the Bolt for Python agent template:
slack create --template slack-samples/bolt-python-assistant-template
slack run
Get started with the Bolt for JavaScript agent template:
slack create --template slack-samples/bolt-js-assistant-template
slack run
Read all the details in the Bolt Python release notes and Bolt JS release notes.