5MInnov.Tools.WebhookNotification.Domain
1.0.1
See the version list below for details.
dotnet add package 5MInnov.Tools.WebhookNotification.Domain --version 1.0.1
NuGet\Install-Package 5MInnov.Tools.WebhookNotification.Domain -Version 1.0.1
<PackageReference Include="5MInnov.Tools.WebhookNotification.Domain" Version="1.0.1" />
paket add 5MInnov.Tools.WebhookNotification.Domain --version 1.0.1
#r "nuget: 5MInnov.Tools.WebhookNotification.Domain, 1.0.1"
// Install 5MInnov.Tools.WebhookNotification.Domain as a Cake Addin #addin nuget:?package=5MInnov.Tools.WebhookNotification.Domain&version=1.0.1 // Install 5MInnov.Tools.WebhookNotification.Domain as a Cake Tool #tool nuget:?package=5MInnov.Tools.WebhookNotification.Domain&version=1.0.1
5M Innov Webhook Notification
Description
5M Innov Webhook Notification est un package NuGet permettant d'envoyer des notifications sur un webhook, tel que Microsoft Teams, Slack, etc. Ce projet est utile pour superviser des applications et être averti en temps réel d'un problème critique.
Fonctionnalités principales
- Envoi de notifications sur un webhook.
- Supervision des applications.
- Avertissement en temps réel des problèmes critiques.
Prérequis
- .NET 8.0 ou version ultérieure
Installation
Vous pouvez installer ce package via NuGet Package Manager Console :
Install-Package 5MInnov.Tools.WebhookNotification.Domain
ou via le .NET CLI :
dotnet add package 5MInnov.Tools.WebhookNotification.Domain
Exemple d'utilisation
Au prélable il faut identifier le webhook de destination. Par exemple pour Microsoft Teams, il faut créer un canal et ajouter un connecteur de type "Webhook" et copier l'URL du webhook. Pour finir, il faut installer le nuget 5MInnov.Tools.WebhookNotification.MicrosoftTeams.Adapters qui permet d'envoyer des notifications sur un canal Microsoft Teams. SI vous souhaitez implémenter votre propre adapter, vous pouvez utiliser le nuget 5MInnov.Tools.WebhookNotification.Ports.
Voici un exemple basique pour envoyer une notification :
using _5MInnov.Tools.WebhookNotification.Domain;
using _5MInnov.Tools.WebhookNotification.Domain.Models;
using _5MInnov.Tools.WebhookNotification.Domain.Ports;
using _5MInnov.Tools.WebhookNotification.Enums;
using _5MInnov.Tools.WebhookNotification.MicrosoftTeams.Adapters;
using _5MInnov.Tools.WebhookNotification.Ports;
using _5MInnov.Tools.WebhookNotification.Ports.Models;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
IConfiguration Configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.json")
.Build();
WebhookNotificationSettings webhookNotificationSettings = new WebhookNotificationSettings();
Configuration.Bind("WebhookNotificationSettings", webhookNotificationSettings);
var serviceProvider = new ServiceCollection()
.AddSingleton<IWebhookNotificationSettings, WebhookNotificationSettings>(f => webhookNotificationSettings)
.AddSingleton<IWebhookNotification, MsTeamsWebhookNotification>()
.AddLogging()
.AddSingleton<IWebhookNotificationService, WebhookNotificationService>()
.BuildServiceProvider();
IWebhookNotificationService? webhookNotificationService = serviceProvider.GetService<IWebhookNotificationService>();
if (webhookNotificationService != null)
{
bool result = await webhookNotificationService.PostNotificationAsync(NotificationType.Error, "Test error message", description: "Description détaillée de l'erreur");
}
Exemple de configuration Webhook
Au préalable il faut configurer la partie Webhook Setting dans un fichier appsettings.json :
{
"WebhookNotificationSettings": {
"WebhookUrl": "https://webhoook.url",
"InformationLinkUrl": "https://google.com",
"Title": "Test App Console"
}
}
Contributeurs
Licence
Ce projet est sous licence 5M Innov.
Autres informations pertinentes
Pour toute question ou suggestion, veuillez contacter mtrezieres@5minnov.fr.
Liens Utiles
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Fix readme