slackapi / bolt-python
A framework to build Slack apps using Python
AI Architecture Analysis
This repository is indexed by RepoMind. By analyzing slackapi/bolt-python in our AI interface, you can instantly generate complete architecture diagrams, visualize control flows, and perform automated security audits across the entire codebase.
Our Agentic Context Augmented Generation (Agentic CAG) engine loads full source files into context on-demand, avoiding the fragmentation of traditional RAG systems. Ask questions about the architecture, dependencies, or specific features to see it in action.
Repository Overview (README excerpt)
Crawler viewBolt for Python A Python framework to build Slack apps in a flash with the latest platform features. Read the getting started guide and look at our code examples to learn how to build apps using Bolt. The Python module documents are available here. Setup Creating an app Create a Bolt for Python app by calling a constructor, which is a top-level export. If you'd prefer, you can create an async app. Running an app Running a Socket Mode app If you use Socket Mode for running your app, is available for it. Run the app this way: Listening for events Apps typically react to a collection of incoming events, which can correspond to Events API events, actions, shortcuts, slash commands or options requests. For each type of request, there's a method to build a listener function. The recommended way to use these methods are decorators: Making things happen Most of the app's functionality will be inside listener functions (the parameters above). These functions are called with a set of arguments, each of which can be used in any order. If you'd like to access arguments off of a single object, you can use , an instance that contains all available arguments for that event. | Argument | Description | | :---: | :--- | | | Dictionary that contains the entire body of the request (superset of ). Some accessory data is only available outside of the payload (such as and ). | | Contents of the incoming event. The payload structure depends on the listener. For example, for an Events API event, will be the event type structure. For a block action, it will be the action from within the list. The dictionary is also accessible via the alias corresponding to the listener ( , , , , , , or ). For example, if you were building a listener, you could use the and arguments interchangably. **An easy way to understand what's in a payload is to log it**. | | | Event context. This dictionary contains data about the event and app, such as the . Middleware can add additional context before the event is passed to listeners. | | Function that **must** be called to acknowledge that your app received the incoming event. exists for all actions, shortcuts, view submissions, slash command and options requests. returns a promise that resolves when complete. Read more in Acknowledging events. | | Utility function that responds to incoming events **if** it contains a (shortcuts, actions, and slash commands). | | Utility function to send a message to the channel associated with the incoming event. This argument is only available when the listener is triggered for events that contain a (the most common being events). accepts simple strings (for plain-text messages) and dictionaries (for messages containing blocks). | | Web API client that uses the token associated with the event. For single-workspace installations, the token is provided to the constructor. For multi-workspace installations, the token is returned by using the OAuth library, or manually using the function. | | The built-in instance you can use in middleware/listeners. | | Utility function used to signal the successful completion of a custom step execution. This tells Slack to proceed with the next steps in the workflow. This argument is only available with the and listener when handling custom workflow step executions. | | Utility function used to signal that a custom step failed to complete. This tells Slack to stop the workflow execution. This argument is only available with the and listener when handling custom workflow step executions. Creating an async app If you'd prefer to build your app with asyncio, you can import the AIOHTTP library and call the constructor. Within async apps, you can use the async/await pattern. In async apps, all middleware/listeners must be async functions. When calling utility methods (like and ) within these functions, it's required to use the keyword. If you want to use another async Web framework (e.g., Sanic, FastAPI, Starlette), take a look at the built-in adapters and their examples. • The Bolt app examples • The built-in adapters Apps can be run the same way as the syncronous example above. If you'd prefer another async Web framework (e.g., Sanic, FastAPI, Starlette), take a look at the built-in adapters and their corresponding examples. Getting Help The documentation has more information on basic and advanced concepts for Bolt for Python. Also, all the Python module documents of this library are available here. If you otherwise get stuck, we're here to help. The following are the best ways to get assistance working through your issue: • Issue Tracker for questions, bug reports, feature requests, and general discussion related to Bolt for Python. Try searching for an existing issue before creating a new one. • Email our developer support team: [pypi-image]: https://badge.fury.io/py/slack-bolt.svg [pypi-url]: https://pypi.org/project/slack-bolt/ [codecov-image]: https://codecov.io/gh/slackapi/bolt-python/branch/main/graph/badge.svg [codecov-url]: https://codecov.io/gh/slackapi/bolt-python [python-version]: https://img.shields.io/pypi/pyversions/slack-bolt.svg