Overview
The format of the message that a client receives, and how the client is expected to handle it, depend on the type of message.
In general, all messages share the same top-level format:
{
"notification": {
"title": "<notification_title>",
"body": "<notification_body>"
},
"data": {
"referenceType": "<NOTIFICATION_UPDATE|NOTIFICATION|ALERT|PROMOTION|ENTITLEMENT_UPDATE|EPG_UPDATE|EAS_UPDATE>",
"title": "<data_title>",
"body": "<data_body>"
}
}
The notification section is optional. The fields in data depend on the type of message.
How the message arrives
How the client receives a message depends on the messaging service the device uses:
|
Service |
Devices |
What the client receives |
|---|---|---|
|
Firebase Cloud Messaging (FCM) |
iOS and Android |
The Firebase SDK delivers |
|
Amazon Device Messaging (ADM) |
Fire TV |
The ADM SDK delivers |
|
AWS IoT Core |
Tizen and webOS Smart TVs |
The message payload is the message JSON as text, exactly as it was sent. Parse it to read |
So, whichever service a message comes through:
-
Read values as strings. A value that is a number in one service's message (for example, the
startandendtimes in an EPG update) can arrive as a string through another. Accept both. -
Parse
data.bodyas JSON. InNOTIFICATION,ALERT, andPROMOTIONmessages,data.bodyis a string that contains a JSON object. Parse it to read thedata.body.<field>fields listed below. If it doesn't parse as JSON, treat it as plain text. (InNOTIFICATION_UPDATEmessages,data.bodyis always plain text.) -
Rely only on
notificationanddata. Ignore any other fields added by the messaging service.
Client actions
The client should:
-
Check the value of
data.referenceTypeand act accordingly. See the following pages for each type:-
NOTIFICATION_UPDATE– Message format – general notifications -
EAS_UPDATE– Message format – Emergency Alert System (EAS) -
ENTITLEMENT_UPDATE– Message format – entitlement changes -
EPG_UPDATE– Message format – EPG update -
NOTIFICATION,ALERT, orPROMOTION– Message format – general notifications, alerts, and promotions
EPG changes can also arrive in a format that has no
data.referenceType– see Respond to metadata change notifications. -
-
Check for the presence of a
notificationsection:-
If it is present, the client should immediately display the notification to the user, using the specified
titleandbody. -
If there is no
notificationsection, the client should store the notification so that the user can view it when they choose to (for example, in an inbox).
-
On devices that use Firebase (iOS and Android), if a message includes a notification section and arrives while the client application is in the background or not running, the operating system displays the notification itself. The client application receives the data section only if the user taps the notification. If the user dismisses it, the application never receives the message.
Message schema
EAS updates are not listed here – see Message format – Emergency Alert System (EAS).
Operators can send messages with the following fields. EPG update, entitlement, and EAS messages are generated by the platform and have fixed formats – see their pages, listed above.
Although any fields can be used in the data section, NAGRAVISION recommends that the following fields be used.
Note that these fields rely on the client application being updated to make use of them.
If you use ION as your client application, it does not yet recognise these fields.
Fields named data.body.<field> are inside the JSON object that data.body contains.
|
Field name |
Description |
EPG update |
Entitlement |
Notification (general/OpCon) |
Notification |
Alert |
Promotion |
||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Valid in context |
Value |
Valid in context |
Value |
Valid in context |
Value |
Valid in context |
Value |
Valid in context |
Value |
Valid in context |
Value |
||
|
|
Tells the client what type of message this is |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Specifies the user profile that the message is intended for.
|
|
|
|
|
|
|
|
User profile ID |
|
User profile ID |
|
User profile ID |
|
|
The message title |
|
|
|
|
|
String |
|
String
|
|
String
|
|
String
|
|
|
The message contents |
|
|
|
|
|
|
|
String (optional) |
|
String (optional) |
|
String (optional) |
|
|
What the message refers to: the channel (EPG update) or the account (entitlement) |
|
Channel ID |
|
Account ID |
|
|
|
|
|
|
|
|
|
|
The action associated with the message.
|
|
|
|
|
|
|
|
One of:
|
|
One of:
|
|
One of:
|
|
|
The name of the change |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The priority of the message.
|
|
|
|
|
|
|
|
String |
|
String |
|
String |
|
|
The start of the time window that changed |
|
Unix time (seconds) |
|
|
|
|
|
|
|
|
|
|
|
|
The end of the time window that changed |
|
Unix time (seconds) |
|
|
|
|
|
|
|
|
|
|
|
|
The ID of the device that the entitlement is for |
|
|
|
Device ID, or |
|
|
|
|
|
|
|
|
|
|
The ID of the product whose entitlement has changed. Note the lowercase |
|
|
|
Product ID |
|
|
|
|
|
|
|
|
|
|
The type of product |
|
|
|
One of |
|
|
|
|
|
|
|
|
|
|
The status of the entitlement |
|
|
|
Currently always |
|
|
|
|
|
|
|
|
|
|
The date/time that the entitlement is valid from |
|
|
|
Date/time, for example |
|
|
|
|
|
|
|
|
|
|
The date/time that the entitlement expires |
|
|
|
Date/time, or |
|
|
|
|
|
|
|
|
|
|
The amount of time that the message should be displayed on the screen.
|
|
|
|
|
|
|
|
Time in seconds |
|
Time in seconds |
|
Time in seconds |
|
|
The message body |
|
|
|
|
|
String – simple text message |
|
String containing a JSON object. Its fields depend on the message type and action – see the |
|
String containing a JSON object. Its fields depend on the message type and action – see the |
|
String containing a JSON object. Its fields depend on the message type and action – see the |
|
|
The message text (proposed) |
|
|
|
|
|
|
|
String |
|
String |
|
String |
|
|
The ID of the product to be opened if the user clicks on the message.
|
|
|
|
|
|
|
|
Product ID |
|
Product ID |
|
Product ID |
|
|
The ID of the channel to be navigated to if the user clicks on the message.
|
|
|
|
|
|
|
|
Channel ID |
|
Channel ID |
|
Channel ID |
|
|
The ID of the content to be opened if the user clicks on the message.
|
|
|
|
|
|
|
|
Content ID |
|
Content ID |
|
Content ID |
|
|
The ID of the event to be opened if the user clicks on the message.
|
|
|
|
|
|
|
|
Event ID |
|
Event ID |
|
Event ID |
|
|
The URL of the app to be opened if the user clicks on the message.
|
|
|
|
|
|
|
|
App URL |
|
App URL |
|
App URL |
|
|
The ID of the pack product to be opened if the user clicks on the message.
|
|
|
|
|
|
|
|
Pack ID |
|
Pack ID |
|
Pack ID |
|
|
The URL of an image to be displayed in the message window.
|
|
|
|
|
|
|
|
URL |
|
URL |
|
URL |
|
|
The URL of a video to be displayed in the message window.
|
|
|
|
|
|
|
|
URL |
|
URL |
|
URL |