Send Bulk Messages (POST)

Send bulk messages with different options to be specified.

Roles

Users in the following roles are authorized to perform this operation:

  • worklightadmin
  • worklightdeployer
  • worklightmonitor
  • worklightoperator

Method

POST

Path

/management-apis/1.0/runtimes/runtime-name/notifications/applications/application-name/messages/bulk

Example

https://www.example.com/worklightadmin/management-apis/1.0/runtimes/myruntime/notifications/applications/myapplication/messages/bulk?locale=de_DE

Path Parameters

runtime-name
The name of the runtime. This is the context root of the runtime web application, without the leading slash.
application-name
The name of the application.

Query Parameters

Query parameters are optional.

locale
The locale used for error messages.

Consumes

application/json

Produces

application/json, application/xml, text/xml

Payload

The payload in JSON format has values for array of messages, target, and settings.

JSON Example

{
  "//ArrayOfMessageBody" : [
    {
      "messages" : {
        "alert" : "Test message",
      },
      "settings" : {
        "apns" : {
          "badge" : 1,
          "iosActionKey" : "Ok",
          "payload" : "",
          "sound" : "song.mp3",
        },
        "gcm" : {
          "delayWhileIdle" : ,
          "payload" : "",
          "sound" : "song.mp3",
          "timeToLive" : ,
        },
        "mpns" : {
          "raw" : {
            "payload" : {
            },
          },
          "title" : {
            "backBackgroundImage" : "Blue.jpg",
            "backContent" : "Back Title Content",
            "backTitle" : "Back Title",
            "backgroundImage" : "Red.jpg",
            "count" : 1,
            "title" : "Push Notification",
          },
          "toast" : {
            "param" : "/Page2.xaml?NavigatedFrom=Toast Notification",
            "title" : "Hello",
          },
        },
      },
      "target" : {
        "consumerIds" : [ "MyConsumerId1", ... ],
        "deviceIds" : [ "MyDeviceId1", ... ],
        "platforms" : [ "A,G", ... ],
        "tagNames" : [ "Gold", ... ],
      },
    },
    ...
  ],
}

Payload Properties

The payload has the following properties:
//ArrayOfMessageBody
The array of message

The bulk-messages has the following properties:

messages
The array of message
settings
The settings are the different attributes of the notification.
target
Set of targets can be consumer Ids, devices, platforms, or tags.

The message has the following properties:

alert
A string to be displayed in the alert.

The settings has the following properties:

apns
Attributes for sending message to an iOS device.
gcm
Attributes for sending message to an Android device.
mpns
Attributes for sending message to an MPNS device.

The apns has the following properties:

badge
An integer value to be displayed in a badge on the application icon.
iosActionKey
The label of the dialog box button that allows the user to open the app upon receiving the notification.
payload
A JSON block that is transferred to the application if the application is opened by the user when the notification is received, or if the application is already open.
sound
The name of a file to play when the notification arrives.

The gcm has the following properties:

delayWhileIdle
A Boolean value that indicates that the message must not be sent if the device is idle. The server waits for the device to become active before the message is sent.
payload
A JSON block that is transferred to the application if the application is opened by the user when the notification is received, or if the application is already open.
sound
The name of a file to play when the notification arrives.
timeToLive
The duration (in seconds) that the message is kept on GCM storage if the device is offline. Default value is 4 weeks, and must be set as a JSON number.

The mpns has the following properties:

raw
Raw.
title
Title.
toast
Toast.

The raw has the following properties:

payload
A JSON block that is transferred to the application if the application is opened by the user when the notification is received, or if the application is already open.

The title has the following properties:

backBackgroundImage
URL of the back image on a medium flip Tile.
backContent
Content that displays on the back of a medium flip Tile.
backTitle
Title that displays on the back of a flip Tile.
backgroundImage
URL of the front image on a medium flip Tile.
count
An integer value from 1 to 99. If the value of count is not set or it is set to 0, the circle image and value do not display in the Tile. This property is also known as badge.
title
A string that indicates the title of the application. The title fits on a single line of text and must not be wider than the Tile. Approximately 15 characters can fit in the title before it is truncated.

The toast has the following properties:

param
Toast notification content.
title
Toast notification title.

The target has the following properties:

consumerIds
The array of consumer Ids.
deviceIds
JSON array of the device ids. Devices with these ids receive the notification.
platforms
JSON array of platforms. Devices running on these platforms receive the notification. Supported values are A, G, and M.
tagNames
JSON array of tags. Devices that are subscribed to these tags receive the notification.

Response

The status of send messages.

JSON Example

{
  "productVersion" : {
    "productVersion" : "7.0.0",
  },
  "project" : {
    "name" : "PushNotifications",
  },
  "status" : "Success",
  "type" : "SET_PUSH_NOTIFICATION_ENABLED",
}

XML Example

<?xml version="1.0" encoding="UTF-8"?>
<sendMessagesStatus
  status="Success"
  type="SET_PUSH_NOTIFICATION_ENABLED">
  <productVersion productVersion="7.0.0"/>
  <project name="PushNotifications"/>
</sendMessagesStatus>

Response Properties

The response has the following properties:

productVersion
The exact product version.
project
Project name.
status
Message submitted for delivery.
type
Transaction type.

The productVersion has the following properties:

productVersion
The exact product version

The project has the following properties:

name
Name of the project

Errors

403
The user is not authorized to call this service.
404
The corresponding runtime is not found or not running.
500
An internal error occurred.