pushwoosh-client
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "pushwoosh-client", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A node js client to consume the Pushwoosh API to send push notifications to mobile devices", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -30,6 +30,3 @@ # pushwoosh-node-client [![Build Status](https://travis-ci.org/nluo/pushwoosh-node-client.svg?branch=master)](https://travis-ci.org/nluo/pushwoosh-node-client) | ||
client.sendMessage('Hello world', 'device token', function(error, response) { | ||
if (error) { | ||
console.log('Some error occurs: ', error); | ||
} | ||
console.log('Pushwoosh API response is', response); | ||
... | ||
} | ||
@@ -39,6 +36,3 @@ }); | ||
client.sendMessage('Hello world', ['deviceToken1', 'deivceToken2'], function(error, response) { | ||
if (error) { | ||
console.log('Some error occurs: ', error); | ||
} | ||
console.log('Pushwoosh API response is', response); | ||
... | ||
} | ||
@@ -48,2 +42,36 @@ }); | ||
To pass extra options (please refer to the Pushwoosh [doc](https://www.pushwoosh.com/programming-push-notification/pushwoosh-push-notification-remote-api/) for the available options) , you could define an option object and pass it to the function as a 2nd or 3rd parameter. E.g. if you want to pass addtional payload to the device, you could do: | ||
```javascript | ||
var Pushwoosh = require('pushwoosh-client'), | ||
client= new Pushwoosh("AppCode", "AuthToken"), | ||
options = { | ||
data: { | ||
username: 'bob smith', | ||
email: 'bob@example.com' | ||
} | ||
}; | ||
client.sendMessage('Hello world', 'device token', options, function(error, response) { | ||
... | ||
}); | ||
``` | ||
Note that if you define devices or content in the options, the devices and message will be overwritten. | ||
```javascript | ||
var options = { | ||
data: { | ||
username: 'bob smith', | ||
email: 'bob@example.com' | ||
}, | ||
devices: ['deviceToken1', 'deviceToken2', 'deviceToken3'] | ||
}; | ||
client.sendMessage('Hello world', 'device token', options, function(error, response) { | ||
... | ||
}); | ||
``` | ||
Then this will send to ['deviceToken1', 'deviceToken2', 'deviceToken3'] as defined in options. so you probably just want to just do | ||
```javascript | ||
client.sendMessage('Hello world', options, function(error, response) { | ||
... | ||
}); | ||
``` | ||
## Tests | ||
@@ -50,0 +78,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29322
79