2017-07-27 175 views
1

有沒有辦法通過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" },但是也沒有發生任何事情。

感謝

+1

可能的重複[在特定時間每天如何在Slack中觸發一個斜槓命令](https://stackoverflow.com/questions/43762414/how-can-i-trigger-a-slash-command-在特定的時間內每天都有)和[作爲鬆散機器人執行斜槓命令](https://stackoverflow.com/questions/39829741/execute-slash-command-as-slack-bot) –

回答