Posts the daily menu from one OpenMensa canteen to a Mattermost channel via Incoming Webhook.
- Canteen: defaults to ID
1779(the mensa you linked: https://openmensa.org/c/1779) - Schedule: every weekday (Mon–Fri) at 10:00 local time (configurable)
- Runtime: simple Python worker, Railway-ready
At the scheduled time, the script fetches the menu for the configured canteen from the OpenMensa API and posts a formatted message to your Mattermost channel using an Incoming Webhook.
Required
- MATTERMOST_WEBHOOK: Mattermost Incoming Webhook URL
Optional (with defaults)
- MENSA_ID: OpenMensa canteen ID. Default:
1779 - TIMEZONE: IANA time zone name. Default:
Europe/Berlin - POST_HOUR: Hour (0–23) to post. Default:
10 - POST_MIN: Minute (0–59) to post. Default:
0 - WEEKDAYS: APScheduler cron day_of_week string. Default:
mon-fri
Tip: to find a canteen’s ID, open its page on OpenMensa (e.g. https://openmensa.org/c/1779 – the number is the ID).
- Install dependencies
pip install -r requirements.txt- Set environment variables (example)
set MATTERMOST_WEBHOOK=https://mattermost.example/hooks/XXXX
set MENSA_ID=1779
set TIMEZONE=Europe/Berlin- Start the worker
python mensa_spy.pyIt will run continuously and post automatically according to the schedule. To test quickly, you can change POST_HOUR/POST_MIN to a minute or two in the future.
This repo includes a Procfile with:
worker: python mensa_spy.py
Steps
- Create a new Railway project from this repository
- In Railway → Variables, add:
- MATTERMOST_WEBHOOK (required)
- Optionally MENSA_ID, TIMEZONE, POST_HOUR, POST_MIN, WEEKDAYS
- Deploy. The worker process will stay running and post at the scheduled time.
The post includes the canteen name, city, date, and each meal line with category and (if available) student price.
- No menu today: Some days return 404/empty menus; the script posts an empty/none message accordingly.
- Time zone on Windows: The project includes
tzdataso IANA time zones (like Europe/Berlin) work reliably. - Webhook errors: Ensure MATTERMOST_WEBHOOK is correct and accessible from Railway.
See LICENSE.