feat(notification): add pushbullet, add url with notifications (#226)

Co-authored-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
fuckingrobot
2020-09-23 10:45:04 -04:00
committed by GitHub
parent 20656805c1
commit 74490eae3a
11 changed files with 106 additions and 8 deletions
+19
View File
@@ -0,0 +1,19 @@
import {Config} from '../config';
import {Link} from '../store/model';
import {Logger} from '../logger';
import PushBullet from 'pushbullet';
const pushBulletApiKey = Config.notifications.pushBulletApiKey;
export function sendPushBulletNotification(cartUrl: string, link: Link) {
const pusher = new PushBullet(pushBulletApiKey);
const title = `🚨 ${link.brand} ${link.model} ${link.series} 👀`;
pusher.note({}, title, cartUrl, (err: Error, result: string) => {
if (err) {
Logger.error(err);
} else {
Logger.info(`↗ pushbullet notification sent: ${result}`);
}
});
}