
Security News
Insecure Agents Podcast: Certified Patches, Supply Chain Security, and AI Agents
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.
jpush-api-nodejs-client
Advanced tools
本SDK提供JPush服务端接口的Node封装,与 JPush Rest API 组件通信。使用时引用该模块即可,可参考附带Demo学习使用方法。
npm install jpush-sdk
#or
{
"dependencies": {
"jpush-sdk": "*"
}
}
此Demo展示如何使用Node lib向所有用户推送通知。
var JPush = require("../lib/JPush/JPush.js");
var client = JPush.buildClient('your appKey', 'your masterSecret');
//easy push
client.push().setPlatform(JPush.ALL)
.setAudience(JPush.ALL)
.setNotification('Hi, JPush', JPush.ios('ios alert', 'happy', 5))
.send(function(err, res) {
if (err) {
console.log(err.message);
} else {
console.log('Sendno: ' + res.sendno);
console.log('Msg_id: ' + res.msg_id);
}
});
client.push().setPlatform('ios', 'android')
.setAudience(JPush.tag('555', '666'), JPush.alias('666,777'))
.setNotification('Hi, JPush', JPush.ios('ios alert'), JPush.android('android alert', null, 1))
.setMessage('msg content')
.setOptions(null, 60)
.send(function(err, res) {
if (err) {
console.log(err.message);
} else {
console.log('Sendno: ' + res.sendno);
console.log('Msg_id: ' + res.msg_id);
}
});
关于Payload对象的方法,参考 详细API文档
本Node lib简易封装获取统计信息的接口,传入推送API返回的 msg_id 列表,多个 msg_id 用逗号隔开,最多支持100个msg_id。
更多详细要求,请参考 Report API 文档
var JPush = require("../lib/JPush/JPush.js");
var client = JPush.buildClient('your appKey', 'your masterSecret');
client.getReportReceiveds('746522674,344076897', function(err, res) {
if (err) {
console.log(err.message);
} else {
for (var i=0; i<res.length; i++) {
console.log(res[i].android_received);
console.log(res[i].ios_apns_sent);
console.log(res[i].msg_id);
console.log('------------');
}
}
});
在程序根目录下执行
mocha test
FAQs
JPush's officially supported Node.js client library.
The npm package jpush-api-nodejs-client receives a total of 1 weekly downloads. As such, jpush-api-nodejs-client popularity was classified as not popular.
We found that jpush-api-nodejs-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.

Security News
The planned feature introduces a review step before releases go live, following the Shai-Hulud attacks and a rocky migration off classic tokens that disrupted maintainer workflows.