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

docs: document custom step usage #1125

Merged
merged 11 commits into from
Aug 14, 2024
Merged

docs: document custom step usage #1125

merged 11 commits into from
Aug 14, 2024

Conversation

WilliamBergamin
Copy link
Contributor

@WilliamBergamin WilliamBergamin commented Aug 12, 2024

This PR aims to provide documentation for custom step usage in the bolt framework

Testing

  1. Pull this branch
  2. cd ./docs
  3. npm install
  4. npm start
  5. http://localhost:3000/bolt-python/concepts/custom-steps

Category

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Document pages under /docs
  • Others

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.

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

@WilliamBergamin WilliamBergamin added the docs Improvements or additions to documentation label Aug 12, 2024
@WilliamBergamin WilliamBergamin self-assigned this Aug 12, 2024
@@ -0,0 +1,86 @@
---
title: Listening and responding to custom steps
lang: ja-jp
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will need some help for the translation 🙏

Copy link
Contributor

@filmaj filmaj left a comment

Choose a reason for hiding this comment

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

LGTM, my only suggestion would be to link to api.slack.com docs around custom steps for bolt usage in the introductory sentence(s), linking to Haley's work recently where possible.

Copy link

codecov bot commented Aug 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.80%. Comparing base (fbd6462) to head (52287be).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1125   +/-   ##
=======================================
  Coverage   91.80%   91.80%           
=======================================
  Files         186      186           
  Lines        6408     6408           
=======================================
  Hits         5883     5883           
  Misses        525      525           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

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

Super solid lift here, thank you tons! 💪 🥇 🎉

Sharing similar suggestions as in slackapi/bolt-js#2198 that I think are worth considering before merging, and I think some of the updates @filmaj suggested to the "interactivity" section in that PR would be nice to include here too!

Comment on lines 19 to 21
def sample_step_callback(inputs: dict, ack: Ack, fail: Fail, complete: Complete):
try:
ack()
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 sample_step_callback(inputs: dict, ack: Ack, fail: Fail, complete: Complete):
try:
ack()
def sample_step_callback(inputs: dict, fail: Fail, complete: Complete):
try:

Calling ack seems to be valid here but I don't think it's necessary 🤔 Please correct me if this is wrong though!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I prefer to keep it in the docs, there are a number of issues opened related to calling ack before executing custom logic

Keeping it in hopes that it will help developers avoid a bug 🙏

slug: /concepts/custom-steps
---

Your app can use the `function()` method to listen to incoming [custom step requests](https://api.slack.com/automation/functions/custom-bolt). Custom steps are used in Workflow Builder to build workflows. The method requires a step `callback_id` of type `str`. This `callback_id` must also be defined in your [Function](https://api.slack.com/concepts/manifests#functions) definition. Custom steps must be finalized using the `complete()` or `fail()` listener arguments to notify Slack that your app has processed the request.
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
Your app can use the `function()` method to listen to incoming [custom step requests](https://api.slack.com/automation/functions/custom-bolt). Custom steps are used in Workflow Builder to build workflows. The method requires a step `callback_id` of type `str`. This `callback_id` must also be defined in your [Function](https://api.slack.com/concepts/manifests#functions) definition. Custom steps must be finalized using the `complete()` or `fail()` listener arguments to notify Slack that your app has processed the request.
Your app can use the `function()` listener to listen to incoming [custom step requests](https://api.slack.com/automation/functions/custom-bolt).
Adding a custom step starts with a definition in [the app manifest](https://api.slack.com/concepts/manifests#functions) and a `function()` listener listening for the `callback_id` of that function. Upon function execution the listener is called and can run whatever code, but must finish with either the `complete()` or `fail()` listener argument to end the step:

Same suggestion as slackapi/bolt-js#2198 (comment)

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 rest of the documentation uses the method terminology instead of the listener

I think its better to be consistent and stick to method

We can send a follow up PR to update all the terms 👍

docs/content/basic/custom-steps.md Outdated Show resolved Hide resolved
docs/content/basic/custom-steps.md Outdated Show resolved Hide resolved
@WilliamBergamin WilliamBergamin merged commit 9bef19f into main Aug 14, 2024
12 checks passed
@WilliamBergamin WilliamBergamin deleted the document-custom-steps branch August 14, 2024 19:50
@WilliamBergamin WilliamBergamin added this to the 1.20.0 milestone Aug 14, 2024
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.

4 participants