Build Slack apps in a flash
Introducing the newest member of the Bolt family
Interested in seeing our latest addition in action? We’re hosting a webinar about building with Bolt for Python later this week.
Designing Bolt for simple, custom building
Developing Bolt for Java and Python, we knew we needed to customize them to best fit each unique language community. As we trekked, we made small modifications to the different frameworks—in Java we modified how we pass in listener arguments, and in Python we adapted Bolt to work with existing web frameworks, like Flask.
Our specialized approach was complementary to Bolt’s core design principles.
A common listener pattern
Bolt is built around a set of listener methods. These are used to listen and interact with different events coming from Slack. For example, Events API events use the
events() listener, and shortcut invocations use the
shortcut() listener. All listeners use common parameters that allow you to define unique identifiers, add middleware, and access the body of incoming events.
A handful of built-in defaults
Bolt includes a collection of defaults that perform the heavier lifting of building Slack apps. One of these is a design pattern called receivers, or adapters in Python. These separate the concerns of your app’s server and the Bolt framework so updates for server logic doesn’t require framework updates, and vice-versa.
Your app has access to a built-in Web API client that includes features such as built-in retry logic, rate limit handling, and pagination support as you make calls to any of our 130+ methods. It offers a simple way to call Web API methods without having to think of all of the possible edge cases. And lastly, Bolt offers OAuth support which handles the “Add to Slack” flow, making token storage and access for multi-team installations simpler.
Helper functions and objects
To complete common tasks, Bolt includes a set of helper functions. For example, in any listener with an associated conversation context, there will be
say() function that lets your app send a message back into that channel. And for events that need to be acknowledged within 3 seconds, Bolt surfaces an
ack() function that streamlines the act of responding.
Bolt also offers helpers that make it easier to inspect and pass data through your app. Rather than having to unwrap incoming events to access the most important information, Bolt includes a
payload object that is a predictable, unwrapped event (though you’ll still have
body for the more verbose event).
You can also access
context, which is a key/value dictionary that allows you to pass data through middleware and listeners. For example, if you have an internal data store that you want to associate with incoming events, you can create a global middleware function to store that information in
context, which will be natively accessible in listeners.
The future of Bolt
As the platform grows, we will continue our investment in Bolt to make it easier, faster, and more intuitive to build Slack apps.
For example, steps from apps are now available in Workflow Builder. Each workflow step has a few associated events, so we collaborated with the Workflow Builder engineering team to design a common pattern in Bolt that lets you centrally handle the entire life cycle of a workflow step.
Also, we recently pre-announced Socket Mode, which will improve the experience of deploying apps behind a firewall. When generally available early next year, Bolt apps will gain support for this feature with minimal code changes.
We’re also unlocking more Bolt resources for custom use cases— whether that’s specialized hosting environments, simplifying new features, or building scalable apps for enterprise grid and Slack Connect. We’ll continue to expand our collection of Bolt-focused code samples, tutorials, deployment guides, and webinars; and if you need a more specialized approach to building Slack apps, we have ongoing plans for our lower-level SDKs that power Bolt under the hood.
Digging into the nuts and bolts
Want to dive deeper into Bolt for Python? We’re hosting a webinar on November 11, which you can register for today.
Questions? Email email@example.com, or reach out to our team on GitHub.