-
Notifications
You must be signed in to change notification settings - Fork 248
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
Conversation
Codecov Report
@@ 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.
|
docs/_basic/web_api.md
Outdated
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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") |
There was a problem hiding this comment.
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.
I've mainly taken a look at code snippets but I haven't verified many of them actually work yet. |
Some of my comments above include TODOs in Bolt for JS documents. If anyone can take the tasks, it'd be appreciated. |
|
||
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`. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will take this!
def handle_submission(ack, body, client, view): | ||
# Acknowledge the view_submission event | ||
ack() | ||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
I sent a PR: slackapi/bolt-js#628 |
|
||
```python | ||
# Matches all messages from bot users | ||
@app.message({"subtype": "message_changed"}) |
There was a problem hiding this comment.
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() | ||
|
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@misscoded Just in case
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, |
There was a problem hiding this comment.
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:
bolt-python/tests/slack_bolt/oauth/test_oauth_flow.py
Lines 141 to 148 in c1641f8
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.
The App Home page has been added in JS: slackapi/bolt-js#626 |
hmm, I'm unable to reopen this. @misscoded Could you reopen or create a new PR? |
I found that the reason was the deletion of the @misscoded We no longer use |
We're going to merge #94 - thanks @misscoded for your great work here! |
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 componentsslack_bolt.async_app.AsyncApp
and/or its core componentsslack_bolt.adapter
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.
./scripts/run_tests.sh
after making the changes.