A dotnet client library for sending digital post (e-Boks) messages via the Logic platform.
In projects or components where you need to access send messages, add a NuGet package reference to Kmd.Logic.DigitalPost.Client.
The simplest example to send a message is:
using (var httpClient = new HttpClient())
using (var tokenProviderFactory = new LogicTokenProviderFactory(configuration.TokenProvider))
{
var client = new DigitalPostClient(httpClient, tokenProviderFactory, configuration.DigitalPost);
var response = await client.SendMessageAsync(IdentifierType.Cpr, "0101010000", "Hi there", "Digital Post test").ConfigureAwait(false);
}The LogicTokenProviderFactory authorizes access to the Logic platform through the use of a Logic Identity issued client credential. The authorization token is reused until it expires. You would generally create a single instance of LogicTokenProviderFactory.
The DigitalPostClient accesses the Logic Digital Post service.
Perhaps the easiest way to configure the Digital Post client is from Application Settings.
{
"TokenProvider": {
"ClientId": "",
"ClientSecret": "",
"AuthorizationScope": ""
},
"Digital Post": {
"SubscriptionId": "",
"ConfigurationId": ""
}
}To get started:
- Create a subscription in Logic Console. This will provide you the
SubscriptionId. - Request a client credential. Once issued you can view the
ClientId,ClientSecretandAuthorizationScopein Logic Console. - Create a digital post configuration. This will give you the
ConfigurationId.
A simple console application is included to demonstrate how to call Logic Digital Post API to transmit a document. You will need to provide the settings described above in appsettings.json.
When run this you should see the message id for the transmission printed to the console.
When configuring your digital post configuration you can optionally specify a callback URL. This allows you to be notified when a citizen or company interacts with your message.
Most importantly, this is how you make use of the inbuilt digital post consent feature. To enable consent you must arrange with the underlying provider for a MaterialID to be configured with this option. NOTE: There is a cost associated with this capability.
Doc2Mail is a provider which can be used in by any system. Please contact Charlie Tango or call 25 10 43 01 to arrange your credentials. There is a cost to use this service.
The e-Boks platform may be used directly by approved government agencies. Access can be arranged by contacting Nets.
The Fake Provider is a simple solution for use in Demo or Test environments and also allows you to begin development immediately whilst you wait for your formal credentials.
The fake provider accepts any message sent and always returns a successful response.