-
Notifications
You must be signed in to change notification settings - Fork 0
/
push.js
32 lines (27 loc) · 906 Bytes
/
push.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
let webPush = require("web-push");
const vapidKeys = {
"publicKey": "BMpvxYxWPTKRXHkm_jV8EOp2lNTeJqKJW-_vNDH97R_HgxYKbPNgJ0VLI_73rOSvAbadqDwyjyPeEkf4e9r-MeE",
"privateKey": "FWbavQyWh04NNzyPFjQu4tPNt-uHCsaJCFrJmz9d4_4"
};
webPush.setVapidDetails(
'mailto:ctrmirna@gmail.com',
vapidKeys.publicKey,
vapidKeys.privateKey
)
var pushSubscription = {
"endpoint": "https://fcm.googleapis.com/fcm/send/fYqWiLHZtLk:APA91bHZddDhiiN6czlTClhmfygp8tARPH1l5hrcVCirY556pARVtfFUpoTuLPsb8bw_GQHfmXX3Mjup_KLZ2vh7u3oEEXCzKVPHz0dLYJsPQtcoXFu82UlygOuIJ1ooutYSK_N-eY85",
"keys": {
"p256dh": "BI1Ipydr363aO586PIiLweF91S6PRvgoW3wC/hsEC3xk+2oJqhG4EzXMthhby4pxzIClhtgNrBdDZ21UoHS2eMU=",
"auth": "TxbWiNve5n7QFpVN84YwKA=="
}
};
var payload = "Bismillah";
var options = {
gcmAPIKey: '51273203006',
TTL: 60
};
webPush.sendNotification(
pushSubscription,
payload,
options
)