No description
Find a file
2025-10-10 02:38:10 +00:00
.git.bak why has gh ban me >:3 2025-10-05 13:41:15 -04:00
proper-mail-handler why has gh ban me >:3 2025-10-05 13:41:15 -04:00
utils why has gh ban me >:3 2025-10-05 13:41:15 -04:00
.gitignore why has gh ban me >:3 2025-10-05 13:41:15 -04:00
index.js why has gh ban me >:3 2025-10-05 13:41:15 -04:00
package.json why has gh ban me >:3 2025-10-05 13:41:15 -04:00
pnpm-lock.yaml why has gh ban me >:3 2025-10-05 13:41:15 -04:00
readme.md Update readme.md 2025-10-10 02:38:10 +00:00
test_ical.js why has gh ban me >:3 2025-10-05 13:41:15 -04:00
wak.toml why has gh ban me >:3 2025-10-05 13:41:15 -04:00


📅 Google Calendar → Slack Event Notifier

asciicast 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. Its 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

  1. Clone the repository

    git clone https://github.com/yourusername/calendar-slack-notifier.git
    cd calendar-slack-notifier
    
  2. Install dependencies

    npm install
    
  3. 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
    
  4. Start the app

    node index.js
    

🔑 OAuth Flow (Optional)

If you want to use Google Calendar API instead of .ics:

  1. Visit

    http://localhost:3000/oauth/get-url
    

    to generate your OAuth login URL.

  2. Authenticate with your Google account. The callback will be handled at:

    http://localhost:3000/oauth/callback
    
  3. 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:

    1. Fetches todays events from your calendar.
    2. Checks if an event is happening “now” (±5-minute grace period).
    3. Sends a Slack DM if it hasnt already for that event.
    4. 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:0009: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 youre only using iCal (and not Google OAuth), or should I keep both methods described?