New Features
Code Suggestion for Missing Listeners
Since this version, the warning message for unhandled requests is even more helpful!
Let's say you've configured the "message" event subscription in the Slack App configuration page, and the Slack server-side started sending message events to your app. However, your app does not have the corresponding event listener yet. In this case, Bolt suggests the missing listener with a working code snippet.
WARNING:slack_bolt.App:Unhandled request ({'type': 'event_callback', 'event': {'type': 'message'}})
---
[Suggestion] You can handle this type of event with the following listener function:
@app.event("message")
def handle_message_events(body, logger):
logger.info(body)
The new suggestion logging should be helpful for the developers who are new to Bolt and the Slack platform.
Options For Turning the Built-in Middleware Off
Developers can turn any of the built-in middleware off if they would like to do so for some reason.
app = App(
token=os.environ["SLACK_BOT_TOKEN"],
signing_secret=os.environ["SLACK_SIGNING_SECRET"],
# Verify request signature
request_verification_enabled = False, # default: True
# Skip processing the events generated by this app's bot user itself
ignoring_self_events_enabled = False, # default: True
# Respond to ssl_check requests
ssl_check_enabled = False, # default: True
# Respond to url_verification requests in the Events API configuration steps
url_verification_enabled = False, # default: True
)
Please make sure if it's safe enough when you turn a built-in middleware off. We strongly recommend using RequestVerification
for better security. If you have a proxy that verifies request signature in front of the Bolt app, it's totally fine to disable RequestVerification
to avoid duplication of work. Don't turn it off just for easiness of development.
Changes
- #323 Add missing listener suggestion to the default unhandled error message - Thanks @seratch
- #310 Fix #307 Add options to disable the built-in middleware - Thanks @seratch @hubhanker99
- #311 Fix #309 Fallback to no-emoji boot message on any platforms - Thanks @seratch @christheodosius
- #315 #316 Fix Chalice deployment failures caused by #270 - Thanks @jlujan-invitae
- #313 Fix #312 Type hint errors with pytype 2021.4.26 - Thanks @seratch