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 Configuration
const app = new App({
token: process.env.SLACK_BOT_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET,
socketMode: true,
appToken: process.env.SLACK_APP_TOKEN,
port: process.env.PORT || 3000,
});
Node.js runtime version
v16.20.2
Steps to reproduce:
// Listen for slash command, which may come with parameters
app.command('/slashCommand', async ({ ack, payload, client, say }) => {
try {
const { channel_id, user_id } = payload;
await ack();
// Tell the user we're doing something
await client.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:
await response({
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.
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/boltversion"@slack/bolt": "^3.22.0"
Your
Appand 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.