Skip to content

Notification Service

Gihan Karunarathne edited this page Jun 17, 2014 · 1 revision

5. Notification

Notification Service.

swisher_client.Notification("appSecret", "appId", [options])

var swisher_client = require('swisher-client'),
    notification = swisher_client.Notification("7780aa6c75f9439ed416e0501294a3831abe1a05", "8", {
      grantType : "access_token",
      scope     : "test"
    });

notification.sendMessagesToRecipients(recipients, msg, optional, callback)

Parameters:

recipients (Array of String)

Array of recipient IDs who are going to receive the message.

msg (String)

Message to deliver among users who are registered and subscribe to a specific channel.

optional (JSON)

Optional parameters (Empty object such as {} or JSON object provide with key value pairs);

  • deliverOffline (boolean) Sending offline messages (true/false).When it is true offline messages will deliver to particular channel.
notification.sendMessagesToRecipients(["7780aa6c75f9439ed416e050","7780aa6c75f9439ed416e050"],"Hey!", {"deliverOffline":"true"},
  function(err, result){
    if (err) {
      // Handle Error Here
    } else {
      // -- Code Here
    }
});

notification.sendMessagesToChannel(channel, msg, optional, callback)

Parameters:

channel (String)

Array of recipient IDs who are going to receive the message.

msg (String)

Message to deliver among users who are registered and subscribe to a specific channel.

optional (JSON)

Optional parameters (Empty object such as {} or JSON object provide with key value pairs);

  • deliverOffline (boolean) Sending offline messages (true/false).When it is true offline messages will deliver to particular channel.
notification.sendMessagesToRecipients("test_channel", "Hey!", {"deliverOffline":"true"},
  function(err, result){
    if (err) {
      // Handle Error Here
    } else {
      // -- Code Here
    }
});

Clone this wiki locally