通过Slack API发送命令
问题描述:
有没有办法通过API以编程方式将command
发送到Slack?我成功地使用张贴通过Slack API发送命令
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" }
});
这种运作良好,但只是打印为文本,而不是作为一个命令执行的消息。我尝试添加一对{"command", "/mycommand hello" }
,但是也没有发生任何事情。
感谢
答
我没有尝试,这也使我自己,但根据this answer有公共频道执行命令的未公开的API方法chat.command。还有一个Python program for sending commands to slack。
可能的重复[在特定时间每天如何在Slack中触发一个斜杠命令](https://*.com/questions/43762414/how-can-i-trigger-a-slash-command-在特定的时间内每天都有)和[作为松散机器人执行斜杠命令](https://*.com/questions/39829741/execute-slash-command-as-slack-bot) –