# New Notification Setup Guide

### Prerequisites

Your organisation needs to be already integrated into [Mailbox/Pósthólf](https://docs.devland.is/products/postholf)

### Hnipp notification templates

A Hnipp notification template is a reusable resource for sending notifications to users, the template is cross-channel, so the message stays the same across web/app, push and email.

Title = 35 chars Body = 100 chars Internal body = 256 chars

A Hnipp notification consists of:

* **Title (35 chars)**: a short and simple descriptive text giving context
* **External Body (100 chars)**: a required description that **must not** contain any sensitive/private information, can be seen in external clients like email and outside app notifications and in internal clients if Internal Body is not provided
* **Internal Body (256 chars)**: an optional description that **might** contain sensitive/private information, can only be seen in internal clients behind login in website and app
* **Click Action Url**: An optional universal link that sends the user into a deeper context are in web or app related to the message

### Hnipp template variables

The templates are reusable, multi-lingual and can be injected with context specific variables, such as sender, recipient or context specific values

example template

```
Title: Nýtt skjal á Ísland.is
External Body: {{organization}} hefur sent þér nýtt skjal í pósthólfið þitt á Ísland.is
Internal Body: {{organization}} hefur sent þér nýtt skjal: {{documentName}}
Click Action Url: https://island.is/minarsidur/postholf/{{documentId}}
```

becomes:

```
Title: Nýtt skjal á Ísland.is
External Body: Fjársýslan hefur sent þér nýtt skjal í pósthólfið þitt á Ísland.is
Internal Body: Fjársýslan hefur sent þér nýtt skjal: 500.000 kr inneign tilbúin til útborgunar
Click Action Url: https://island.is/minarsidur/postholf/some-unique-document-id
```

Note in the example how the **Internal Body** contains user specific information while the **External Body** does not.

### How to setup a new Hnipp notification template

#### Create and publish

Get in touch with a Stafrænt Ísland contact to create and publish a new Hnipp notification template in the CMS.

#### Preview and test

Preview and test the notification by sending a test message to a test user via [Mailbox/Pósthólf](https://docs.devland.is/products/postholf)-API using the new hnipp notification template in the development environment.\
In the example request below the Hnipp notification template is referred via the **templateId** property and if the template uses dynamic arguments those are provided in the **templateArguments** property

```
POST /api/v1/notifications
[
    {
        "kennitala": "0000000000",
        "senderKennitala": "0000000000",
        "templateId": "HNIPP.EXAMPLE.TEMPLATE",
        "templateArguments": {
            "salutation": "Hello world!" 
        },
        "publicationDate": "2023-04-19T14:50:04.4545645+00:00"
    }
]
```

### Verify Hnipp notification template message on all channels

Once a test message is sent verify the following for all supported languages:

* in-Website notification
  * message appears and looks correct under notification bell
  * clicking on the message performs the desired action
* in-App notification
  * message appears and looks correct under notification bell
  * clicking on the message performs the desired action
* Push notification
  * message is delivered and looks correct on the OS screen of a real test device\
    \&#xNAN;*NB. Test with a real device for actual results. Preferably both iOS and Android*
  * clicking on the message opens the island.is app and performs the desired action&#x20;
* Email notification
  * message looks correct in an email sent to a test user's email client
  * clicking on the message opens the island.is website and performs the desired action

### Well done!

Once a Hnipp notification template is set up and verified it is ready for mass-use on production.
