Skip to content

Commit

Permalink
Notifications for correspondence
Browse files Browse the repository at this point in the history
  • Loading branch information
Hammerbeck committed Oct 8, 2024
1 parent 0bc8e7d commit 6146249
Show file tree
Hide file tree
Showing 2 changed files with 180 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: Altinn 3 Correspondence Developer guides
linktitle: Notifications
description: How to get started subscribing to Events from Altinn 3 Correspondence, for developers
tags: [Correspondence, guide, events]
toc: true
weight: 40
---

{{<children />}}

{{% notice warning %}}
This section of the documentation is a work in progress, and as such currently makes extensive reference to external sources.
{{% /notice %}}

{{% notice warning %}}
Currently the Events for Correspondence are not ready for full-scale use, due to pending changes in Altinn Events and Authorization.
This documents the expected scenario, but may be subject to change.
{{% /notice %}}

To use notifications in a messaging service, a notification order is placed when a message is created. The notification will primarily be sent out at the publication time of the message. If a reminder is activated, the reminder will be sent after 7 days if the message has not been read.

Notifications can be sent via either email or SMS. While email does not have a time window, SMS notifications are sent between 9:00 AM and 5:00 PM. If the sending time falls outside this window, the notification will be sent the following day.

A notification order is made by adding the following when initializing a message:
```json
{
"Correspondence": {
...,
"notification": {
"notificationTemplate": CustomText (0) | GenericAltinnMessage(1),
"notificationChannel": Email(0) | Sms(1) | EmailPreffered(2) | SmsPreffered(3),
"SendReminder": boolean,
"EmailBody": string?,
"EmailSubject": string?,
"SmsBody": string?,
"ReminderNotificationChannel": Email(0) | Sms(1) | EmailPreffered(2) | SmsPreffered(3),
"ReminderEmailBody": string?,
"ReminderEmailSubject": string?,
"ReminderSmsBody": string?
}
},
"Recipients": [],
"ExistingAttachments":{...}
}
```

## Keyword support
A list of keywords will soon be implemented in Altinn Notifications, but it is not available yet.
This feature will allow you to incorporate keywords into the text, such as \$sendersName\$ to display the name of the organization that sent the correspondence,
or \$recipientName\$ to use the name of the individual or organization receiving the correspondence. Further details will be provided when it is ready.

## Notification Templates
Two types of notification templates are offered when using notifications through the Messaging API.
{{% notice warning %}}
NOTE: These templates is not the final version. And will change, especially when keywords is ready.
{{% /notice %}}

**CustomText:**

- The entire message is written by the sender and sent in full to the recipient.

**GenericAltinnMessage:**

A generic Altinn text with the option to supplement with additional text. Currently supported languages are Norwegian, Nynorsk, and English. The language is chosen based on the language defined in the message.

**Title:** You have received a message in Altinn {textToken}<br>
**Content:** Hello \$recipientName\$, you have received a new message in Altinn from \$sendersName\$. {textToken} Log in to Altinn inbox to see this message.

**Reminder Title:** Reminder - you have received a message in Altinn {textToken}<br>
**Reminder Content:** Hello \$recipientName\$, this is a reminder that you have received a new message in Altinn from \$sendersName\$. {textToken} Log in to Altinn inbox to see this message.

In the text, textToken will be replaced with the value given in, for example, "EmailSubject" for the title. SMS uses only the content, not the title.

Note! Links should NEVER be used in notifications.

## Notification Channels
Supported notification channels:

- **Email:** Sends an email to the recipient.
- **SMS:** Sends an SMS to the recipient. Supports both national and international phone numbers.
- **EmailPreferred:** Uses email as the main communication channel, and SMS as a fallback if email is not available.
- **SmsPreferred:** Uses SMS as the main communication channel, and email as a fallback if SMS is not available.
The first notification and the reminder notification can use different notification channels. For example, the first notification is sent by email, while the reminder notification seven days later is sent by SMS.
## Cancellation of Notification
If a message is deleted before the publication date, the notification order will also be deleted. In situations where an error occurs during the publication of a message, the notification will also be deleted.

## Errors in Notification Ordering
If no contact information is available for a recipient, the message will still be sent as planned. Information about the notification can be viewed by retrieving the details about the specific correspondence. Improvements are planned to provide feedback on this during the creation of a message.
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
title: Altinn 3 Correspondence Utviklerguider
linktitle: Varsling gjennom Altinn Melding
description: Hvordan komme i gang med varslinger gjennom Altinn 3 Melding, for utviklere
tags: [Melding, guide, events, hendelser, Correspondence]
toc: true
weight: 40
---

{{<children />}}

{{% notice warning %}}
Denne delen av dokumentasjonen er under arbeid, og refererer derfor i stor grad til eksterne kilder.
{{% /notice %}}

{{% notice warning %}}
For øyeblikket er varslinger for Melding ikke klare for fullskala bruk, på grunn av kommende endringer i Altinn Notifications.
Dette dokumenterer det forventede scenarioet, men kan endres.
{{% /notice %}}

For å bruke varslinger i en meldingstjeneste, legges en varslingsbestilling til når en melding opprettes. Varslingen vil bli sendt ut på publikasjonstidspunktet for meldingen. Hvis revarsel er aktivert, vil revarselet sendes ut etter 7 dager dersom meldingen ikke er lest.

Varslinger kan sendes via enten e-post eller SMS. Mens e-post ikke har noe tidsvindu, vil SMS-varsler bli sendt mellom kl. 09:00 og 17:00. Hvis avsendingstidspunktet faller utenfor dette tidsvinduet, vil varselet bli sendt neste dag.

En varslingsbestilling gjøres ved å legge til følgende når du initialiserer en melding:

```json
{
"Correspondence": {
...,
"notification": {
"notificationTemplate": CustomText (0) | GenericAltinnMessage(1),
"notificationChannel": Email(0) | Sms(1) | EmailPreffered(2) | SmsPreffered(3),
"SendReminder": boolean,
"EmailBody": string?,
"EmailSubject": string?,
"SmsBody": string?,
"ReminderNotificationChannel": Email(0) | Sms(1) | EmailPreffered(2) | SmsPreffered(3),
"ReminderEmailBody": string?,
"ReminderEmailSubject": string?,
"ReminderSmsBody": string?
}
},
"Recipients": [],
"ExistingAttachments":{...}

}
```

## Keyword støtte
{{% notice warning %}}
Keywords er ikke ferdig implementert, men forventes å være på plass i Q4 2024. Mer dokumentasjon kommer da.
{{% /notice %}}
Keywords er en liste tokens som lar deg personalisere varslingene med for eksempel mottakers navn. For eksempel vil man kunne bruke \$sendersName\$ for å vise organisasjonsnavnet til avsender.

## Varslingsmaler
Det tilbys to typer varslingsmaler når du bruker varsling gjennom Meldings-API`et.
{{% notice warning %}}
NOTE: Disse malene vil kunne endres fremmover. Spesielt da Keywords blir ferdig implementert.
{{% /notice %}}

**CustomText:**
- Hele meldingen skrives inn av avsender og sendes i sin helhet til mottaker.

**GenericAltinnMessage:**
- En generisk Altinn-tekst med mulighet for å supplere med ekstra tekst. Foreløpig støttede språk er norsk, nynorsk og engelsk. Språk velges basert på språket definert i meldingen

**Tittel:** Du har mottatt en melding i Altinn {textToken}<br>
**Innhold:** Hei \$recipientName\$, du har mottatt en ny melding i Altinn fra \$sendersName\$. {textToken} Logg deg inn i Altinn inboks for å se denne meldingen.

**Revarsel tittel:** Påminnelse - du har mottatt en melding i Altinn {textToken}<br>
**Revarsel innhold:** Hei \$recipientName\$, dette er en påminnelse om at du har mottatt en ny melding i Altinn fra \$sendersName\$. {textToken} Logg deg inn i Altinn inboks for å se denne meldingen.

I teksten vil textToken bli byttet ut med verdien gitt i for eksempel "EmailSubject" for tittelen. SMS bruker kun innholdet, ikke tittelen.

NB! Linker skal ALDRI brukes i varslinger.

## Varslingskanaler
Støttede varslingskanaler:
- **Email:** Sender en e-post til mottaker.
- **SMS:** Sender en sms til mottaker. Støtter nasjonale og internasjonale telefonnummre.
- **EmailPreferred:** Bruker e-post som hoved kommunikasjonskanal, og SMS som fallback hvis e-post ikke er tilgjengelig.
- **SmsPreferred:** Bruker SMS som hoved kommunikasjonskanal, og e-post som fallback om SMS ikke finnes.

## Kansellering av varsling
Dersom en melding slettes før publiseringsdatoen, vil varslingsbestillingen også bli slettet. I tilfeller der det oppstår en feil under publisering av en melding, vil varslingen også bli slettet.

## Feil ved bestilling av varsling
Hvis det ikke finnes kontaktinformasjon for en mottaker, vil meldingen fortsatt bli sendt som planlagt.
Informasjon om varslingen kan sees ved å hente detaljer om den spesifikke meldingen.
Det er planlagt forbedringer for å gi tilbakemelding omkring dette under opprettelsen av en melding.

0 comments on commit 6146249

Please sign in to comment.