Skip to content

Updates PythOnBoardingBot tutorial sample to use bolt-python#1044

Merged
seratch merged 5 commits intoslackapi:mainfrom
srajiang:sj_update_tutorial
Jun 18, 2021
Merged

Updates PythOnBoardingBot tutorial sample to use bolt-python#1044
seratch merged 5 commits intoslackapi:mainfrom
srajiang:sj_update_tutorial

Conversation

@srajiang
Copy link
Copy Markdown
Contributor

@srajiang srajiang commented Jun 17, 2021

Summary

This PR updates the dependencies and handlers on the PythOnBoardingBot tutorial app sample app.py to use bolt-python instead of slackeventsapi as described in #1037. I've also updated the **.md documentation code snippets accordingly.

Category (place an x in each of the [ ])

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.signature (Request Signature Verifier)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.models (UI component builders)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.rtm_v2 (RTM client)
  • /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 x in each [ ])

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh after making the changes. <--- I tried running this but the tests stalled out for some reason.

@gitwave gitwave bot added the untriaged label Jun 17, 2021
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jun 17, 2021

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 17, 2021

Codecov Report

Merging #1044 (9967ee6) into main (d361500) will not change coverage.
The diff coverage is n/a.

❗ Current head 9967ee6 differs from pull request most recent head 3b8fd7c. Consider uploading reports for the commit 3b8fd7c to get more accurate results
Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d361500...3b8fd7c. Read the comment docs.

@srajiang srajiang changed the title Updates PythOnBoardingBot tutorial sample to use latest bolt-python Updates PythOnBoardingBot tutorial sample to use bolt-python Jun 17, 2021
```
slack_sdk>=3.0
slackeventsapi>=2.1.0
Flask>=1.1.2
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For review: Removed both slackeventsapi and flask dependencies in favor of slack_bolt only.

Copy link
Copy Markdown
Contributor

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown
Contributor

@seratch seratch Jun 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
response = app.client.conversations_open(users=user_id)
response = client.conversations_open(users=user_id)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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!

@seratch seratch added area:examples issues related to example or sample code docs M-T: Documentation work only Version: 3x and removed untriaged labels Jun 17, 2021
@seratch seratch added this to the 3.8.0 milestone Jun 17, 2021
@srajiang srajiang self-assigned this Jun 17, 2021
@srajiang srajiang marked this pull request as ready for review June 17, 2021 23:30
Copy link
Copy Markdown
Contributor

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:examples issues related to example or sample code docs M-T: Documentation work only Version: 3x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants