Updates PythOnBoardingBot tutorial sample to use bolt-python#1044
Updates PythOnBoardingBot tutorial sample to use bolt-python#1044seratch merged 5 commits intoslackapi:mainfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1044 +/- ##
=======================================
Coverage 84.33% 84.33%
=======================================
Files 95 95
Lines 8938 8938
=======================================
Hits 7538 7538
Misses 1400 1400 Continue to review full report at Codecov.
|
| ``` | ||
| slack_sdk>=3.0 | ||
| slackeventsapi>=2.1.0 | ||
| Flask>=1.1.2 |
There was a problem hiding this comment.
For review: Removed both slackeventsapi and flask dependencies in favor of slack_bolt only.
seratch
left a comment
There was a problem hiding this comment.
Great work! I know this is still a draft but left a few comments.
|
|
||
| # Open a DM with the new user. | ||
| response = slack_web_client.conversations_open(users=user_id) | ||
| response = app.client.conversations_open(users=user_id) |
There was a problem hiding this comment.
app.client also works in this app as it surely holds the SLACK_BOT_TOKEN. But, to make this example app reusable for OAuth flow enabled / custom authorize enabled apps, we may want to use client from listener arguments instead. With the listener arg, we can safely use the client holding a valid token resolved by authorize function.
FYI, refer to https://slack.dev/bolt-python/api-docs/slack_bolt/kwargs_injection/args.html to learn all available listener/middleware arguments.
| response = app.client.conversations_open(users=user_id) | |
| response = client.conversations_open(users=user_id) |
There was a problem hiding this comment.
@seratch This makes a lot of sense! And thank you for sharing the full reference for the listener arguments available. I've made the updates to use the client passed in as an argument as you've suggested!
Summary
This PR updates the dependencies and handlers on the PythOnBoardingBot tutorial app sample
app.pyto use bolt-python instead of slackeventsapi as described in #1037. I've also updated the**.mddocumentation code snippets accordingly.Category (place an
xin each of the[ ])/docs-src(Documents, have you run./docs.sh?)/docs-src-v2(Documents, have you run./docs-v2.sh?)/tutorial(PythOnBoardingBot tutorial)tests/integration_tests(Automated tests for this library)Requirements (place an
xin each[ ])python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.shafter making the changes. <--- I tried running this but the tests stalled out for some reason.