mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 14:37:41 +00:00
feat(notification): add pushbullet, add url with notifications (#226)
Co-authored-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
@@ -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}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user