1

my bot returns some contents and I want to copy that content over to the clipboard. Obviously, the user can select the content and copy. But, from a UI perspective since this is a slack BOT, I was thinking about adding an interactive button - "copy" which when clicked will copy the contents to the clipboard. I know this sounds weird but this was an ask from an exec for whom I am building the app. Let me know if you need more details.

Gandalf spade
  • 11
  • 1
  • 3
  • Welcome to Stackoverflow. If you like to get an answer to your problem, you please need to be a lot more specific on what your issues is. Also please add your current source code and what is not working. – Erik Kalkoken Dec 18 '17 at 18:05
  • Thanks for responding. my bot returns some contents and I want to copy that content over to the clipboard. Obviously, the user can select the content and copy. But, from a UI perspective since this is a slack BOT, I was thinking about adding an interactive button - "copy" which when clicked will copy the contents to the clipboard. I know this sounds weird but this was an ask from an exec for whom I am building the app. Let me know if you need more details. – Gandalf spade Dec 19 '17 at 04:10
  • To word it differently. How can I call a system command (copy in this case) from an interactive button on slack. – Gandalf spade Dec 19 '17 at 04:11
  • Thanks for the additional Info. Please add that info to your original question, so that ppl better understand what you are asking. – Erik Kalkoken Dec 19 '17 at 04:24

1 Answers1

2

Interactive buttons in Slack do not directly support copying content to the user's clipboard. They only do one of two things:

  1. Send a request to a Slack app for further processing (see interactive buttons)
  2. Redirect the user to a webpage (see link buttons)

However, to implement this feature you could redirect to a webpage that implements the copy to clipboard feature via java script (example).

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114
  • That is pretty sneaky of Slack developers to keep people using their platform. Lots harder to retype by hand than to get a link to the message itself… – brethvoice Oct 19 '21 at 11:40