当消息与正在处理的同一文件有关时,我正在尝试使用同一线程中的 webhook 向 google 聊天 API 发送帖子消息。现在消息正在发布,但不在同一个线程中。任何帮助将不胜感激。
public async Task ExecutionStarted(string fileName, string filePath)
{
var today = DateTime.Now.ToString("yyyyMMddTHH:mm:ss");
string json = "{\"text\":\"" + today + ": Processing file " + fileName + " from " + filePath + "\"}";
await PostToGoogleChat(json);
}
public async Task PostToGoogleChat(string json)
{
HttpClient client = new HttpClient();
var content = new StringContent(json, Encoding.UTF8, "application/json");
var result = await client.PostAsync(new Uri(_chatUrl), content);
}