.git.bak | ||
proper-mail-handler | ||
utils | ||
.gitignore | ||
index.js | ||
package.json | ||
pnpm-lock.yaml | ||
readme.md | ||
test_ical.js | ||
wak.toml |
📅 Google Calendar → Slack Event Notifier
This Node.js app checks your Google Calendar (or an
.ics
link) every few minutes and sends you a Slack DM when an event is currently happening.
It’s great for personal reminders, automatic daily check-ins, or alerting a team when meetings begin.
🚀 Features
- ⏰ Checks upcoming or ongoing events automatically (default: every 5 minutes)
- 🧠 Prevents duplicate notifications per event
- 💬 Sends a formatted Slack message with event details
- 🔐 OAuth2 support for Google Calendar (or iCal alternative)
- ⚙️ Configurable via environment variables
🧩 Tech Stack
- Node.js + Express — lightweight HTTP server
- Google APIs — for Calendar access (optional)
- Slack Web API — to send direct messages
- dotenv — environment configuration
- Custom
getTodaysEvents()
util — fetches calendar data from iCal or Google API
⚙️ Installation
-
Clone the repository
git clone https://github.com/yourusername/calendar-slack-notifier.git cd calendar-slack-notifier
-
Install dependencies
npm install
-
Set up your environment file Create a
.env
file in the project root:SLACK_TOKEN=xoxb-your-slack-bot-token SLACK_USER_ID=U1234567890 PORT=3000 CALENDAR_URL=https://example.com/calendar.ics # (optional for Google OAuth) GOOGLE_CLIENT_ID=... GOOGLE_CLIENT_SECRET=... GOOGLE_REDIRECT_URI=http://localhost:3000/oauth/callback
-
Start the app
node index.js
🔑 OAuth Flow (Optional)
If you want to use Google Calendar API instead of .ics
:
-
Visit
http://localhost:3000/oauth/get-url
to generate your OAuth login URL.
-
Authenticate with your Google account. The callback will be handled at:
http://localhost:3000/oauth/callback
-
The resulting tokens will be stored (you can persist them using QuickDB or any small KV store).
🕒 How It Works
-
The app runs a scheduled interval every 5 minutes.
-
Each run:
- Fetches today’s events from your calendar.
- Checks if an event is happening “now” (±5-minute grace period).
- Sends a Slack DM if it hasn’t already for that event.
- Cleans up old event entries after they end.
isNowBetween(start, end, graceMinutes = 5)
Determines if the current time falls within the event window (with a 5-minute grace).
🔄 API Endpoints
Endpoint | Method | Description |
---|---|---|
/ |
GET | Returns a simple "meow:3" message to confirm the app is running |
/force_refresh |
POST | (WIP) Force refresh the event list (add password protection) |
/oauth/get-url |
GET | Generates Google OAuth URL |
/oauth/callback |
GET | Handles OAuth response and stores tokens |
💬 Example Slack Message
📅 *Daily Standup* is happening now! (09:00–09:30)
🧠 Notes
-
To adjust how often it checks for events, edit the interval at the bottom:
5 * 1000 * 60 // 5 minutes
-
Grace period can be modified in
isNowBetween()
(default: ±5 minutes). -
Ensure your Slack bot has the
chat:write
scope and permission to DM the target user.
🐾 Example Logs
OwO the app is running, you can access it at http://localhost:3000
In 5 minutes you will get a slack dm if u have an event running now
✅ Sent alert for: Daily Standup
📜 License
MIT License © 2025
Would you like me to tailor this README to assume you’re only using iCal (and not Google OAuth), or should I keep both methods described?