Skip to content

timecamp-org/good-enough-timecamp-scim-integrations

Repository files navigation

TimeCamp SCIM Integrations

Scripts to synchronize users from various HR systems with TimeCamp. Currently supports:

  • BambooHR

Setup

  1. Clone the repository
  2. Install dependencies:
pip3 install -r requirements.txt
  1. Copy .env.sample to .env and fill in your API keys:
cp .env.sample .env

System Architecture

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
Loading

Testing

Always test the integration first using these steps:

  1. Test BambooHR fetch:
# Fetch users from BambooHR and save to users.json
python bamboohr_fetch.py
  1. Review the generated users.json to ensure the data is correct. The file should match the format shown in users.json.sample:
{
  "users": [
    {
      "external_id": "123",
      "name": "John Doe",
      "email": "john.doe@example.com",
      "department": "Engineering",
      "status": "active"
    }
  ]
}
  1. Test TimeCamp sync with dry-run:
# Test sync without making any changes
python timecamp_sync.py --dry-run
  1. If the dry run looks good, run the actual sync:
python timecamp_sync.py

Crontab Setup

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 using which python3)
  • All operations are logged to logs/sync.log

Troubleshooting

  1. Check the logs:
    • For real-time output: Watch the script execution in terminal
    • For historical data: Check logs/sync.log
  2. Ensure all required environment variables are set in .env
  3. Verify API keys have the necessary permissions
  4. For crontab issues, check system logs: grep CRON /var/log/syslog

Not Yet Implemented

  • 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)

Test Cases

  • 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 ✅

License

MIT

About

Good enough TimeCamp SCIM (users & groups) integrations

Topics

Resources

Stars

Watchers

Forks

Languages