2

I am not sure if what I am trying to do is even possible. I have a Slack App and via that SlackApp I want to control another Slack App which is not mine.

That's probably too abstract, so let's get into detail: There is the SlackApp Foodtrain. If you are a user you just type "/lunchtrain Location Time" and it does it's job. I want my App to activate a Lunchtrain but if I just send a Message via Webhook thats '/lunchtrain Location Time' it doesn't activate the command. You can see it in plaintext. Is there any way to do this properly? Thanks everybody for the help!

1 Answers1

1

The official Slack API does not allow you to issue slash commands, but there is an undocumented API method called chat.command that has this functionality.

Usage example:

https://slack.com/api/chat.command?token=TOKEN&channel=C123456789&command=/who

Check out the documentation for the method on this github for details.

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114
  • Yes that nearly works but it doesn't with /lunchtrain -> error Message = error: 'unknown_command'. Any Ideas? Or is it hopeless and this only works with slacks build-in commands? – Sebastian Schuchmann Oct 19 '17 at 13:46
  • No, it works with custom slash commands too. Just tested it again to verify. Are you sure you spelled the command correctly? Remember you need to include the leading slash of the command in the call – Erik Kalkoken Oct 19 '17 at 17:18
  • Hey SebastianSchuchmann / @Erik-Kalkoken, did you ever figure out how to get this to work? I'm running into the same 'unknown_command' issues that Sebastian saw attempting to follow this. – not-inept Apr 30 '18 at 15:36
  • 1
    Actually, I figured it out after seeing https://stackoverflow.com/questions/40919745/how-do-you-invoke-the-poll-command-using-the-slack-api, it looks like "command" should just be the "/command" and "text" should be any arguments, so you'd do something like "command='/me', text='funny text'". – not-inept Apr 30 '18 at 16:08