A serverless application that allows you to create Splitwise expenses using natural language through Siri shortcuts. No more manual entry and calculations in your notes app. The application uses OpenAI's GPT model to parse natural language into structured expense data.
- Create Splitwise expenses using natural language descriptions via Siri shortcuts
- Support for equal, percentage, and exact amount splits
- Intelligent friend name matching
- AWS Lambda and API Gateway integration
- Comprehensive test suite
- Python 3.9+
- AWS SAM CLI
- AWS CLI configured with appropriate credentials
- Splitwise API credentials
- OpenAI API key
sirisplitwise/
├── lambda_handler.py # Main Lambda function code
├── tests.py # Test suite
├── requirements.txt # Python dependencies
├── template.yaml # SAM template for AWS resources
├── event.json # Sample event for local testing
└── pytest.ini # Pytest configuration
- Clone the repository:
git clone https://github.com/yourusername/sirisplitwise.git
cd sirisplitwise- Create a virtual environment and install dependencies:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt- Create a
.envfile with your API credentials:
SPLITWISE_API_KEY=your_api_key
OPENAI_API_KEY=your_api_key
SPLITWISE_CONSUMER_KEY=your_consumer_key
SPLITWISE_CONSUMER_SECRET=your_consumer_secret
The project includes a comprehensive test suite that verifies expense creation functionality.
- Single-person expense test:
python tests.py --test-type single --friend1 "Friend Name"- Multi-person expense test:
python tests.py --test-type multi --friend1 "Friend1 Name" --friend2 "Friend2 Name"Test flags:
--test-type: Type of test to run (singleormulti)--friend1: Name of the first friend to test with--friend2: Name of the second friend (required for multi-person tests)
The application is deployed using AWS SAM (Serverless Application Model).
- Test the Lambda function locally:
sam local invoke FlaskSplitwiseLambda -e event.json- Start a local API Gateway:
sam local start-api- First-time deployment with guided setup:
sam deploy --guidedThis will prompt for:
- Stack name (e.g., sirisplitwise-stack)
- AWS Region
- Parameter values for API keys
- Confirmation of IAM role creation
- Deployment preferences
- Subsequent deployments:
sam deployAfter deployment, you'll receive an API Gateway endpoint URL. The endpoint accepts POST requests to /addtransaction with a JSON body:
{
"message": "Dinner with Ben for $50, split equally"
}The following environment variables are required:
SPLITWISE_API_KEY: Your Splitwise API keyOPENAI_API_KEY: Your OpenAI API keySPLITWISE_CONSUMER_KEY: Your Splitwise consumer keySPLITWISE_CONSUMER_SECRET: Your Splitwise consumer secret
These are configured in the SAM template and passed to the Lambda function.
This project is licensed under the MIT License - see the LICENSE file for details.