1

Here's my need : I want that, depending on a user's message (for instance, a message with an url, or some code, ...), a modal window (or an ephemeral message, or whatever) allows the user to select some keywords. These keywords will be added to the original message.

Sample screens [1]: https://i.stack.imgur.com/sgZG4.png [2]: https://i.stack.imgur.com/4Ka83.png

With tutorials, I manage to

  • launch a modal window from a slash command, and write to the channel some things depending on this modal (but in my need, i don't want the user to launch himself a command for the modal. It has to be automatic)
  • trigger on action depending on a user's input : with a slackbot, who responds with its own message on the channel (but there is no interaction with the user to choose keywords)
  • post an epehemeral message with some inputs, but failed at writing anything in the channel and remove the epehemeral message.

With my understanding, the 2nd option can't work because I need a trigger id to call a modal, and to have interaction capacity right?

In the 3rd option, I don't understand how to deal with trigger_id, response_url, ... from the initial post to its update (I'm quite new in slack app programming. Some terms are still difficult to deal with for now).

Thanks for your help, advice, ideas, ...

J.

Julien.h
  • 11
  • 2

1 Answers1

1

A modal can only be triggered as a response to an action a user takes. It can't happen automatically without the user prompting it via a slash command, shortcut or button. This is because to call views.open you need a trigger id.

You could try using the Events API. You can have your app "listening" for certain messages or Slack actions and have your app respond depending on what you are listening for. The next step would be to send a message with the keywords to the user either via DM or ephemeral (DM is probably best practice here) using chat.postMessage. You can get the values you need for that API call from the event payload.

sandra
  • 1,301
  • 3
  • 3