Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to add Slash Commands in a Slack CLI app #206

Closed
despolov opened this issue Aug 24, 2023 · 5 comments
Closed

Question: How to add Slash Commands in a Slack CLI app #206

despolov opened this issue Aug 24, 2023 · 5 comments
Labels
question Further information is requested

Comments

@despolov
Copy link

Hello,

Im currently developing an app using the slack cli way and I want to add /slash commands support. How can this be achieved using the CLI way?

@filmaj filmaj added the question Further information is requested label Aug 24, 2023
@filmaj
Copy link
Contributor

filmaj commented Aug 24, 2023

Hello!

There is no support for slash commands in the new automation platform. If you create a workflow and pair a shortcut trigger to it, it will become searchable in the Slack client in the same way that slash commands are, though (i.e. type / into the message composer and a list of slash commands (old) and shortcut-triggered workflows (new) will be displayed). So while the entry points are subtly different (between slash commands and shortcut triggers), they are essentially the same thing. Hopefully the two are interchangeable for you. If not, let me know and let's discuss!

@despolov
Copy link
Author

Got it, thanks. I guess shrotcut triggers will do the work for me.
The only bad part I could name now is that, there will be no way to pass data to the shortcut trigger from the message composer

@filmaj
Copy link
Contributor

filmaj commented Oct 17, 2023

@despolov that is a good point, however, you could just as, if not more! easily collect data from the user using the OpenForm step as the first step in your workflow. This gives users a rich UI that offers many niceties (such as selecting dates or users or channels, etc.) for providing data to your workflows.

Going to close this issue but feel free to re-open if you'd like to discuss more.

@filmaj filmaj closed this as completed Oct 17, 2023
@AndrewHUNGNguyen
Copy link

Will there be future support for the slash command?

@jpaulgale
Copy link

jpaulgale commented Nov 25, 2024

@filmaj Thank you for the info above.

I am having issues implementing your solution above in a way that makes sense from a UX perspective.

It appears as though, using my deno app (discussed here) which has two triggers

  • a link trigger which starts a workflow (openForm)
  • a weekly scheduled trigger which sends a message containing the link trigger as a workflow_button
CallForKudosWorkflow.addStep(
  Schema.slack.functions.SendMessage,
  {
    channel_id: CallForKudosWorkflow.inputs.channel,
    message:
      "Submit here to recognize any of your teammates who deserve kudos! :slightly_smiling_face:",
    interactive_blocks: [{
      type: "actions",
      elements: [
        {
          type: "workflow_button",
          workflow: {
            trigger: {
              url:
                "https://slack.com/shortcuts/Ft081R9GT04F/31f5df52f3f230ec4a002302c8c0efa0", // This is your shortcut url for open_form_trigger, generated by running in cli slack trigger create and selecting open_form_trigger
            },
          },
          text: { type: "plain_text", text: "Give Kudos" },
          style: "primary",
        },
      ],
    }],
  },
);

it appears as though the only way to make the first trigger available via slash command (aka the ability to open up the form outside of clicking the button in that message)

is to have each user click the first link to start the workflow once (not via the button in the message but via the link itself or unfurled button in the link message), and then afterwards the workflow's title is searchable via slash command for that user.

This is to say the workflow step does not have an actual assigned slash command but "Open Kudos Form" (the name of the workflow step), is just searchable via "/kudos", "/openkudos", etc.

Is this the only way to allow a workflow step to be triggered via slash command? Feels like a strong disincentivization of this kind of behavior.

Ideally, I want users to be able to trigger a form submission via a slash command whenever they'd like. And because I deployed this via CLI, none of the customary app options are available in the App Management page, and the documentation is confusing to me.

It appears as though the only thing one can do is

  • include "commands" in the app's manifest's botScopes
  • follow the above guidance for each user one wants slash command access to the workflow step.

Sincerely appreciate your help. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants