/altinn-notifications-sms

Microservice for sending sms

Primary LanguageC#MIT LicenseMIT

altinn-notifications-sms

This component handles the functionality related to sending an sms through Altinn Notifications.

Project organization

This is a backend WebAPI solution written in .NET / C# following the clean architecture principles. The solution is into three projects, each with their associated test project.

Altinn.Notifications.Sms

The API layer that consumes services provided by Altinn.Notifications.Sms.Core

Relevant implementations:

  • Program.cs

Altinn.Notifications.Sms.Core

The domain and application layer that implements the business logic of the system.

Relevant implementations:

  • Interfaces for external dependencies implemented by infrastructure layer
  • Domain models
  • Services for handling sending of sms

Altinn.Notifications.Sms.Integrations

The infrastructure layer that implements the interfaces defined in Altinn.Notifications.Sms.Core for integrations towards 3rd-party libraries and systems.

Relevant implementations:

  • Client for integrating with sms service

Getting started

Getting started

  1. .NET 8.0 SDK
  2. Newest Git
  3. A code editor - we like Visual Studio Code
  4. Podman or another container tool such as Docker Desktop

Cloning the application

Clone Altinn Notifications Sms repo and navigate to the folder.

git clone https://github.com/Altinn/altinn-notifications-sms
cd altinn-notifications-sms

Setting up Kafka broker and visualization

Ensure that Docker and Podman are installed and is running.

In a terminal navigate to the root of this repository and run command podman compose -f setup-kafka.yml up -d

Kafdrop is now available at http://localhost:9000.

Set up credentials for the SMS Gateway

If you need working end to end functionality when working on Notifications Sms the connection to Link Mobility's SMS gateway needs to be set up.

We recommend settings it up as a user secret with the commands below.

cd src Altinn.Notifications.Sms
dotnet user-secrets init
dotnet user-secrets set "SmsGatewaySettings:Username" "insert-username"
dotnet user-secrets set "SmsGatewaySettings:Password" "insert-password"
dotnet user-secrets set "SmsDeliveryReportSettings:Username" "insert-username"
dotnet user-secrets set "SmsDeliveryReportSettings:Password" "insert-password"

Running the application with .NET

The Notifications SMS component can be run locally when developing/debugging. Follow the install steps above if this has not already been done.

  • Navigate to src/Altinn.Notifications.Sms, and build and run the code from there, or run the solution using you selected code editor

    cd src/Altinn.Notifications.Sms
    dotnet run