2017-07-27 4 views
1

Existe-t-il un moyen d'envoyer par programme un command à Slack via l'API? Je souhaite publier un message avec succès en utilisantCommande d'envoi via l'API 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" } 
         }); 

Cela fonctionne bien, mais le est simplement imprimé sous forme de texte au lieu d'exécuter une commande. J'ai essayé d'ajouter une paire {"command", "/mycommand hello" } mais rien ne s'est produit non plus.

Merci

+1

Copie possible de [Comment puis-je déclencher une commande de barre oblique dans Slack tous les jours à un certain moment] (https://stackoverflow.com/questions/43762414/how-can-i-trigger-a-slash-command- in-slack-every-day-at-a-time-time) et [Exécuter la commande slash en tant que bot lâche] (https://stackoverflow.com/questions/39829741/execute-slash-command-as-slack-bot) –

Répondre