Skip to content

shahamish/benchapp-google-calendar-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’ BenchApp to Google Calendar Sync

Automatically synchronize your BenchApp hockey schedule with Google Calendar using Google Apps Script. Perfect for busy hockey families who want all events in one place!

✨ Features

  • πŸ”„ Automatic Syncing: Runs every 6 hours to keep calendars in sync
  • πŸ“… Full CRUD Support: Adds new events, updates changes, removes canceled games
  • 🚫 No Duplicates: Smart tracking prevents duplicate events
  • βš™οΈ Configurable: Customize event prefixes, sync frequency, and date ranges
  • πŸ” Detailed Logging: Clear logs for monitoring and troubleshooting
  • πŸ§ͺ Test Mode: Complete test suite for safe deployment

πŸš€ Quick Start

Prerequisites

  • Google account with access to Google Calendar
  • BenchApp account with team calendar access
  • 10 minutes for setup

Installation

  1. Get Your BenchApp Calendar URL

    • Open BenchApp mobile app or website
    • Go to your team calendar
    • Look for "Export" or "Subscribe" option
    • Copy the calendar URL (looks like: https://ics.benchapp.com/...)
  2. Set Up Google Apps Script

    • Go to script.google.com
    • Create new project
    • Copy the code from src/hockey-sync.js
    • Update the configuration with your calendar details
  3. Configure Your Settings

    • Copy src/config.js to your Google Apps Script as a separate file
    • Update the configuration with your actual calendar details:
   const CONFIG = {
     FAMILY_CALENDAR_ID: 'your-actual-calendar@gmail.com',
     HOCKEY_CALENDAR_URL: 'https://ics.benchapp.com/your-actual-url',
     EVENT_PREFIX: '[Hockey] ',
     // ... other settings
   };
  1. Initialize
    setupSync();     // One-time setup
    setupTriggers(); // Enable automatic syncing

πŸ“– Documentation

πŸ’ Why This Exists

Hockey families know the struggle:

  • βœ… Game schedules in BenchApp
  • βœ… Family events in Google Calendar
  • ❌ Constantly copying events between calendars
  • ❌ Missing games because they weren't in the family calendar

This script solves that by automatically keeping everything in sync!

πŸ”§ How It Works

  1. Fetches hockey schedule from BenchApp's ICS feed
  2. Compares with existing events in your Google Calendar
  3. Syncs changes (new events, updates, deletions)
  4. Repeats automatically every 6 hours

🎯 Perfect For

  • Hockey parents managing family schedules
  • Players who want all events in one calendar
  • Teams wanting to share schedules with families
  • Anyone using BenchApp + Google Calendar

πŸ“Š What Gets Synced

BenchApp Event Google Calendar Result
New game added βž• Event created with [Hockey] prefix
Time changed πŸ“ Existing event updated
Game canceled πŸ—‘οΈ Event removed from calendar
Location updated πŸ“ Location synced automatically

βš™οΈ Configuration Options

const CONFIG = {
  FAMILY_CALENDAR_ID: '',    // Target Google Calendar
  HOCKEY_CALENDAR_URL: '',   // BenchApp ICS URL
  EVENT_PREFIX: '[Hockey] ', // Prefix for hockey events
  DAYS_LOOKBACK: 7,         // How far back to sync
  DAYS_LOOKAHEAD: 90,       // How far forward to sync
};

## πŸ“ File Structure
src/
β”œβ”€β”€ hockey-sync.js    # Main sync logic
└── config.js         # Configuration template (update with your values)

**For Google Apps Script:**
- Create two files: `Code.gs` (main script) and `config.gs` (your configuration)
- Keep your real calendar IDs in the config file only

πŸ› Troubleshooting

Events Being Updated Every Sync

Fixed in v1.2: Improved description handling to prevent false positive updates due to UID-only descriptions.

Rate Limiting Issues

The script includes 300ms delays between calendar operations to prevent Google's rate limits.

Location Addresses Not Clickable

Fixed in v1.2.1: Location fields now properly unescape ICS formatting characters (\n, \,) so addresses display correctly and link to Google Maps.

Script Deletes All Events When Source is Down

Critical Fix in v1.3.1: Added error handling to prevent data loss when BenchApp servers are unavailable. The script now fails safely rather than deleting events when it cannot fetch data.

Symptoms: Script removes all hockey events after a 504 or other HTTP error Solution: Updated error handling prevents sync when source data is unavailable

🀝 Contributing

Contributions welcome! Please feel free to submit a Pull Request.

Ideas for Enhancement

  • Support for multiple teams/calendars
  • Slack/Discord notifications for schedule changes
  • Integration with other sports apps
  • Custom event formatting options

πŸ“œ License

MIT License - see LICENSE file for details.

⭐ Support

If this saved you time, please star the repository!

Found a bug? Open an issue


Made with ❀️ by a hockey parent tired of copying calendar events manually

πŸ™ Credits

Created by shahamish with assistance from Claude AI.

About

πŸ’ Automatically sync BenchApp hockey schedules to Google Calendar using Google Apps Script

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors