slackapi / bolt-python

A framework to build Slack apps using Python
https://slack.dev/bolt-python/
MIT License
1.03k stars 237 forks source link

Add custom function support #1021

Open WilliamBergamin opened 5 months ago

WilliamBergamin commented 5 months ago

This PR includes all the changes from #986 aims to add support for custom functions in Bolt Python

Feedback

I'm looking for feedback on

Testing

This gist was created to show how to test these new feature, use it with the following steps

  1. Create a new app a. Head to https://api.slack.com/apps/?new_app=1 b. Click "From an app manifest" c. Select YAML and paste the above manifest.yml content d. Click create button
  2. Install the app into org/workspace a. Install the app anyways (when the workspace is in an Org, org-wide installation is required to publish functions) b. Grab the xoxb- token (Settings > Install App > Bot User OAuth Token) c. export SLACK_BOT_TOKEN=xoxb-...
  3. Set up Socket Mode a. Head to Settings > Basic Information > App-Level Tokens on the https://api.slack.com/apps page b. Generate a new token with connections:write scope c. export SLACK_APP_TOKEN=xapp-...
  4. Spin up the app a. Add app.py and async_app.py with the above source code b. Pull the latest PR branch of bolt python to your local c. Run scripts/build_pypi_package.sh this will generate a .whl in the dist/ folder d. (Optional) In your project set up a venv with python -m venv .venv and source .venv/bin/activate e. pip install global/path/to/bolt-python/dist/something.whl f. pip install aiohttp g python app.py or python async_app.py
  5. Add the custom step to a workflow a. Open the workflow builder b. Create a new workflow with a link trigger d. Seach "Hello" in the Steps view on the right side e. Add the step to the workflow (you can set any user ID as the input) f. Publish the workflow

Category

Requirements

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

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 98.50000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 91.97%. Comparing base (2882708) to head (fff7c9f).

Files Patch % Lines
slack_bolt/request/internals.py 93.10% 2 Missing :warning:
slack_bolt/context/base_context.py 90.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1021 +/- ## ========================================== + Coverage 91.77% 91.97% +0.19% ========================================== Files 186 195 +9 Lines 6407 6604 +197 ========================================== + Hits 5880 6074 +194 - Misses 527 530 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sharvesh06 commented 2 weeks ago

@seratch @WilliamBergamin When will this PR be merged?