1.6.3 • Published 5 years ago

node-push v1.6.3

Weekly downloads
18
License
MIT
Repository
github
Last release
5 years ago

node-push

Pushfication written in Nodejs

How to use

pusher = require('node-push')

pusher.configure({
  apn: {
    cert: 'cert.pem'
    key: 'key.pem'
    expiry: 3600 # seconds
    sound: 'ping.aiff'
    useSandbox: false
  }
  baidu: {
    secret: 'your app secret'
  }
  mailgun: {
    domain: 'your-domian.mailgun.org'
    apiKey: 'appkey'
  }
  luosimao: {
    user: 'username'
    apiKey: 'apiKey'
  }
})

pusher.mailgun.send({
  from: 'SKY <sky@your-domain.mailgun.org>'
  to: 'xxx@your-domain.com'
  subject: 'test'
  html: 'html'
  text: 'text'
  'o:testmode': true
}, (err, ret) ->
  console.log err, ret
)

pusher.apn.send({
  deviceToken: 'xxxx'
  alert: 'new message'
  badge: 1
  sound: 'ping.aiff'
  extra: {}
})
pusher.baidu.send({
  messages: JSON.stringify
    title: 'title'
    description: 'desc'
    custom_content:
      badge: 1
  user_id: 'user_id'
})
pusher.luosimao.send({
  mobile: 1111111111
  message: '夏季炎热,注意防暑降温'
}, (err, resp) ->
  console.log err, resp
})

pusher.xiaomi.send({
  description: "发送内容"
  pass_through: 1
  payload: "urlencode%20内容"
  registration_id: 'xiaomi token'
  title: 'today'
  notify_type: 2
  extra: # 额外的数据,key 的用"extra." 开头
    "extra._objectId": "d2ewed4r"
    "extra.objectType": 'reminder'
})

others

mailgun subscribe

pusher.mailgun.subscribe(`listAddress`, {
  subscribed: true
  address: 'your@exmaple.com'
  name: 'yourname'
  description: 'your info'
}, (err, ret) ->
  console.log err, ret
)

API

configure(options)

  • TODO

apns.push(object)

push a message via APNs to certain device. The object include

  • deviceToken: hexed apple device token
  • alert:
  • category:
  • badge:
  • sound:

apns.getInvalidDevices(callback(error, list))

return a list with invalid device's hex

xiaomi.push(object)

push a message via XIAOMI to certain device. The object include

  • registration_id: (string) xiaomi device token
  • description:
  • pass_through:
  • payload:
  • title:
  • notify_type:

xiaomi.getInvalidDevices(callback(error, list))

return a list with invalid device's hex

1.6.3

5 years ago

1.6.2

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.5.1

6 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.2.0

9 years ago

0.1.9

9 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago