PTO Slack Bot

Sends PTO reminders to Slack from shared team Google Calendar.

image.png

  • Monday: Weekly summary of ALL OOOs overlapping this week
  • Tue-Thu: Tomorrow reminders for NEW OOOs starting next day
  • Fri-Sun: No notifications

Setup

1. Google Calendar Connection

  1. Remix this val

  2. Go to pipedream.val.run

  3. Configure the following for your shared calendar:

    image.png

  4. Copy the generated code into googleCalendar.ts

2. Slack Webhook

  1. Go to api.slack.com/apps
  2. Create app → From Scratch → Select workspace
  3. Incoming Webhooks → Toggle ON → Add New Webhook
  4. Select your #ooo channel → Copy webhook URL
  5. Add environment variable: SLACK_WEBHOOK_URL = webhook URL

Implementation Notes

The code handles several edge cases that Google Calendar API presents:

  • All-day vs timed events: All-day events use date format while timed events use dateTime
  • API pagination: Must specify timeMin/timeMax parameters to get all events
  • Event consolidation: Multiple PTO entries for same person are merged into date ranges
  • Partial days: Timed events less than 8 hours are marked as "partial"
  • Name extraction: Supports both [name] PTO format and first-word extraction from titles