1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-10 06:02:24 -05:00
Brant DeBow 75a2da3c4b
[PM-17562] Add support for extended properties on event integrations (#5755)
* [PM-17562] Add support for extended properties on event integrations

* Clean up IntegrationEventHandlerBase

* Respond to PR feedback
2025-05-05 08:04:59 -04:00

36 lines
1.1 KiB
C#

using System.Text.Json;
using System.Text.Json.Nodes;
using Bit.Core.Enums;
using Bit.Core.Models.Data.Integrations;
using Bit.Core.Repositories;
#nullable enable
namespace Bit.Core.Services;
public class SlackEventHandler(
IUserRepository userRepository,
IOrganizationRepository organizationRepository,
IOrganizationIntegrationConfigurationRepository configurationRepository,
ISlackService slackService)
: IntegrationEventHandlerBase(userRepository, organizationRepository, configurationRepository)
{
protected override IntegrationType GetIntegrationType() => IntegrationType.Slack;
protected override async Task ProcessEventIntegrationAsync(JsonObject mergedConfiguration,
string renderedTemplate)
{
var config = mergedConfiguration.Deserialize<SlackIntegrationConfigurationDetails>();
if (config is null)
{
return;
}
await slackService.SendSlackMessageByChannelIdAsync(
config.token,
renderedTemplate,
config.channelId
);
}
}