Skip to content

Releases: slackapi/bolt-python

version 1.23.0

19 Mar 19:00
5c7974a
Compare
Choose a tag to compare

Changes

fixes 🏗️

docs 📚

dependabot :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.Logger("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

References

version 1.22.0

18 Dec 18:18
9390d0a
Compare
Choose a tag to compare

Changes

Dependabot

References

version 1.21.3

05 Dec 23:02
Compare
Choose a tag to compare

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

version 1.21.2

25 Oct 05:43
Compare
Choose a tag to compare

Changes

  • #1186 Improve metadata resolution timing in assistant app's say method - Thanks @seratch

References

version 1.21.1

22 Oct 06:02
Compare
Choose a tag to compare

Changes

  • #1184 Fix a bug where parsing assistant thread message event fails for beta feature enabled apps - Thanks @seratch

References

version 1.21.0

17 Oct 02:32
Compare
Choose a tag to compare

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 of context.client - Thanks @WilliamBergamin
  • #1164 Simplify Python code snippets in authorization.md - Thanks @arkid15r

References

version 1.20.1

23 Aug 14:40
3aa9c30
Compare
Choose a tag to compare

Changes

New Contributors

References

version 1.20.0

14 Aug 20:21
40f6d1e
Compare
Choose a tag to compare

Changes

Support for custom steps

Documentation

Speed up tests

Dependencies

  • Update pytest requirement from <8.2,>=6.2.5 to >=6.2.5,<8.4 by @dependabot in #1116

Misc

New Contributors

References

version 1.19.1

03 Jul 01:18
Compare
Choose a tag to compare

Changes

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

References

version 1.19.0

10 Jun 15:45
e78543d
Compare
Choose a tag to compare

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

Dependabot

Misc

New Contributors

Full Changelog: v1.18.1...v1.19.0