School Menu Connector is a Go application that fetches school lunch menus from the LINQ Connect API generates an ICS file. Oh, and it can also send them via email (using the CLI client). It's designed to be flexible, allowing configuration through both command-line flags and environment variables.
- Fetch lunch menus for a specific date or date range
- Send menus via email
- Configurable through command-line flags or environment variables
- Customizable email subject
- Generate ICS files via web API endpoint
While there is a CLI tool that you can use to send emails and generate ICS files, School Menu Connector now provides a web API for generating ICS files:
Send a POST request to /get-menu
with the following form data:
buildingId
: The ID of the school buildingdistrictId
: The ID of the school districtstartDate
: Start date for the menu (format: MM-DD-YYYY)endDate
: End date for the menu (format: MM-DD-YYYY)
Example using curl:
curl -X POST https://localhost:8080/get-menu \
-F "buildingId=YOUR_BUILDING_ID" \
-F "districtId=YOUR_DISTRICT_ID" \
-F "startDate=MM-DD-YYYY" \
-F "endDate=MM-DD-YYYY"
The biggest thing that you need is the building and district IDs. To find them:
- Go to https://linqconnect.com/ and sign in
- Click on the hamburger menu in the top left corner
- Click on "School Menu"
- Click on your school
- Open up the browser's developer tools (usually F12)
- Click on the "Network" tab
- Search for "FamilyMenu"
- Click on the request
- In the "Query String Parameters" section, find the
districtId
parameter and thebuildingId
parameter - Copy the values and save them in a secure location
Head to the Releases page to download a pre-built binary for your platform, or build from source.
Depending on your platform, you may need to make the binary executable:
chmod +x school_menu_connector
You can then either set up a cron job to run the notifier at a regular interval, or run it manually with the following command:
./school_menu_connector -building=YOUR_BUILDING_ID -district=YOUR_DISTRICT_ID -recipient=recipient@example.com -sender=your_email@example.com -password=your_email_password -smtp=smtp.example.com:587 -subject="School Lunch Menu" -start=MM-DD-YYYY -end=MM-DD-YYYY
For Windows, you can set up a scheduled task to run the notifier at a regular interval, or run it manually with the following command:
./school_menu_connector.exe -building=YOUR_BUILDING_ID -district=YOUR_DISTRICT_ID -recipient=recipient@example.com -sender=your_email@example.com -password=your_email_password -smtp=smtp.example.com:587 -subject="School Lunch Menu" -start=MM-DD-YYYY -end=MM-DD-YYYY
- Go 1.16 or later
- Access to a SMTP server for sending emails
-
Clone the repository:
git clone https://github.com/yourusername/school_menu_connector.git cd school_menu_connector
-
Build the application:
go build -o school_menu_connector
You can run the application using command-line flags or environment variables.
./school_menu_connector \
-building=YOUR_BUILDING_ID \
-district=YOUR_DISTRICT_ID \
-recipient=recipient@example.com \
-sender=your_email@example.com \
-password=your_email_password \
-smtp=smtp.example.com:587 \
-subject="School Lunch Menu" \
-startDate=MM-DD-YYYY \
-endDate=MM-DD-YYYY \
-email \
-ics \
-week-start=MM-DD-YYYY \
-ics-output-path=path/to/output.ics \
-debug
export BUILDING_ID=YOUR_BUILDING_ID
export DISTRICT_ID=YOUR_DISTRICT_ID
export RECIPIENT_EMAIL=recipient@example.com
export SENDER_EMAIL=your_email@example.com
export EMAIL_PASSWORD=your_email_password
export SMTP_SERVER=smtp.example.com:587
export EMAIL_SUBJECT="School Lunch Menu"
export START_DATE=MM-DD-YYYY
export END_DATE=MM-DD-YYYY
export WEEK_START=MM-DD-YYYY
export ICS_OUTPUT_PATH=/path/to/output.ics
export DEBUG=true
building
: Building ID (required)district
: District ID (required)recipient
: Recipient email address (required for email)sender
: Sender email address (required for email)password
: Sender email password (required for email)smtp
: SMTP server and port (default: smtp.gmail.com:587)subject
: Email subject line (default: "Lunch Menu")startDate
: Start date for menu range (format: MM-DD-YYYY, default: today)endDate
: End date for menu range (format: MM-DD-YYYY, default: same as start date)email
: Flag to enable email sendingics
: Flag to enable ICS file generationweek-start
: Start date of the week for ICS file (format: MM-DD-YYYY, default: startDate)ics-output-path
: Custom path for the ICS file outputdebug
: Enable debug output for troubleshooting
Using a cronjob to set up notifications for the next day is easy enough. For me, that means that I want to get a notification every night Sunday-Thursday so that I can give the info to my kid:
0 17 * * 0-4 /home/myuser/.bin/school_menu_connector
The equivalent in Windows would be dropping the executable in a location you want to run it from and creating a scheduled task with something like:
schtasks /create /tn "School Menu Connector Notifications" /tr "C:\path\to\your\binary.exe" /sc weekly /d SUN,MON,TUE,WED,THU /st 17:00
If you want to use the ICS file to display the lunch menu in a web browser or other calendar application, you can use the following command:
./school_menu_connector -building=YOUR_BUILDING_ID -district=YOUR_DISTRICT_ID -ics -week-start=MM-DD-YYYY
Optionally, you can specify an output path for the ICS file:
./school_menu_connector -building=YOUR_BUILDING_ID -district=YOUR_DISTRICT_ID -ics -week-start=MM-DD-YYYY -ics-output-path=path/to/output.ics
- If using Gmail as your SMTP server, you may need to use an "App Password" instead of your regular password and enable "Less secure app access" in your Google Account settings.
- Handle email credentials securely and avoid committing them to version control.
When deploying to DigitalOcean App Platform:
- Ensure that the "Preserve Path Prefix" option is checked for your routes in the App Platform configuration.
- This setting allows the full request path to be passed to your application, which is crucial for proper routing.
Contributions are welcome! Please feel free to submit a Pull Request.
Thank you to @evanhsu for his work on the Magic Mirror module that inspired this project
A Siri shortcut is available for easy access to the School Menu Connector. You can find the shortcut here, or scan the QR code available on the main page of the web application.