SlackNotificationService
Models & Types · AiDotNet.TrainingMonitoring.Notifications
Slack notification service using webhooks or bot tokens.
Implements: INotificationService
How It Works
For Beginners: This service sends training notifications to Slack. You can use either an incoming webhook (simpler) or a bot token (more flexible).
Webhook Example:
Bot Token Example:
To create a webhook:
- Go to
https://api.slack.com/apps - Create a new app or select existing
- Go to Incoming Webhooks
- Add a webhook to your workspace
- Copy the webhook URL
Constructors
| Constructor | Summary |
|---|---|
SlackNotificationService(SlackConfiguration configuration, HttpClient httpClient) |
Creates a new Slack notification service. |
Properties
| Property | Summary |
|---|---|
bool IsConfigured { get; } |
|
string ServiceName { get; } |
Methods
| Method | Summary |
|---|---|
Task<bool> SendAsync(TrainingNotification notification, CancellationToken cancellationToken) |
|
Task<bool> TestConnectionAsync(CancellationToken cancellationToken) |
|
bool Send(TrainingNotification notification) |
|
void Dispose() |
Disposes the Slack service resources. |