A Python Flask application that processes iPhone screenshots, analyzes them using Claude's Vision API, and creates tasks in Todoist with estimated time requirements.
This application provides a backend service that:
- Receives screenshot images from an iOS Shortcut
- Sends the image to Claude's Vision API for analysis
- Extracts a task title and time estimate from Claude's response
- Creates a task in Todoist with the format "XY: Task Title" where:
- X = number of hours
- Y = number of 10-minute increments (e.g., 2 = 20 minutes)
- Clone this repository to your Apache server
- Install the required Python packages:
pip install -r requirements.txt - Copy the example environment file and add your API keys:
Then edit
cp .env.example .env.envto add your Anthropic and Todoist API keys.
If you're using the existing Apache configuration on lieshout.loseyourip.com, you can use the provided installation script:
sudo chmod +x install_apache_config.sh
sudo ./install_apache_config.shThis script will:
- Create a backup of your existing Apache configuration
- Add the Screenshot to Todoist configuration to your existing VirtualHost
- Enable the required Apache modules
- Test the configuration and restart Apache
If you prefer to configure Apache manually, add the following to your Apache configuration:
# Screenshot to Todoist configuration
ProxyPass /screenshot-to-todoist http://localhost:5000
ProxyPassReverse /screenshot-to-todoist http://localhost:5000
# Add headers for proper forwarding
<Location "/screenshot-to-todoist">
ProxyPreserveHost On
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-For "%{REMOTE_ADDR}s"
# Add CORS headers if needed
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "GET, POST, OPTIONS"
Header always set Access-Control-Allow-Headers "Origin, Content-Type, Accept, Authorization"
</Location>
# Health check endpoint
<Location "/screenshot-to-todoist/health">
ProxyPass http://localhost:5000/health
ProxyPassReverse http://localhost:5000/health
ProxyPreserveHost On
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-For "%{REMOTE_ADDR}s"
</Location>Make sure to enable the required Apache modules:
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod headers
sudo systemctl restart apache2
For development:
python screenshot_to_todoist.py
For production, use Gunicorn:
gunicorn -w 4 -b 0.0.0.0:5000 screenshot_to_todoist:app
Consider setting up a systemd service to keep the application running:
[Unit]
Description=Screenshot to Todoist Service
After=network.target
[Service]
User=www-data
WorkingDirectory=/path/to/app
ExecStart=/usr/local/bin/gunicorn -w 4 -b 0.0.0.0:5000 screenshot_to_todoist:app
Restart=always
[Install]
WantedBy=multi-user.target
Follow the detailed instructions in ios_shortcut_instructions.md to set up the iOS Shortcut.
The shortcut will be configured to send screenshots to:
https://lieshout.loseyourip.com/screenshot-to-todoist/process-screenshot
A web interface is available for testing at:
https://lieshout.loseyourip.com/screenshot-to-todoist/
You can also use the provided test script to verify the API integrations:
./test.sh
Or test the APIs directly:
python test_apis.py test_image.jpg
GET /health: Health check endpointPOST /process-screenshot: Main endpoint that processes screenshots and creates Todoist tasks
Check the log file at screenshot_to_todoist.log for detailed error information.
Common issues:
- Missing or invalid API keys
- Network connectivity problems
- Image format issues
- Anthropic API compatibility issues (fixed in the code)
MIT