Skip to content

Add CDL onboarding Slack bot (#181)#183

Merged
jeremymanning merged 9 commits intomasterfrom
feature/onboarding-bot
Mar 12, 2026
Merged

Add CDL onboarding Slack bot (#181)#183
jeremymanning merged 9 commits intomasterfrom
feature/onboarding-bot

Conversation

@jeremymanning
Copy link
Copy Markdown
Member

Summary

Implements a Slack bot for automating the CDL lab member onboarding and offboarding process.

Features

Onboarding (/cdl-onboard @user)

  • Sends welcome message to new member
  • Collects GitHub username, bio, photo, website URL
  • Validates GitHub username via API
  • Edits bio to CDL style using Claude (third person, 3-4 sentences)
  • Adds hand-drawn green border to profile photo
  • Sends GitHub organization invitation
  • Shares Google Calendar access
  • All actions require admin approval

Offboarding (/cdl-offboard)

  • Can be initiated by member or admin
  • Admin selects what access to revoke
  • Does NOT automatically remove anyone
  • Generates checklist for manual steps

Implementation Details

  • Uses Slack Bolt with Socket Mode
  • Real API integrations (no mocks)
  • 75 tests passing (models, image, GitHub, bio services)
  • Complete documentation in README

Files Added

scripts/onboarding/
├── bot.py              # Main entry point
├── config.py           # Configuration management
├── handlers/
│   ├── onboard.py      # /cdl-onboard command
│   ├── approval.py     # Admin approval workflow
│   └── offboard.py     # /cdl-offboard command
├── models/
│   └── onboarding_request.py
└── services/
    ├── github_service.py
    ├── calendar_service.py
    ├── image_service.py
    └── bio_service.py

tests/test_onboarding/
├── conftest.py
├── test_models.py
├── test_image_service.py
├── test_github_service.py
└── test_bio_service.py

Test plan

  • Run model tests (13 passed)
  • Run image service tests (19 passed)
  • Run GitHub service tests with real token (20 passed)
  • Run bio service tests with real Anthropic API (23 passed)
  • Create Slack app and test /cdl-ping command
  • Test full onboarding flow with test user
  • Test offboarding flow

Closes #181

🤖 Generated with Claude Code

jeremymanning and others added 9 commits December 7, 2025 06:17
Implements automated onboarding/offboarding workflows:

Services:
- GitHubService: Org invitations, team management, username validation
- CalendarService: Google Calendar sharing with configurable permissions
- ImageService: Hand-drawn green border processing for profile photos
- BioService: Claude API integration for bio editing to CDL style

Handlers:
- /cdl-onboard command with interactive forms
- Admin approval workflow with team selection
- /cdl-offboard command (generates checklist, doesn't auto-remove)

Tests:
- Model tests (13 passing)
- Image service tests (19 passing)
- GitHub service tests (requires API token)
- Bio service tests (requires Anthropic key)

See issue #181 for full implementation plan.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Documents setup process, usage, and architecture.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fix UTF-8 encoding in test_bio_service.py special chars test
- Fix test_github_service.py to access org property for validation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
slack-bolt doesn't have view_regex method, use app.view() with
re.compile() instead.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The file had embedded binary control characters that made it
display incorrectly. Rewrote with clean UTF-8 text.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add workflow_listener.py to listen for "Join the lab!" workflow output messages
  sent to admin, parse form data, and create interactive approval forms
- Add workflow_step.py with optional custom workflow steps for advanced integration
- Update approval.py with workflow-specific approval/reject/request-changes handlers
- Add workflow link to lab_manual.tex so new members can click to start onboarding
- Update README with Workflow Builder integration documentation

The bot now supports two onboarding methods:
1. Member-initiated via "Join the lab!" workflow (recommended)
2. Admin-initiated via /cdl-onboard @user command

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Website Integration:
- Add WebsiteService for GitHub API operations on contextlab.github.io
- Create/update PRs for people.xlsx, photos, and CV entries
- Support all role types (Grad, Undergrad, Postdoc, Lab Manager, etc.)
- Add website approval handlers with preview/edit modals

Idempotency Fixes:
- Check for existing members in people.xlsx before adding
- Check for existing CV entries before inserting
- Check alumni sheets before adding departing members

State Persistence:
- Add storage.py for JSON-based request persistence
- Requests now survive bot restarts

Startup Queue:
- Scan admin DM history on startup for missed submissions
- Track processed message timestamps
- Add "Reprocess Now" and "Dismiss" buttons for missed items

Documentation:
- Add "Onboarding and offboarding" section to lab_manual.tex

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add 5 new lab members (Theo Larson, Jason Kang, Sam Haskel, Mak Kelly, Hye-Sung Kim)
- Replace youcanbook.me with context-lab.com/scheduler
- Make weekly snippets optional (remove paid employee requirement)
- Remove LaTeX training task and self-add-to-manual instructions
- Add HTML checklist/signature page option alongside PDF
- Add cdl-slides to poster making tools
- Add 3 new IRB protocols (Decision Making, Self-Concept, CalmNight)
- Update CLAUDE.md with onboarding bot documentation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Dynamic form: conditionally show grad program fields based on role
  selection using Slack views.update (hide when not relevant)
- Fix slash command user parsing: handle raw @username text from Slack
  (not just <@U...> format) by looking up users by name
- Add openpyxl to requirements (missing dependency for website service)
- Add local running instructions to README

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jeremymanning
Copy link
Copy Markdown
Member Author

Updated PR Summary

Onboarding Bot

  • Slack Bolt app with Socket Mode (runs locally, no public URL needed)
  • Multi-step onboarding: collect info → validate GitHub → admin approval → GitHub invite, calendar sharing, bio editing, photo processing
  • Offboarding with admin-controlled access revocation checklist
  • Workflow Builder custom steps for member-initiated onboarding
  • Dynamic form: conditionally shows grad program fields based on role selection
  • Robust user lookup in slash commands (handles raw @username text)
  • 75 tests passing — all real API calls, no mocks

Lab Manual Changes

  • Added 5 new members (Theo Larson, Jason Kang, Sam Haskel, Mak Kelly, Hye-Sung Kim)
  • Replaced youcanbook.me with context-lab.com/scheduler
  • Made weekly snippets optional (removed paid employee requirement)
  • Removed LaTeX training task and self-add-to-manual instructions
  • Added HTML checklist/signature page option alongside PDF
  • Added cdl-slides to poster making tools
  • Added 3 new IRB protocols (Decision Making, Self-Concept, CalmNight)

Testing

  • ✅ 75 bot tests pass
  • ✅ Bot connects to Slack, slash commands work
  • ✅ Dynamic form conditionally shows/hides grad fields
  • ✅ Approval/rejection flow tested manually
  • ✅ LaTeX compiles, PDF verified

@jeremymanning
Copy link
Copy Markdown
Member Author

Addresses issue #183 !

@jeremymanning jeremymanning merged commit 84582ed into master Mar 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

automate the onboarding process

1 participant