Created
October 21, 2020 23:32
-
-
Save andrewarosario/60f11cf0fc608439d4845b743775711a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpush = require('web-push'); | |
const pushSubscription = { | |
endpoint: '< Push Subscription URL >', | |
keys: { | |
p256dh: '< User Public Encryption Key >', | |
auth: '< User Auth Secret >' | |
} | |
}; | |
const payload = { | |
title: 'Título da notificação', | |
body: 'Corpo da notificação', | |
icon: 'https://cdn3.iconfinder.com/data/icons/business-avatar-1/512/8_avatar-256.png', | |
vibrate: [100, 50, 100], | |
data: { | |
dateOfArrival: Date.now(), | |
primaryKey: 1 | |
} | |
}; | |
webpush.sendNotification(pushSubscription, payload); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment