forked from pusher/push-notifications-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.js
37 lines (34 loc) · 871 Bytes
/
example.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
33
34
35
36
37
const PushNotifications = require('./push-notifications.js');
let beamsClient = new PushNotifications({
instanceId: '8f9a6e22-2483-49aa-8552-125f1a4c5781',
secretKey: 'C54D42FB7CD2D408DDB22D7A0166F1D'
});
beamsClient
.publishToInterests(['donuts'], {
apns: {
aps: {
alert: 'Hi!'
}
}
})
.then(response => {
console.log('Response:', response);
})
.catch(error => {
console.error('Error:', error);
});
beamsClient
.publishToUsers(['user-12345'], {
fcm: {
notification: {
title: 'Hello, world!',
notification: 'What a time to be alive'
}
}
})
.then(response => {
console.log('Response:', response);
})
.catch(error => {
console.error('Error:', error);
});