Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Basic Concepts section to docs #78

Closed
wants to merge 4 commits into from

Conversation

misscoded
Copy link
Contributor

@misscoded misscoded commented Sep 11, 2020

Basic Concepts section of Bolt for Python documentation (based on Bolt for JavaScript: Basic Concepts).

Preview for Review + Readability: https://misscoded.github.io/bolt-python/concepts

Part of Issue #70 (Add Getting Started Guide)


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

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Documentation

Requirements (place an x in each [ ])

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

  • 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 ./scripts/run_tests.sh after making the changes.

@misscoded misscoded added the docs Improvements or additions to documentation label Sep 11, 2020
@misscoded misscoded self-assigned this Sep 11, 2020
@misscoded misscoded changed the base branch from main to docs September 11, 2020 23:37
@misscoded misscoded added this to the 0.9.0b0 milestone Sep 11, 2020
@misscoded misscoded linked an issue Sep 11, 2020 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Sep 11, 2020

Codecov Report

❗ No coverage uploaded for pull request base (docs@45d4852). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             docs      #78   +/-   ##
=======================================
  Coverage        ?   82.57%           
=======================================
  Files           ?      128           
  Lines           ?     3530           
  Branches        ?        0           
=======================================
  Hits            ?     2915           
  Misses          ?      615           
  Partials        ?        0           

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 45d4852...631b046. Read the comment docs.

docs/_basic/acknowledging_events.md Outdated Show resolved Hide resolved
docs/_basic/acknowledging_events.md Outdated Show resolved Hide resolved
docs/_basic/acknowledging_events.md Outdated Show resolved Hide resolved
docs/_basic/authenticating_oauth.md Show resolved Hide resolved
docs/_basic/authenticating_oauth.md Outdated Show resolved Hide resolved
docs/_basic/sending_messages.md Outdated Show resolved Hide resolved
docs/_basic/sending_messages.md Outdated Show resolved Hide resolved
docs/_basic/updating_pushing_modals.md Show resolved Hide resolved
docs/_basic/web_api.md Outdated Show resolved Hide resolved
Comment on lines 17 to 23
def say_hello(client, payload):
# Unix Epoch time for September 30, 2020 11:59:59 PM
when_september_ends = 1601510399
channel_id = payload['event']['channel']
client.chat_scheduleMessage(channel=channel_id,
post_at=when_september_ends,
text="Summer has come and passed")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def say_hello(client, payload):
# Unix Epoch time for September 30, 2020 11:59:59 PM
when_september_ends = 1601510399
channel_id = payload['event']['channel']
client.chat_scheduleMessage(channel=channel_id,
post_at=when_september_ends,
text="Summer has come and passed")
def say_hello(client, message):
# Unix Epoch time for September 30, 2020 11:59:59 PM
when_september_ends = 1601510399
channel_id = message['channel']
client.chat_scheduleMessage(channel=channel_id,
post_at=when_september_ends,
text="Summer has come and passed")

Copy link
Member

Choose a reason for hiding this comment

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

TODO: channel: message.channel.id in Bolt JS is incorrect.

@seratch
Copy link
Member

seratch commented Sep 12, 2020

I've mainly taken a look at code snippets but I haven't verified many of them actually work yet.

docs/_basic/web_api.md Outdated Show resolved Hide resolved
@seratch
Copy link
Member

seratch commented Sep 12, 2020

Some of my comments above include TODOs in Bolt for JS documents. If anyone can take the tasks, it'd be appreciated.

docs/_basic/acknowledging_events.md Outdated Show resolved Hide resolved
docs/_basic/authenticating_oauth.md Outdated Show resolved Hide resolved

Bolt for Python will create a **Redirect URL** `slack/oauth_redirect`, which Slack uses to redirect users after they complete your app’s installation flow. You will need to add this **Redirect URL** in your app configuration settings under **OAuth and Permissions**. This path can be configured in the `OAuthSettings` argument described below.

Bolt for Python will also create a `slack/install` route, where you can find an **Add to Slack** button for your app to perform direct installs of your app. If you need any additional authorizations (user tokens) from users inside a team when your app is already installed or a reason to dynamically generate an install URL, you can pass your own custom URL generator to `oauth_settings` as `authorize_url_generator`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to Bolt for JS, I think it'd be helpful to link to OAuth docs when discussing authorize_url_generator if there are more detailed docs on that piece.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The same OAuth docs linked above, I assume? BoltJS's docs link to a specific anchor, but as this page doesn't exist yet, I'm not sure what this link will be.

