ubuntudroid
ubuntudroid

Reputation: 3989

Execute slash command as slack bot

I'm writing a simple slack bot which should execute other slack commands upon being called. Everything is up and running, however the slack commands this bot issues don't seem to be executed.

For instance my bot posts /giphy kitten every hour and the message appears just like that in the channel (so the sending side seems to work), but the slash command itself isn't executed. If I post the same command into the same channel myself it works as expected. Are bots not allowed to execute slash commands?

Upvotes: 23

Views: 19476

Answers (2)

b.geisb
b.geisb

Reputation: 96

The command chat.command needs the permission scope post, which only legacy tokens have and which is not available for Slack apps.

I just asked the Slack customer support if sending slash commands programmatically is still possible and received the following reply:

I'm afraid not. Slash commands can only be triggered by human-sent messages from the client. Apologies.

Upvotes: 5

Erik Kalkoken
Erik Kalkoken

Reputation: 32698

Bots can use the undocumented API method chat.command to invoke slash commands.

See here for an unofficial documentation page of this API method.

This question was also answered here.

Upvotes: 19

Related Questions