slackapi / deno-slack-sdk

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

Using input_parameter property in another input parameter? #230

Open WilliamSBunin opened 11 months ago

WilliamSBunin commented 11 months ago

Question

Is there a way to use an input_parameter property in another input parameter? If so, how?

Code concept

Specific line - enum: await getProjectValues(workspace),

input_parameters: {
    properties: {
      workspace: {
        type: Schema.types.string,
        description: "workspace list",
        enum: await getWorkspaceValues(),
      },
      project: {
        type: Schema.types.string,
        description: "workspace list",
        enum: await getProjectValues(workspace),
      },
    },

OR

Specific line - enum: await getProjectValues(workspace_gid),

input_parameters: {
    properties: {
      workspace_gid: {
        type: Schema.types.string,
        description: "workspace gid",,
      },
      project: {
        type: Schema.types.string,
        description: "workspace list",
        enum: await getProjectValues(workspace_gid),
      },
    },

Context

Idea is, I want to create a custom function which can be used by the workflow builder to EITHER

I've got the code working for calling the asana api and getting back a list of workflows. Next step is passing in the workflow gid to another input parameter which gets back the asana projects.

Additional Context The reason I think this is possible is because the built in Asana workflow for creating a task can do this.

The reason I'm trying to do this is because I want to do A LOT more with Asana than Asana has pre implemented.

filmaj commented 10 months ago

You are right that some of our connector functions use this facility you describe to have one input parameter depend on the value of another one (internally we call this feature "dynamic inputs").

The Workflow Builder UI has a ton of complexity to manage this configurability. The challenge in this issue would be to expose that to developers.

It's a good feature request, though! If it's possible in Workflow Builder, it should be possible in code, too.