OpenTV ENTera & OpenTV Platform Documentation
26.26_Q2 25.52_Q4 25.26_Q2 25.12_Q1 24.50_Q4 24.38_Q3 24.26_Q2 23.50_Q4 23.24_Q2 23.12_Q1 22.50_Q4 22.38_Q3 22.24_Q2
26.26_Q2 25.52_Q4 25.26_Q2 25.12_Q1 24.50_Q4 24.38_Q3 24.26_Q2 23.50_Q4 23.24_Q2 23.12_Q1 22.50_Q4 22.38_Q3 22.24_Q2

Sending a message to a specific device

Request

To send a message to a specific device, send a POST request to:

Bash
http://<host>:<port>/messaging/v1/clients/{client_id}/inbox

The device must already be registered with DMM.

If the message includes a notification section, the device may display it without passing the message to the client application – see “Client processing of messages” in Managing messaging.

Headers

  • Content-Type: application/json

Mandatory fields

  • client_id (in URL) – the ID of the device

  • envelope object containing at least:

    • from – who the notification is from

  • message – the message, as a string that contains JSON: on a single line, with special characters escaped. All values in data must be strings. To include additional fields in data.body, write them as a JSON object and send that object as a string. See Message format – general notifications for the expected message format, and the rules in Managing messaging.
    Within message:

    • Include a notification block if the notification is meant to be presented immediately to the user.

    • Omit the notification block if the client should store the notification so that the user can view it when they choose to (for example, in an inbox).

Optional fields

The envelope object can also contain:

  • id – a UUID that identifies the message. If you don't provide one, DMM generates it.

  • expiration – the message time to live, in seconds

  • event – an event type for tracking. It isn't delivered to the client application; put the message type in data.referenceType.

envelope.from can contain only printable ASCII characters.

If you choose to use the recommended message schema (see Message formats), you can also include the following in a message:

  • An image or video to be included in the message

  • An action to be performed if the user clicks on the message (e.g., open a product, tune to a channel, etc.)

  • A display time for the message

  • A priority level for the message

  • Additional values for referenceType: NOTIFICATION, ALERT, and PROMOTION

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.

Example

A request with this payload sends a message to the device specified in the URL. Here, message is shown as a JSON object for clarity:

JSON
{
  "envelope": {
    "from": "Operator"
  },
  "message": {
    "notification": {
      "body": "20% off all TVOD until Sunday",
      "title": "Discount Movies"
    },
    "data": {
      "body": "20% off all TVOD until Sunday",
      "title": "Discount Movies",
      "referenceType": "NOTIFICATION_UPDATE"
    }
  }
}

In the actual request, message is a string. This is the JSON that you would actually use as the body of the request:

JSON
{
  "envelope": {
    "from": "Operator"
  },
  "message":"{\"notification\":{\"body\":\"20% off all TVOD until Sunday\",\"title\":\"Discount Movies\"},\"data\":{\"body\":\"20% off all TVOD until Sunday\",\"title\":\"Discount Movies\",\"referenceType\":\"NOTIFICATION_UPDATE\"}}"
}

Response

The request returns an HTTP 200 status if the message was sent successfully.
An unsuccessful request returns an HTTP 404 status if the client ID is not recognised.

See also

For full details of this API, see the Device Messaging Manager (DMM) API documentation v1.