.net 如何从特定用户向特定用户发送消息,在网络中有松弛
我曾尝试使用chat.postmessage方法作为slack中的bot用户发送消息,并将用户id放在频道的位置。我想从slack team user中的特定用户id发送任何用户 如果您有Slack bot,则必须使用from Slack API。您只需发送包含数据的web请求,例如:.net 如何从特定用户向特定用户发送消息,在网络中有松弛,.net,c#-4.0,.net,C# 4.0,我曾尝试使用chat.postmessage方法作为slack中的bot用户发送消息,并将用户id放在频道的位置。我想从slack team user中的特定用户id发送任何用户 如果您有Slack bot,则必须使用from Slack API。您只需发送包含数据的web请求,例如: string exampleJson = " { \"text\": \"This is a line of text.\nAnd this is another one.\" }"; var http = (
string exampleJson = " { \"text\": \"This is a line of text.\nAnd this is another one.\" }";
var http = (HttpWebRequest)WebRequest.Create(new Uri("YOUR-SLACK-WEBHOOK-URL"));
http.ContentType = "application/json";
http.Method = "POST";
Byte[] bytes = new ASCIIEncoding().GetBytes(exampleJson);
Stream newStream = http.GetRequestStream();
newStream.Write(bytes, 0, bytes.Length);
newStream.Close();
new StreamReader(http.GetResponse().GetResponseStream()).ReadToEnd();
对你的问题的描述非常广泛。请包括您尝试过的一些代码以及您可能收到的任何错误消息。这将帮助你得到答案。也请看一看。