Azure 是否有相当于 Amazon AWS Slack 通知的功能?

问题描述 投票:0回答:1

在AWS中我有代码,用于发送Slack通知,如下所示:

using Amazon.SimpleNotificationService;
using Amazon.SimpleNotificationService.Model;
..................
var client = new AmazonSimpleNotificationServiceClient(); // connect using network creds
var request = new PublishRequest(slackTopicArn, message);
var response = await client.PublishAsync(request);

这提供了一种简单、简洁的方式来发送 Slack 消息。

是否有与此类似的 Azure 功能,或者我必须使用带有 Slack URL 的 Web 客户端??

c# azure slack
1个回答
0
投票

简单的答案是——不。 Azure 中没有类似 Amazon 的功能可以通过提供 ARNMessage 本身来简化 Slack 通知。

 PublishRequest(slackTopicArn, message)

我完全明白,这就是服务总线和 Slack Webhooks 的配置,它们发挥了神奇的作用。但如果是 Azure,则必须执行手动 POST,例如

using (var client = new HttpClient())
{
    var httpContent = new StringContent(slackMessage, Encoding.UTF8);
    // add your headers
    httpContent.Headers.Add(... , ...);

    HttpResponseMessage response = await client.PostAsync(uri, httpContent);

}

此帖子命中 lambda,流程从那里开始。

© www.soinside.com 2019 - 2024. All rights reserved.