Skip to content

indrivo/GR.Notifications.MNotify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GR.Notifications.MNotify

Implementation of gov service MNotify

Build Status

.NET

NuGet Nuget

Usage

  1. Install package from nuget
Install-Package GR.Notifications.MNotify
  1. Register th services:
public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    private IConfiguration Configuration { get; }

    //...

    public void ConfigureServices(IServiceCollection services)
    {
        //...
        services.AddMNotify(Configuration);
        //...
    }

    //...
}
  1. Add configuration on your appsettings.json file:
{
  "MNotifyOptions": {
    "ServiceClientAddress": "https://testmnotify.gov.md:8443/MNotify.svc",
    "ServiceCertificatePath": "<certificate file name>.pfx",
    "ServiceCertificatePassword": "<certificate password>"
  }
}

ServiceClientAddress - url of service ServiceCertificatePath - physical path to pfx certificate ServiceCertificatePassword - certificate password

  1. Inject MNotify Service and send notifications
public class FooService{
    private readonly IMNotifyService _service;

    public FooService(IMNotifyService _service){
        _service = service;
    }

    public async Task FooMethodAsync(){
        var sendResult = await mNotifyService.SentNotificationAsync(new MNotifyNotification
        {
            Sender = new MNotifyPerson("UserName", "foo@foo.com"),
            Recipient = new MNotifyPerson("UserName", "foo@foo.com"),
            NotificationType = "Test",
            Subject = "Notification subject",
            Content = "Test notification"
        });
    }
}

About

Implementation of gov service MNotify

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages