A command-line interface for fetching Cobot bookings.
The CLI can be configured using configuration files in the following locations (in order of precedence):
./settings.toml(local project directory)~/.config/cobot/settings.toml(user-specific)/etc/cobot/settings.toml(system-wide)
Example configuration file:
# Default settings
space_id = "your-cobot-space-id" # Required: Your Cobot space ID
space_subdomain = "your-space-subdomain" # Required: Your space subdomain (e.g., 'co-up' for co-up.cobot.me)
api_base = "https://api.cobot.me" # Optional: API base URL
access_token = "your-cobot-access-token" # Your Cobot API access token
data_dir = "~/.local/share/cobot" # Optional: Directory for storing booking history
log_file = "logs/cobot.log" # Optional: Log file path (relative to data_dir)
# Telegram notifications (optional)
telegram_bot_token = "your-telegram-bot-token" # Your Telegram bot token
telegram_chat_id = "your-telegram-chat-id" # Your Telegram chat ID
booking_page_url = "https://members.example.com/bookings" # Optional: URL to your booking page, shown in cancellation notificationsYou can also use environment variables with the COBOT_ prefix:
export COBOT_SPACE_ID="your-cobot-space-id"
export COBOT_SPACE_SUBDOMAIN="your-space-subdomain"
export COBOT_API_BASE="https://api.cobot.me"Get bookings for the next 7 days:
cobot get-bookingsGet bookings with a specific token (overrides settings):
cobot get-bookings --token YOUR_API_TOKENGet bookings for a specific resource:
cobot get-bookings --resource RESOURCE_IDList your own upcoming bookings:
cobot my-bookingsShow weekly schedule for a resource:
cobot show-weekly-schedule RESOURCE_IDShow weekly schedule with a specific token:
cobot show-weekly-schedule --token YOUR_API_TOKEN RESOURCE_IDMonitor bookings for changes:
cobot monitor-bookingsMonitor specific resource for changes:
cobot monitor-bookings --resource RESOURCE_IDMonitor with custom time range:
cobot monitor-bookings --days 14The monitor command will save booking data, detect changes, display them in a color-coded table, and send Telegram notifications if configured.
When Telegram is configured, the monitor command sends notifications for:
- New bookings (✓)
- Cancelled bookings (❌)
- Error conditions (e.g., API failures)
Notifications include booking date/time, person name, and purpose.
Options:
--days/-d: Number of days to fetch bookings for (default: 7)--resource/-r: Filter bookings by resource ID--token: Use a specific API token (overrides settings)
Booking history is stored in JSONL format in the configured data directory (~/.local/share/cobot by default). Each resource's bookings are stored in a separate file named bookings_<resource_id>.jsonl.
The CLI logs booking changes to help track and audit changes over time. By default, logs are stored in ~/.local/share/cobot/logs/cobot.log.
Example log entries:
2024-02-11 00:03:44,123 - INFO - New booking: John Doe - Team Meeting at 2024-02-12T09:00:00Z to 2024-02-12T10:00:00Z
2024-02-11 00:03:44,124 - INFO - Cancelled booking: Jane Smith - Workshop at 2024-02-13T14:00:00Z to 2024-02-13T16:00:00Z