# Quick Setup

## 1. Install Python Dependencies

```bash
cd /home/tony/Work/tony/Preference_auto_job
pip install -r requirements.txt
```

## 2. Get Slack Credentials

**Webhook URL:**
1. Go to https://api.slack.com/messaging/webhooks
2. Create webhook → Select channel → Copy URL

**Bot Token (for file uploads):**
1. Go to https://api.slack.com/apps → Create app
2. OAuth & Permissions → Add scopes: `files:write`, `chat:write`
3. Install to Workspace → Copy token (starts with `xoxb-`)

**Channel ID:**
- Right-click channel in Slack → View channel details → Copy ID

## 3. Configure

Edit `config.yaml`:

```yaml
slack_webhook_url: "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
slack_bot_token: "xoxb-your-actual-token"
slack_channel: "C01234567"  # Your channel ID
```

## 4. Run Setup

```bash
cd /home/tony/Work/tony/Preference_auto_job

# Install dependencies first
pip install -r requirements.txt

# Then setup the cron job
./setup.sh
```

## 5. Test

```bash
# Full run with notebook execution
./run_hourly.sh

# Or skip notebook and test plot extraction only
./run_hourly.sh --skip-notebook
```

Check Slack for two JPEG plots!

## Done!

The notebook now runs automatically every hour and sends two preference plots to Slack. Monitor with:

```bash
tail -f logs/notebook_automation_$(date +%Y%m%d).log
```

## Command Options

- **Default**: `./run_hourly.sh` - Execute notebook and extract plots
- **Fast mode**: `./run_hourly.sh --skip-notebook` - Extract plots from last run without re-executing notebook
