Files
streetmerchant/src/notification/index.ts
T
Evan Gentis a21740942b feat: webpage toggle, sound notification, fix evga links (#52)
Co-authored-by: Evan Gentis <evan.gentis@gmail.com>
Co-authored-by: Jef LeCompte <jeffreylec@gmail.com>
2020-09-19 10:42:40 -04:00

27 lines
727 B
TypeScript

import {Config} from '../config';
import sendEmail from './email';
import sendSlaskMessage from './slack';
import sendSMS from './sms';
import playSound from './sound';
export default function sendNotification(cartUrl: string) {
if (Config.notifications.email.username && Config.notifications.email.password) {
sendEmail(cartUrl);
}
if (Config.notifications.slack.channel && Config.notifications.slack.token) {
sendSlaskMessage(cartUrl);
}
if (Config.notifications.phone.number) {
const carrier = Config.notifications.phone.carrier.toLowerCase();
if (carrier && Config.notifications.phone.availableCarriers.has(carrier)) {
sendSMS(cartUrl);
}
}
if (Config.notifications.playSound) {
playSound();
}
}