Copy link
Member

Choose a reason for hiding this comment

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

I will take this!

docs/_basic/listening_actions.md Outdated Show resolved Hide resolved
docs/_basic/listening_events.md Outdated Show resolved Hide resolved
docs/_basic/opening_modals.md Outdated Show resolved Hide resolved
docs/_basic/responding_actions.md Outdated Show resolved Hide resolved
docs/_basic/responding_actions.md Outdated Show resolved Hide resolved
docs/_basic/updating_pushing_modals.md Outdated Show resolved Hide resolved
docs/_basic/web_api.md Outdated Show resolved Hide resolved
​​def handle_submission(ack, body, client, view):
​​ # Acknowledge the view_submission event
​​ ack()
​​
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@seratch I've managed to lose the validation request you placed here. Could you possibly provide a snippet of what you had in mind so I can fold it in?

Copy link
Member

Choose a reason for hiding this comment

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

@misscoded How about having simpler ones such as length-check? Here is an example I recently created: https://github.com/seratch/apidays-workshop-2020/blob/87f623356f90fbdb9f5112e114dc51c157698ac7/python/app.py#L272-L283

seratch added a commit to seratch/bolt-js that referenced this pull request Sep 16, 2020
seratch added a commit to seratch/bolt-js that referenced this pull request Sep 16, 2020
seratch added a commit to seratch/bolt-js that referenced this pull request Sep 16, 2020
@seratch
Copy link
Member

seratch commented Sep 16, 2020

Some of my comments above include TODOs in Bolt for JS documents. If anyone can take the tasks, it'd be appreciated.

I sent a PR: slackapi/bolt-js#628


```python
# Matches all messages from bot users
@app.message({"subtype": "message_changed"})
Copy link
Member

Choose a reason for hiding this comment

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

@misscoded This code doesn't work even with Bolt for JS. Use another example. app.event? #89

​​def handle_submission(ack, body, client, view):
​​ # Acknowledge the view_submission event
​​ ack()
​​
Copy link
Member

Choose a reason for hiding this comment

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

@misscoded How about having simpler ones such as length-check? Here is an example I recently created: https://github.com/seratch/apidays-workshop-2020/blob/87f623356f90fbdb9f5112e114dc51c157698ac7/python/app.py#L272-L283

</div>

```python
from slack_bolt.oauth.oauth_settings import OAuthSettings
Copy link
Member

Choose a reason for hiding this comment

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

@misscoded Just in case

Suggested change
from slack_bolt.oauth.oauth_settings import OAuthSettings
import os
from slack_bolt.oauth.oauth_settings import OAuthSettings

install_path="/slack/install",
redirect_uri_path="/slack/oauth_redirect",
state_store=FileOAuthStateStore(expiration_seconds=600),
callback_options=CallbackOptions(success=success,
Copy link
Member

Choose a reason for hiding this comment

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

@misscoded we should have samples for success / failure functions like this:

def success(args: SuccessArgs) -> BoltResponse:
assert args.request is not None
return BoltResponse(status=200, body="customized")
def failure(args: FailureArgs) -> BoltResponse:
assert args.request is not None
assert args.reason is not None
return BoltResponse(status=502, body="customized")

You don't need to have the type hints in docs.

@seratch
Copy link
Member

seratch commented Sep 18, 2020

The App Home page has been added in JS: slackapi/bolt-js#626

@seratch seratch closed this Sep 18, 2020
@seratch
Copy link
Member

seratch commented Sep 18, 2020

hmm, I'm unable to reopen this. @misscoded Could you reopen or create a new PR?

@seratch seratch reopened this Sep 18, 2020
@seratch
Copy link
Member

seratch commented Sep 18, 2020

I found that the reason was the deletion of the docs branch. I restored the branch and reopened this.

@misscoded We no longer use docs branch. Can you change the base branch or create a new PR to main branch?

@seratch seratch mentioned this pull request Sep 19, 2020
3 tasks
@seratch
Copy link
Member

seratch commented Sep 19, 2020

We're going to merge #94 - thanks @misscoded for your great work here!

@seratch seratch closed this Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Getting Started guide
4 participants