通过 Slack 发送命令 API

Sending command via Slack API

有没有办法通过 API 以编程方式将 command 发送到 Slack?我已使用

成功发布消息
var postingResponse = client.UploadValues("https://slack.com/api/chat.postMessage", 
                      "POST", new NameValueCollection() {
                            {"token","<token>"},
                            {"channel","<ID>"}, 
                            {"text", "/mycommand hello" },
                            {"username","<username>" },
                            {"link_names", "true" },
                            {"parse", "full" }
                       });

这很好用,但 /mycommand hello 只是打印为文本而不是作为命令执行。我尝试添加一对 {"command", "/mycommand hello" } 但也没有任何反应。

谢谢

我没有自己尝试,而是根据 there is the undocumented API method chat.command for executing commands in public channels. There is also a Python program for sending commands to slack

命令chat.command需要权限范围post。 但是,此作用域现在已失效(请参阅 list of all scopes)。

我刚刚询问 Slack 客户支持是否仍然可以以编程方式发送斜杠命令并收到以下回复:

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