Webportal v2

embedded apps

API Reference - HMI.notification

Required Privacy: Data & Location
Operations:

This API allows to create and interact with the HMI notification center.

webportal-v2-notification

Input Parameter
Param name Description Type Unit/Values Example Required
appId

ID of your App.

string

n/a

com.example.app true
title

Notification title.

string

n/a

Car maitenance reminder true
text

Notification text.

string

n/a

Your appointment with your favorite garage has been confirmed. true
timestamp

Timestamp to display for this notification.

string

regular unix timestamp

1573041587 true
userData
 .cutsom

Custom field for user data.

string

n/a

payload true
userData
 .trackingParam

TrackingParam field for user data.

string

n/a

af0426 true
Output Data
Data name Description Type Unit/Values Example
notificationId

ID of the notification you just set-up. This ID is also returned in Susbscribe. 'notificationId': 0 means that the notification has not been created (see errorCode)

int

n/a

42
errorCode

Error code related to the notification.

int

- eOk = 0: 'dialog was opened'

- eFailure: 'unspecified error happened'

- eInvalidParameters: 'invalid parameters were passed'

- eDiscardedByPriority: 'higher priority panel is shown on the screen'

- eConditionsNotCorrect: 'discarded by check of specific conditions'
0
Code Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
webportal.set(
    /* api name */
    "HMI.notification",
    /* parameters */
     {
    "appId": "com.mybrand.app",
    "title": "Car maintenance reminder",
    "text": "Your appointment with your favorite garage has been confirmed.",
    "timestamp": 1573041587,
    "userData": {
      "custom": "payload",
      "trackingParam": "af0426"
    },
  } 
  )
  /* callback for `REPLY` messages */
  .then((message) => {
    if (message.status === 200) {
      /* handle `REPLY` success */
    }
    else { /* handle `REPLY` error */ }
  })
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
  "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0", 
  "type": "SET", 
  "api": "HMI.notification",
  "params":  {
    "appId": "com.mybrand.app",
    "title": "Car maintenance reminder",
    "text": "Your appointment with your favorite garage has been confirmed.",
    "timestamp": 1573041587,
    "userData": {
      "custom": "payload",
      "trackingParam": "af0426"
    },
  } 
}
1
2
3
4
5
6
7
8
9
10
11
12
13
// --- format of the `REPLY` message ---

{
  "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
  "type": "REPLY",
  "api": "HMI.notification",
  "status": 200,
  "statusText": "OK", 
  "data": {
    "notificationId": 42, 
    "errorCode": 0
  } 
}

false

This API allows to create and interact with the HMI notification center.

webportal-v2-notification

Input Parameter
No input params
Output Data
Data name Description Type Unit/Values Example
notificationId

ID of the notification being tiggered. This ID is also returned in Set.

int

n/a

42
event

Event related to the triggering of this notification.

Enum of strings

closed

42
userData
 .cutsom

Custom field for user data.

string

n/a

payload
userData
 .trackingParam

TrackingParam field for user data.

string

n/a

af0426
Code Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
webportal.subscribe(
    /* api name */
    "HMI.notification",
    /* parameters */
     null,
    /* callback for `NOTIFY` messages */
    async (notifyMessage) => {
      if (notifyMessage.status === 200) {
        /* handle `NOTIFY` response */
      }
      else { /*  handle `NOTIFY` error  */ }
    }
  )
  /* callback for `REPLY` messages */
  .then((message) => {
    if (message.status === 200) {
      /* handle `REPLY` success */
    }
    else { /* handle `REPLY` error */ }
  })
1
2
3
4
5
6
{
  "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0", 
  "type": "SUBSCRIBE", 
  "api": "HMI.notification",
  "params":  null
}
1
2
3
4
5
6
7
8
9
10
11
// --- format of the `REPLY` message ---
// type: acknowledge the status of the subscription
// reception: only once after the subscription request
// contains outputed data: no
{
  "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
  "type": "REPLY",
  "status": 200,
  "statusText": "OK"
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// --- format of the `NOTIFY` message ---
// type: event message about the subscription
// reception: each time the conditions of the subscription are met
// contains outputed data: yes
{
  "id": "7372c16f-5f2f-42c9-84a7-5490e35f1be0",
  "type": "NOTIFY",
  "api": "HMI.notification",
  "status": 200,
  "statusText": "OK", 
  "data": {
    "notificationId": 42,
    "event": "closed",
      "userData": {
        "custom": "payload",
        "trackingParam": "af0426"
      }
  } 
}