Skip to content

Notification

The AlertHawk.Notification service consumes alert events from the Monitoring service (via RabbitMQ or Azure Service Bus), resolves notification targets (email, Slack, Teams, Telegram, webhook, push), and sends notifications through the configured channels.

All API routes are prefixed with /notification (e.g. /notification/api/Notification/SelectNotificationItemList). Most endpoints require JWT Bearer or Azure AD; exceptions are noted below.


Overview

  • Message queue: Consumes alert messages from Monitoring (RabbitMQ or Service Bus)
  • Notification types: Email (SMTP), Slack, Microsoft Teams, Telegram, Webhook (HTTP), Push (Pushy)
  • Notification items: Stored in SQL; each item holds credentials/config per channel (e.g. Slack webhook URL, email SMTP)
  • AES encryption: Sensitive fields (e.g. email password) are encrypted using AesKey and AesIV

Environment Variables

Configuration can be set in appsettings.json or via environment variables (e.g. Helm chart under notification.env). Use __ for nested keys.

General

VariableDescription
ASPNETCORE_ENVIRONMENTRuntime environment (Development, Production)
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT.NET globalization (false recommended)
basePathBase path for Swagger (dev)

Database

VariableDescription
ConnectionStrings__SqlConnectionStringRequired. SQL Server connection string

Message queue (RabbitMQ or Azure Service Bus)

VariableDescription
RabbitMq__HostRabbitMQ host
RabbitMq__UserRabbitMQ username
RabbitMq__PassRabbitMQ password
QueueTypeRABBITMQ or SERVICEBUS
ServiceBus__ConnectionStringAzure Service Bus connection string
ServiceBus__QueueNameService Bus queue name (e.g. notifications)

Authentication API

VariableDescription
AUTH_API_URLRequired. Base URL of the Authentication API (used to resolve user/device tokens for push, etc.)

Encryption (notification item secrets)

VariableDescription
AesKeyAES key (hex string) for encrypting/decrypting notification item credentials
AesIVAES IV (hex string)

Slack (default / fallback)

VariableDescription
slack-webhookurlDefault Slack webhook URL (optional; per-item config is stored in DB)

Push (Pushy)

VariableDescription
PUSHY_API_KEYPushy API key for push notifications

Azure AD / JWT

VariableDescription
AzureAd__ClientId, AzureAd__TenantId, AzureAd__ClientSecret, AzureAd__InstanceAzure AD (for token validation)
Jwt__Key, Jwt__Issuers, Jwt__AudiencesJWT validation

Cache

VariableDescription
CacheSettings__CacheProviderCache provider (e.g. MemoryCache)

Sentry and logging

VariableDescription
Sentry__Enabled, Sentry__Dsn, Sentry__EnvironmentSentry error tracking
Logging__LogLevel__DefaultDefault log level
Logging__LogLevel__Microsoft.IdentityModel.LoggingExtensions.IdentityLoggerAdapterIdentity logger level

Swagger (development)

VariableDescription
SwaggerUICredentials__username, SwaggerUICredentials__passwordBasic auth for Swagger UI

API Controllers

Base path: /notification/api. Auth: JWT Bearer or Azure AD unless noted.

Notification — /notification/api/Notification/*

MethodRouteAuthDescription
POST/SendManualNotificationBearerSend manual notification (body: NotificationSend; supports email, push, etc.)
POST/CreateNotificationItemBearerCreate notification item (channel config)
PUT/UpdateNotificationItemBearerUpdate notification item
DELETE/DeleteNotificationItemBearerDelete notification item (query: id)
GET/SelectNotificationItemListBearerList notification items for current user
POST/SelectNotificationItemListByIdsBearerList notification items by IDs (body: list of ids)
GET/SelectNotificationItemById/{id}BearerGet notification item by ID
GET/SelectNotificationByMonitorGroup/{id}BearerNotification items by monitor group ID
GET/GetNotificationCountBearerNotification log count
GET/ClearNotificationStatisticsBearerClear notification statistics

NotificationType — /notification/api/NotificationType/*

MethodRouteAuthDescription
GET/GetNotificationTypeBearerList notification types (cached)
GET/GetNotificationType/{id}BearerNotification type by ID
POST/InsertNotificationTypeBearerCreate notification type
PUT/UpdateNotificationTypeBearerUpdate notification type
DELETE/DeleteNotificationTypeBearerDelete notification type (query: id)

Version — /notification/api/Version

MethodRouteAuthDescription
GET/NoneAPI version

Supported Channels

TypeDescription
EmailSMTP; credentials stored in notification item (password encrypted with AesKey/AesIV)
SlackWebhook URL per item or slack-webhookurl env
Microsoft TeamsIncoming webhook URL per item
TelegramBot token and chat ID per item
WebhookGeneric HTTP URL and optional headers per item
PushPushy; uses PUSHY_API_KEY and device tokens from Authentication API

Helm Chart Reference

In the Helm chart, Notification is configured under the notification section. Set notification.env with the variables above (e.g. ConnectionStrings__SqlConnectionString, RabbitMq__* or ServiceBus__*, AUTH_API_URL, AesKey, AesIV, PUSHY_API_KEY, Azure AD, JWT, etc.). See Environment variables in the Helm docs.

AlertHawk - Self-hosted monitoring solution.