Egov.Integrations.MNotify 10.0.2

Prefix Reserved
dotnet add package Egov.Integrations.MNotify --version 10.0.2
                    
NuGet\Install-Package Egov.Integrations.MNotify -Version 10.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Egov.Integrations.MNotify" Version="10.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Egov.Integrations.MNotify" Version="10.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Egov.Integrations.MNotify" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Egov.Integrations.MNotify --version 10.0.2
                    
#r "nuget: Egov.Integrations.MNotify, 10.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Egov.Integrations.MNotify@10.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Egov.Integrations.MNotify&version=10.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Egov.Integrations.MNotify&version=10.0.2
                    
Install as a Cake Tool

Egov.Integrations.MNotify

NuGet License: MIT

A .NET library for integrating with the MNotify service. It provides a client to send localized notifications (Email, SMS, Push, etc.), check their status, and manage notification templates. It is designed to be used in services built on the eGov platform and leverages Egov.Extensions.Configuration for secure certificate-based authentication (mTLS).


Table of Contents


Features

  • Send Notifications: Dispatch localized notifications via various channels (Email, SMS, etc.).
  • Status Tracking: Retrieve the current status and detailed recipient-level status of sent notifications.
  • Template Management: Complete CRUD operations for notification templates with localized subjects and bodies.
  • Pagination Support: List notifications and templates with sorting and searching.
  • Certificate-based Auth: Seamless integration with Egov.Extensions.Configuration for mutual TLS (mTLS).
  • Localized Content: Support for English, Romanian, and Russian content.
  • Async-first API: Fully asynchronous methods for all service operations.
  • Built for .NET 10+: Leverages the latest .NET features and performance improvements.

Prerequisites

  • .NET 10.0 or later
  • A valid service certificate for MNotify (PFX or PEM format)
  • Access to the MNotify service API
  • Egov.Extensions.Configuration for certificate management

Installation

Install the package from NuGet:

dotnet add package Egov.Integrations.MNotify

Or via the Package Manager Console:

Install-Package Egov.Integrations.MNotify

Configuration

Add the following sections to your appsettings.json:

{
  "MNotify": {
    "BaseAddress": "https://mnotify.api.example.com"
  },
  "Certificate": {
    "Path": "Files/Certificates/your-certificate.pfx",
    "Password": "your-certificate-password"
  }
}

The MNotify client automatically uses the certificate configured via Egov.Extensions.Configuration.


Usage

Register the certificate and the MNotify client in Program.cs:

using Egov.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

var builder = WebApplication.CreateBuilder(args);

// Register the system certificate (required for mTLS)
builder.Services.AddSystemCertificate(builder.Configuration.GetSection("Certificate"));

// Register the MNotify client
builder.Services.AddMNotifyClient(builder.Configuration.GetSection("MNotify"));

var app = builder.Build();

MNotifyClient Usage

Inject IMNotifyClient into your services to interact with MNotify:

public class NotificationService
{
    private readonly IMNotifyClient _mNotifyClient;

    public NotificationService(IMNotifyClient mNotifyClient)
    {
        _mNotifyClient = mNotifyClient;
    }

    public async Task SendEmailAsync()
    {
        var request = new NotificationRequest
        {
            Subject = new NotificationContent { Romanian = "Bun venit la eGov", English = "Welcome to eGov" },
            Body = new NotificationContent { Romanian = "Vă mulțumim că utilizați serviciile noastre.", English = "Thank you for using our services." },
            ShortBody = new NotificationContent { Romanian = "Bun venit!", English = "Welcome!" },
            Recipients = new List<NotificationRecipient>
            {
                new NotificationRecipient { Type = NotificationRecipientType.IDNP, Value = "1234567890123" }
            }
        };

        Guid notificationId = await _mNotifyClient.SendNotificationAsync(request);
        
        // Later, check the status
        var status = await _mNotifyClient.GetNotificationStatusAsync(notificationId);
        if (status?.Status == NotificationStatus.Delivered)
        {
            // Process success
        }
    }

    public async Task ListNotificationsAsync()
    {
        var pagination = new NotificationPagination { Page = 1, ItemsPerPage = 10 };
        var notifications = await _mNotifyClient.GetNotificationsAsync(pagination);
        // ...
    }
}

Template Management

Manage your notification templates directly:

public async Task ManageTemplatesAsync(IMNotifyClient client)
{
    var newTemplate = new NotificationTemplate
    {
        Name = "WelcomeTemplate",
        Description = "Template for new users",
        Subject = new NotificationContent { Romanian = "Bun venit!" },
        ShortBody = new NotificationContent { Romanian = "Bun venit!" }
    };

    Guid templateId = await client.CreateTemplateAsync(newTemplate);
    
    var template = await client.GetTemplateAsync(templateId);
    
    // Update template
    newTemplate.Description = "Updated description";
    await client.UpdateTemplateAsync(templateId, newTemplate);
    
    // Delete template
    await client.DeleteTemplateAsync(templateId);
}

Error Handling

The client library throws ApplicationException in most error scenarios, wrapping the original response or exception:

Scenario Exception
Certificate not configured ApplicationException
Invalid API response (non-2xx) ApplicationException (contains response body)
Serialization issues JsonException (via ApplicationException)
Cancellation requested OperationCanceledException

Testing

The solution includes a test project Egov.Integrations.MNotify.Tests built with xUnit.

Running the tests

dotnet test src/Egov.Integrations.MNotify.Tests

Or from the solution root:

dotnet test

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for guidelines on how to get started.


Code of Conduct

This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.


AI Assistance

This repository contains an AGENTS.md file with instructions and context for AI coding agents to assist in development, ensuring consistency in code style and project structure.


License

This project is licensed under the MIT License.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Egov.Integrations.MNotify:

Package Downloads
Egov.Fod.BackComponents

Standard backend components for FOD integrations including MDocs, MNotify, MSign, and MPower.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.2 195 4/10/2026