slackapi / deno-slack-sdk

SDK for building Run on Slack apps using Deno
https://api.slack.com/automation
MIT License
165 stars 27 forks source link

Returning an error during configuration of a custom function within Workflow Builder #228

Open mcsescott opened 1 year ago

mcsescott commented 1 year ago

Question

When building a Steps from Apps workflow step in 1.0, we were able to define an error when the user tries to save a workflow step with something we didn't like.

await ack(
    {
        "response_action":"errors",
        "errors": {
            "my_block" : "You must select a variable user from the workflow."
          }
    });

How do we replicate this with the new platform? Looking at the documentation at https://api.slack.com/automation/interactive-modals it talks about returning errors, but I don't see how this would work when i want to return an error when the user clicks on "Save" in a custom function / workflow step. I want to return on error when the user tries to save the workflow step, not when the workflow runs.

filmaj commented 1 year ago

@mcsescott it's a good question and I know there is not exact parity with what used to exist in 1.0 steps from apps.

However, I think the experience in the new workflow builder is much more sophisticated and complex. It Depends ™️ on your specific use case, but at least for certain common incompatibility between steps cases (at the typing level, for example), the new workflow builder UI should be handling those errors for us and our users.

That said, I'm sure there are use cases not natively handled by the workflow builder. Can you describe some of the specifics in your use case so I can raise this internally?

mcsescott commented 1 year ago

Understood, and we are all learning. The use case could be anything, really.

Suppose I had a custom function with an input that expects a single line of text (a string). I want the user to type in a URL or an email address, or even a telephone number.

When the user hits Submit on that modal, I want to be able to test that value and return an error with the block highlighted that says "Please type an appropriate value." We can do that using my example above by returning a response_action: errors but looking for the same functionality in the new platform.

Again, this isn't about running the actual workflow that opens a modal. This is about adding a workflow step which is a custom function when configuring via Workflow Builder.

filmaj commented 1 year ago

Totally fair, I have raised this internally and think it would be a good addition.