Reputation: 21
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.sstatic.net/sgZG4.png [2]: https://i.sstatic.net/4Ka83.png
With tutorials, I manage to
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.
Upvotes: 1
Views: 1769
Reputation: 1566
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.
Upvotes: 1