Scripts to synchronize users from various HR systems with TimeCamp. Currently supports:
- BambooHR
- Clone the repository
- Install dependencies:
pip3 install -r requirements.txt
- Copy
.env.sample
to.env
and fill in your API keys:
cp .env.sample .env
graph TD
BH[1: BambooHR Fetcher] -->|use| BAPI[BambooHR API]
BH -->|saves| JSON[users.json]
TC[2: TimeCamp Synchronizer] -->|uses| JSON
TC -->|use| TAPI[TimeCamp API]
style BH fill:#f9f,stroke:#333
style TC fill:#9f9,stroke:#333
Always test the integration first using these steps:
- Test BambooHR fetch:
# Fetch users from BambooHR and save to users.json
python bamboohr_fetch.py
- Review the generated
users.json
to ensure the data is correct. The file should match the format shown inusers.json.sample
:
{
"users": [
{
"external_id": "123",
"name": "John Doe",
"email": "john.doe@example.com",
"department": "Engineering",
"status": "active"
}
]
}
- Test TimeCamp sync with dry-run:
# Test sync without making any changes
python timecamp_sync.py --dry-run
- If the dry run looks good, run the actual sync:
python timecamp_sync.py
To automate the synchronization, add these entries to your crontab:
# Edit crontab
crontab -e
# Add these lines:
# Fetch users from BambooHR every hour
0 * * * * cd /path/to/project && python3 bamboohr_fetch.py
# Sync with TimeCamp 5 minutes after fetch
5 * * * * cd /path/to/project && python3 timecamp_sync.py
Notes:
- Replace
/path/to/project
with the actual path to your project - Replace
python3
with the path to your Python interpreter (find it usingwhich python3
) - All operations are logged to
logs/sync.log
- Check the logs:
- For real-time output: Watch the script execution in terminal
- For historical data: Check
logs/sync.log
- Ensure all required environment variables are set in
.env
- Verify API keys have the necessary permissions
- For crontab issues, check system logs:
grep CRON /var/log/syslog
-
User roles
-
TimeCamp groups based on supervisor, not department and division
-
Send email on invite
-
Performance
-
Setting to sync only selected things (like only new users)
-
Setting to move disabled users to specific group_id
-
Remove empty groups
-
Change of email (use external_id to identify)
- User changed name ✅
- User changed group ✅
- User added ✅
- User disabled ✅
- User removed ✅
- User added as inactive ✅
- User added with empty department ✅
- Group name with whitespaces near / ✅
- Setting enabled to add external_id to user name ✅
MIT