You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm trying to learn how to work with the Slack API.
Ultimately, I'm hoping to use my Bolt app to handle complex automations that are beyond the scope of the Workflow options within Slack itself. I'm currently just poking around to understand what's possible.
Right now, I'm trying to figure out if a slash command can start a workflow/automation that was created in app. The documentation I've seen suggests using triggers and workflow actions, but I'm trying to avoid having to create actual custom workflow steps since what I'm trying to do are workspace-specific, not organization-wide, automations.
// Listen for slash command, which may come with parametersapp.command('/slashCommand',async({ ack, payload, client, say })=>{try{const{ channel_id, user_id }=payload;awaitack();// Tell the user we're doing somethingawaitclient.chat.postEphemeral({channel: channel_id,user: user_id,text: 'OK, beginning action!',});// In this spot run code, such as parsing data passed in as a parameter with the slash command// START AN EXISTING WORKFLOW HERE. I KNOW THIS WON'T WORK, BUT THIS IS THE IDEA:awaitresponse({user: user_id,{type: workflow,workflow: // hard-coded workflow ID taken from Slack app}});
Expected result:
What I want to happen is a slash command automatically begins a workflow generated within the app.
The text was updated successfully, but these errors were encountered:
I'm trying to figure out if a slash command can start a workflow/automation that was created in app
Unfortunately, you cannot do this. The workflow platform is designed to run workflows only through a trigger, such as a link, event, schedule, or webhook. Currently, there's no plan to enable slash commands as a trigger. For this use case, it's recommended to use a link/shortcut trigger. As long as the link trigger URL is not shared outside a specific workspace, the workflow won't be executed by other users within the same organization. However, I understand that this may not be secure enough for your needs, as the URL can be shared through a Slack Connect channel or for other reasons.
An alternative approach is to use an incoming webhook trigger. Your app.command listener can send a request to the webhook URL with pre-defined JSON data inputs. In this way, you can control how a workflow can be triggered.
I'm trying to avoid having to create actual custom workflow steps since what I'm trying to do are workspace-specific, not organization-wide, automations.
For Enterprise Grid organizations, we understand that this can be an obstacle when a workflow creator wants to narrow the user scope for running workflows. In this case, here are some workarounds I can suggest:
Trigger a workflow on a different external workflow engine from the app's slash command listener.
Implement a workflow either within your Bolt app or in your custom code.
The second one may not fit your use case, but if the workflow requires user inputs and runs a few steps under the hood, implementing it with Bolt would be relatively easy. Something like this: app.command listener to call views.open API to open a modal -> app.view listener to receive/validate user inputs -> start the workflow operation -> send a DM to confirm its completion.
👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.
Hi, I'm trying to learn how to work with the Slack API.
Ultimately, I'm hoping to use my Bolt app to handle complex automations that are beyond the scope of the Workflow options within Slack itself. I'm currently just poking around to understand what's possible.
Right now, I'm trying to figure out if a slash command can start a workflow/automation that was created in app. The documentation I've seen suggests using triggers and workflow actions, but I'm trying to avoid having to create actual custom workflow steps since what I'm trying to do are workspace-specific, not organization-wide, automations.
@slack/bolt
version"@slack/bolt": "^3.22.0"
Your
App
and Receiver ConfigurationNode.js runtime version
v16.20.2
Steps to reproduce:
Expected result:
What I want to happen is a slash command automatically begins a workflow generated within the app.
The text was updated successfully, but these errors were encountered: