# Daily uncategorized transaction alert

To get a Slack message when transactions still lack a category, count uncategorized rows and post a summary.

## The Script

```bash
#!/bin/bash
# daily-uncategorized-alert.sh

WORKSPACE_ID="<workspace-id>"
WEBHOOK_URL="https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK"
SINCE="$(date -v-30d +%Y-%m-%d 2>/dev/null || date -d '30 days ago' +%Y-%m-%d)"

rows=$(kick --workspace "$WORKSPACE_ID" transactions find \
  --since "$SINCE" \
  --fields id,date,category \
  --output json \
  | jq '[.[] | select(.category == null or .category == "")]')

count=$(echo "$rows" | jq 'length')

if [ "$count" -gt 0 ]; then
  oldest=$(echo "$rows" | jq -r 'sort_by(.date) | .[0].date')
  message="*$count uncategorized transactions in the last 30 days*\nOldest: $oldest\n<https://app.kick.co/transactions|Review in Kick>"

curl -X POST "$WEBHOOK_URL" \
    -H 'Content-Type: application/json' \
    -d "$\{"text\":\"$message\"}\""

echo "Alert sent: $count uncategorized transactions"
else
  echo "No uncategorized transactions in range"
fi
```

## How to Customize
- Change `SINCE` to match your firm's review window
- Add a threshold: only alert when `count` exceeds 10
- Schedule with cron to run each morning

## What It Outputs

```
Alert sent: 23 uncategorized transactions
```

# Find transactions missing a memo

To export transactions that still need a memo before close, filter JSON output client-side.

## The Script

```bash
#!/bin/bash
# find-missing-memos.sh

WORKSPACE_ID="<workspace-id>"
SINCE="2026-01-01"
UNTIL="2026-01-31"
OUTPUT_FILE="missing-memos.csv"

echo "date,amount,counterparty,id" > "$OUTPUT_FILE"

kick --workspace "$WORKSPACE_ID" transactions find \
  --since "$SINCE" \
  --until "$UNTIL" \
  --fields id,date,amount,counterparty,memo \
  --output json | \
jq -r '.[] | select(.memo == null or .memo == "") | [.date, .amount, .counterparty, .id] | @csv' >> "$OUTPUT_FILE"

count=$(tail -n +2 "$OUTPUT_FILE" | wc -l | tr -d ' ')

echo "Found $count transactions without a memo"
echo "Exported to $OUTPUT_FILE"
```

## How to Customize
- Also require a category: `select((.memo == null or .memo == "") or (.category == null or .category == ""))`
- Add `--limit` and page with `--cursor` when the workspace has many rows

## What It Outputs

```
Found 15 transactions without a memo
Exported to missing-memos.csv
```

# Review recent category changes

To see what changed on transactions before you adjust anything else, list recent activity filtered to category updates.

## The Script

```bash
#!/bin/bash
# review-category-activity.sh

WORKSPACE_ID="<workspace-id>"

kick --workspace "$WORKSPACE_ID" activity list \
  --resource-type transaction \
  --changed-fields categoryId \
  --limit 25 \
  --output json | jq .
```

## How to Customize
- Add `--entity-ids` when you only care about one entity
- Pipe to a file for audit records: `> category-activity-$(date +%Y%m%d).json`

## What It Outputs

- JSON activity rows showing recent transaction category changes
