docs: document custom step usage - #1125
Conversation
| @@ -0,0 +1,86 @@ | |||
| --- | |||
| title: Listening and responding to custom steps | |||
| lang: ja-jp | |||
There was a problem hiding this comment.
I will need some help for the translation 🙏
filmaj
left a comment
There was a problem hiding this comment.
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.
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
Co-authored-by: haleychaas <31392893+haleychaas@users.noreply.github.com>
zimeg
left a comment
There was a problem hiding this comment.
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!
| def sample_step_callback(inputs: dict, ack: Ack, fail: Fail, complete: Complete): | ||
| try: | ||
| ack() |
There was a problem hiding this comment.
| 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!
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
| 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)
There was a problem hiding this comment.
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 👍
This PR aims to provide documentation for
custom stepusage in the bolt frameworkTesting
cd ./docsnpm installnpm startCategory
slack_bolt.Appand/or its core componentsslack_bolt.async_app.AsyncAppand/or its core componentsslack_bolt.adapter/docsRequirements
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/install_all_and_run_tests.shafter making the changes.