Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Autocomplete custom data in Slack commands

Just playing with my first slack command. Is there any way of adding custom data from an external API for autocomplete. So what works perfectly right now, is calling the command /assign plus a slack user (both will be autocompleted, nice!). What I want/need is a list of items I would fetch from a remote endpoint, which can be selected by autocomplete.

Is this possible at all?

/assign @userX to [data_by_autocomplete]

Or do I need to solve that by a full conversation like:

=> /assign user @userX
=> BOT: Which task? Here is a list: ...
=> /assign taskY
=> BOT: Assigned TaskY to @userX

But this feels very cumbersome (and wrong). So basically what I want is a remotely fetched list for autocomplete in the same command.

PS: Command and functionality is a simplified example to illustrate the point.

like image 704
everyman Avatar asked Apr 24 '17 15:04

everyman


People also ask

How do I add a slash in Slack?

Go to https://api.slack.com/apps and select your app to create Slash command. Note: Below instructions are given just for reference, you must follow updated instructions given in https://api.slack.com/apps. On the Slack API page, click the Slash Commands tab. Click Create New Command.

How do I create a modal in Slack?

To generate a modal, an app will need to compose an initial view. Apps can compose view layouts and add interactivity to views by using Block Kit. A modal can hold up to 3 views at one time in a view stack.


1 Answers

No, you can not use custom autocomplete within the command line, but you can use custom autocomplete with the the new interactive message menus.

So I would suggest to break it up into two steps.

  1. Enter slash command and provide username
  2. Show interactive menu with autocomplete
like image 170
Erik Kalkoken Avatar answered Nov 15 '22 06:11

Erik Kalkoken