A simple Node.js-based bot that sends notifications every 3 minutes using Windows, macOS, or Linux native notification systems.
- Sends a notification every 3 minutes (configurable)
- Works across platforms: Windows, macOS, and Linux
- Customizable title and message for the notification
Before you begin, ensure you have the following installed:
- Node.js (version 14.x or higher)
- npm (comes with Node.js)
git clone https://github.com/vectorbyteio/notification-bot.git
cd notification-botnpm installnpm startor simply:
node index.jsThe bot will start running, and a notification will pop up every 3 minutes.
You can customize the notification interval and message by editing index.js.
Update the title and message properties in the notifier.notify() function:
notifier.notify({
title: 'Your Custom Title',
message: 'Your custom message here!',
sound: true,
wait: true,
});Modify the cron expression in schedule.scheduleJob(). The format is:
┌───────────── second (0 - 59)
│ ┌───────────── minute (0 - 59)
│ │ ┌───────────── hour (0 - 23)
│ │ │ ┌───────────── day of month (1 - 31)
│ │ │ │ ┌───────────── month (1 - 12, or Jan - Dec)
│ │ │ │ │ ┌───────────── day of week (0 - 6, or Sun - Sat)
│ │ │ │ │ │
│ │ │ │ │ │
* * * * * *
By Seconds:
*/10 * * * * *- Every 10 seconds*/30 * * * * *- Every 30 seconds0 * * * * *- Every minute at 0 seconds
By Minutes:
*/1 * * * *- Every 1 minute*/5 * * * *- Every 5 minutes*/15 * * * *- Every 15 minutes*/30 * * * *- Every 30 minutes
By Hours:
0 * * * *- Every hour at 0 minutes0 9 * * *- Every day at 9:00 AM0 9,17 * * *- Every day at 9:00 AM and 5:00 PM
By Days:
0 0 1 * *- First day of every month at midnight0 0 15 * *- 15th day of every month at midnight0 0 1,15 * *- 1st and 15th of every month
By Months:
0 0 1 1 *- Every January 1st at midnight0 0 1 6 *- Every June 1st at midnight0 0 1 1,6 *- June 1st and January 1st
By Day of Week:
0 9 * * 1- Every Monday at 9:00 AM0 9 * * 1-5- Every weekday at 9:00 AM0 9 * * 0,6- Every weekend at 9:00 AM
30 2 15 6 *- June 15th at 2:30 AM0 8 * * 1-5- Every weekday at 8:00 AM15 14 * * *- Every day at 2:15 PM0 */6 * * *- Every 6 hours*/15 9-17 * * *- Every 15 minutes between 9 AM and 5 PM
For more flexibility, you can use JavaScript Date objects instead of cron:
// Run at a specific time
const now = new Date();
const scheduledTime = new Date(now.getTime() + 60000); // 60 seconds from now
schedule.scheduleJob(scheduledTime, function() {
sendNotification();
});
// Run at a specific date and time
const specificDate = new Date(2025, 11, 25, 14, 30, 0); // Dec 25, 2025 at 2:30 PM
schedule.scheduleJob(specificDate, function() {
sendNotification();
});For more control, use RecurrenceRule:
const schedule = require('node-schedule');
const rule = new schedule.RecurrenceRule();
// Set specific days, hours, minutes, seconds
rule.dayOfWeek = [0, 6]; // Sunday and Saturday
rule.hour = 14; // 2 PM
rule.minute = 30; // 30 minutes
rule.second = 0; // 0 seconds
schedule.scheduleJob(rule, function() {
sendNotification();
});For more information, see node-schedule documentation and crontab.guru.
Notifications Not Showing: Ensure that your system's notification manager is properly configured:
- For Windows 10+: Notifications should display by default. Check your notification settings.
- For Linux: Ensure the notification daemon (e.g., D-Bus, systemd-logind) is active.
- For macOS: Ensure the app has notification permissions.
Bot Not Starting: Make sure Node.js and npm are installed correctly, and all dependencies are installed via npm install.