Altinn / altinn-notifications

Altinn platform microservice for handling notifications (mail, sms, etc)
MIT License
2 stars 3 forks source link

Support for placeholder keywords for dynamic changes in texts based on recipient #545

Open SandGrainOne opened 3 months ago

SandGrainOne commented 3 months ago

Description

We want the Notifications service to have solid support for having multiple independent recipients in a single order. This means the texts needs to have some basic support for personalization based on recipient. Like addressing the recipient by name.

There needs to be way for service owners to make smaller recipient specific adjustments to the content of notifications. The feature here should be a search and replace in texts

Keywords copied from Altinn 2 and adjusted for Altinn 3:

Keyword Description
$recipientFirstName$ The first name of a person
$recipientMiddleName$ The middle name of a person
$recipientLastName$ The surname of a person
$recipientName$ The full name of the recipient
$recipientNumber$ The organization number when recipient is an organization. Left empty if recipient is a person.

Example

A simple request with personalized texts:

{
    "subject": "Happy birthday $recipientFirstName$!",
    "body": "Hi $recipientFirstName$, To celebrate your birthday $recipientBirthDay(dd/mm)$. Here is a gift card!",
    "recipients": [
        {
            "nationalIdentityNumber": "18874198354"
        }
    ]
}

Additional Information

The source of the keyword list above is inspired by Altinn 2 documentation: List of Varselmakroer. The list is curated down to a list of keywords actually being used in Altinn 2.

Refinement

Tasks

Acceptance criteria

olebhansen commented 1 month ago

Pending a suitable endpoint to surce data from (#589 #593 )

SandGrainOne commented 1 month ago

Updated the list of keywords we're going to support after the #604 analysis.