英文:
Forwarding channel message by incoming webhook to a specific chat in microsoft teams
问题
I've configured an incoming webhook and pushes messages into it this way:
使用一个传入的Webhook配置,并以以下方式推送消息:
using (var httpClient = new HttpClient())
{
using (var request = new HttpRequestMessage(new HttpMethod("POST"), TeamsWebhook_Url))
{
request.Content = new StringContent($"{'text':'Application started by {Environment.UserName}'}");
request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
var response = await httpClient.SendAsync(request);
}
}
That works fine. Now I want the incoming message forwarded to a chat, is that possible? I found hints to do that by an listener, but I need the chat id to use that.
这个方法可以正常工作。现在我想将传入消息转发到聊天中,是否可能?我找到一些提示,可以通过侦听器来实现,但我需要聊天的ID来使用它。
Has anyone an example how to do that?
有人有关于如何实现这一点的示例吗?
Thanks
谢谢
英文:
I've configured an incoming webhook and pushes messages into it this way:
using (var httpClient = new HttpClient())
{
using (var request = new HttpRequestMessage(new HttpMethod("POST"), TeamsWebhook_Url))
{
request.Content = new StringContent($"{'text':'Application started by {Environment.UserName}'}");
request.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");
var response = await httpClient.SendAsync(request);
}
}
That works fine. Now I want the incoming message forwarded to a chat, is that possible? I found hints to do that by an listener, but I need the chat id to use that.
Has anyone an example how to do that?
Thanks
答案1
得分: 1
目前无法通过传入的Webhook将频道消息转发到Microsoft Teams中的特定聊天。
您可以在此处提出此功能建议:
Microsoft Teams社区
作为一种解决方法,您可以使用Graph API获取频道消息,然后您可以创建聊天和在聊天中发送消息,并使用聊天ID。
英文:
Currently its not possible to forward channel message by incoming webhook to a specific chat in Microsoft teams.
You can suggest this feature here:
Microsoft Teams Community
As a workaround using graph Api you can get the channel message and then you can create the chat and send the message in chat using chat id.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论