将传入的 Webhook 消息转发到 Microsoft Teams 中特定的聊天。

huangapple go评论86阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年4月7日 00:37:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/75951828.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定