ConvergeERP.Shared.Alerts
0.0.1-beta
dotnet add package ConvergeERP.Shared.Alerts --version 0.0.1-beta
NuGet\Install-Package ConvergeERP.Shared.Alerts -Version 0.0.1-beta
<PackageReference Include="ConvergeERP.Shared.Alerts" Version="0.0.1-beta" />
<PackageVersion Include="ConvergeERP.Shared.Alerts" Version="0.0.1-beta" />
<PackageReference Include="ConvergeERP.Shared.Alerts" />
paket add ConvergeERP.Shared.Alerts --version 0.0.1-beta
#r "nuget: ConvergeERP.Shared.Alerts, 0.0.1-beta"
#:package ConvergeERP.Shared.Alerts@0.0.1-beta
#addin nuget:?package=ConvergeERP.Shared.Alerts&version=0.0.1-beta&prerelease
#tool nuget:?package=ConvergeERP.Shared.Alerts&version=0.0.1-beta&prerelease
ConvergeERP.Shared.Alerts
This package contains the integration events and canonical message contracts required for backend services to trigger notifications via the Alert Service.
Publishing Domain Events
The AlertDomainEvent record is the single, canonical message contract. Services do not need to publish different event types; instead, they publish an AlertDomainEvent and specify the notification type using the EventCode property.
1. Configuration
Ensure MassTransit is configured in your publishing service to route to RabbitMQ:
services.AddMassTransit(cfg =>
{
cfg.UsingRabbitMq((context, rabbitCfg) =>
{
rabbitCfg.Host(new Uri("rabbitmq://your-rabbitmq-host"), h =>
{
h.Username("username");
h.Password("password");
});
});
});
2. Triggering a Notification
Inject IBus (or IPublishEndpoint) and send the AlertDomainEvent directly to the alerts.domain-events queue.
private readonly IBus _bus;
public async Task PublishNotificationAsync()
{
var alertEvent = new AlertDomainEvent
{
Id = Guid.CreateVersion7(),
EventCode = "invoice.awaiting_approval", // Must match a registered event code
TenantId = currentTenantId, // Required for tenant-scoped events
CompanyId = currentCompanyId, // Required for tenant-scoped events
RecipientIdentityId = approverIdentityId, // Who should receive the notification
ReferenceEntity = "Invoice",
ReferenceEntityId = invoice.Id,
Payload = new Dictionary<string, JsonElement>
{
["invoiceNumber"] = JsonSerializer.SerializeToElement(invoice.Number)
},
CorrelationId = Guid.CreateVersion7(),
OccurredAt = DateTime.UtcNow
};
var endpoint = await _bus.GetSendEndpoint(new Uri("queue:alerts.domain-events"));
await endpoint.Send(alertEvent);
}
3. Message Fields Breakdown
To ensure your notification is routed and rendered correctly, ensure the fields are populated as follows:
| Field | Description | Example |
|---|---|---|
Id |
Unique identifier for the event itself. Should be a UUID v7. | Guid.CreateVersion7() |
EventCode |
CRITICAL: The specific string that tells the alert service which template to render. | "invoice.awaiting_approval" |
TenantId |
Required for tenant-scoped notifications. Must be null for platform events. |
currentTenantId |
CompanyId |
Required for tenant-scoped notifications. Must be null for platform events. |
currentCompanyId |
RecipientIdentityId |
The specific user identity who should receive the notification in their bell dropdown. | approverIdentityId |
ReferenceEntity |
The type of entity the notification is about. | "Invoice", "LeaveRequest" |
ReferenceEntityId |
The ID of the entity. The alert service automatically injects this into the template as {referenceEntityId}. |
invoice.Id |
Payload |
Dynamic template variables. Keys here must match the placeholders in the notification template. | {"invoiceNumber": "INV-001"} |
CorrelationId |
Identifier used for distributed tracing across microservices. | Guid.CreateVersion7() |
OccurredAt |
The exact timestamp when the business event took place. | DateTime.UtcNow |
ExpiresAt |
(Optional) When the notification should auto-expire or be deemed irrelevant. | null |
4. Registered Event Codes & Payloads
Each EventCode maps to a specific template. The Payload dictionary must contain the variables the template expects, otherwise they will render as empty strings.
Tenant-Scoped Events (Requires TenantId and CompanyId)
| EventCode | Required Payload Keys | Rendered Example |
|---|---|---|
leave.request.submitted |
leaveDates |
"Your leave request for 12–14 May has been submitted." |
leave.request.approved |
leaveDates |
"Your leave request for 12–14 May has been approved." |
leave.request.rejected |
leaveDates |
"Your leave request for 12–14 May was rejected." |
invoice.awaiting_approval |
invoiceNumber |
"Invoice INV-001 is awaiting your approval." |
invoice.rejected |
invoiceNumber |
"Invoice INV-001 has been rejected." |
payroll.run.completed |
runName |
"Payroll run April 2026 completed successfully." |
user.invited |
(none required) | "You have been invited to Converge ERP." |
user.password.expiring |
daysRemaining |
"Your password expires in 3 day(s)." |
workflow.approval |
workflowName |
"Approval required for Expense Claim." |
Platform-Scoped Events (Must have TenantId=null and CompanyId=null)
| EventCode | Required Payload Keys | Rendered Example |
|---|---|---|
tenant.provisioning.failed |
tenantName |
"Provisioning failed for tenant Acme Corp." |
system.maintenance.scheduled |
startTime |
"Maintenance starts at 2026-04-25T02:00:00Z." |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.1-beta | 780 | 4/28/2026 |