An AI-powered Slack bot that provides intelligent, role-based onboarding assistance for new team members joining Risidio and Lunim. The bot uses large language models (OpenAI GPT or Anthropic Claude) to deliver personalized onboarding guidance, answer frequently asked questions, and guide new joiners through their first days.
- AI-Powered Responses: Uses OpenAI GPT or Anthropic Claude to provide intelligent, context-aware answers
- Semantic Search (RAG): Search through custom Notion docs and Slack history using vector embeddings
- Role-Based Onboarding: Customized onboarding paths for different team roles (Engineering, Product, Design, Sales, etc.)
- Interactive Commands: Easy-to-use Slack slash commands for onboarding guidance
- Step-by-Step Guidance: Progressive onboarding with the
/next-stepcommand - FAQ Support: Quick answers to frequently asked questions about Risidio and Lunim
- Direct Messages: Respond to direct messages with personalized assistance
- App Mentions: Respond to mentions in channels for team-wide help
- User State Tracking: Remembers user onboarding progress
- Flexible LLM Support: Works with either OpenAI or Anthropic APIs (or both)
- Node.js 18+ and npm 9+
- Slack Workspace with admin access to create/manage apps
- API Keys for at least one LLM provider:
- OpenAI API key (for GPT models) - get at https://platform.openai.com/api-keys
- Anthropic API key (for Claude models) - get at https://console.anthropic.com/
git clone <repository-url>
cd lunim-onboarding-agent
npm install- Go to https://api.slack.com/apps
- Click "Create New App" > "From scratch"
- Name: "Risidio Onboarding Buddy"
- Select your workspace
- Go to "OAuth & Permissions" in the left sidebar
- Under "Scopes", add these bot token scopes:
app_mentions:readchat:writecommandsim:historyim:readim:writeusers:read
- Click "Install to Workspace"
- Copy the Bot User OAuth Token (starts with
xoxb-)
-
Copy the example environment file:
cp .env.example .env
-
Edit
.envand add your credentials:SLACK_BOT_TOKEN=xoxb-your-token-here SLACK_SIGNING_SECRET=your-signing-secret OPENAI_API_KEY=sk-proj-your-key-here PORT=3000 NODE_ENV=development
- In your Slack app settings, go to "Basic Information"
- Scroll to "App Credentials" and copy the Signing Secret
- Paste it into your
.envfile asSLACK_SIGNING_SECRET
- In your Slack app, go to "Event Subscriptions"
- Enable "Events"
- Set the Request URL to:
https://your-domain.com/slack/events(for production) - Subscribe to these bot events:
app_mentionmessage.im
- Save changes
- In your Slack app, go to "Slash Commands"
- Click "Create New Command"
- Create
/onboard:- Command:
/onboard - Request URL:
https://your-domain.com/slack/commands(for production) - Short Description: "Start your onboarding journey"
- Usage Hint:
[role]
- Command:
- Create
/next-step:- Command:
/next-step - Request URL:
https://your-domain.com/slack/commands(for production) - Short Description: "Get your next onboarding step"
- Usage Hint:
[topic]
- Command:
- In your Slack app, go to "Interactivity & Shortcuts"
- Enable "Interactivity"
- Set Request URL to:
https://your-domain.com/slack/interactivity(for production)
-
SLACK_BOT_TOKEN: Your Slack bot's OAuth token (starts with
xoxb-)- Get from Slack app > OAuth & Permissions > Bot User OAuth Token
-
SLACK_SIGNING_SECRET: Secret for verifying Slack requests
- Get from Slack app > Basic Information > App Credentials > Signing Secret
-
OPENAI_API_KEY: (Optional) OpenAI API key for GPT models
- Get from https://platform.openai.com/api-keys
- Only set if using OpenAI
-
ANTHROPIC_API_KEY: (Optional) Anthropic API key for Claude models
- Get from https://console.anthropic.com/
- Only set if using Anthropic
-
PORT: Server port (default: 3000)
-
NODE_ENV: Environment mode (development or production, default: development)
Start the development server with hot reload:
npm run devThis runs the bot with nodemon, which automatically restarts on file changes.
-
Build the TypeScript code:
npm run build
-
Start the production server:
npm start
Check for TypeScript errors without building:
npm run type-checkInitiates the onboarding process for a new team member.
Usage:
/onboard engineering
/onboard product
/onboard design
/onboard sales
What it does:
- Greets the new team member
- Presents a role selection menu if no role is specified
- Provides role-specific onboarding content
- Sets up user state for progress tracking
Gets the next recommended onboarding step.
Usage:
/next-step
/next-step setup
/next-step documentation
What it does:
- Shows the next recommended onboarding task
- Provides specific guidance for that step
- Tracks progress through onboarding checklist
- Offers links to relevant resources
The bot includes a Retrieval Augmented Generation (RAG) system that enables semantic search through your company's custom documentation.
-
Create your knowledge base file:
cp knowledge-base.example.json knowledge-base.json
-
Add your content (Notion docs, Slack history, etc.) to
knowledge-base.json -
Ingest documents:
npm run ingest knowledge-base.json
-
Test it out! Ask the bot questions about your custom content
- Documents are split into chunks and converted to vector embeddings
- When users ask questions, the bot searches for semantically similar content
- The agent automatically decides when to use standard FAQs vs. custom knowledge base
- Works with any text content: Notion docs, Slack messages, wikis, etc.
# Ingest documents
npm run ingest knowledge-base.json
# View stats
npm run ingest --stats
# Clear vector store
npm run ingest --clearFor detailed setup instructions, see:
- RAG-SETUP-GUIDE.md - Complete usage guide
- RAG-SETUP-COMPLETE.md - Quick reference
Embeddings cost ~$0.0001 per 1,000 tokens. A typical 50-page knowledge base costs $0.20-$0.50 one-time.
lunim-onboarding-agent/
βββ src/
β βββ index.ts # Main Slack app initialization and event handlers
β βββ config/
β β βββ env.ts # Environment variable validation and configuration
β βββ slack/
β β βββ commands/
β β β βββ onboard.ts # /onboard command handler
β β β βββ nextStep.ts # /next-step command handler
β β βββ events/
β β βββ appMention.ts # @mention event handler
β β βββ message.ts # Direct message event handler
β βββ agent/
β β βββ handleAgentMessage.ts # LLM message processing
β β βββ systemPrompt.ts # System prompts for LLM
β β βββ tools.ts # LLM tool definitions (includes RAG search)
β βββ state/
β β βββ userState.ts # User progress and state tracking
β βββ data/
β β βββ checklists.ts # Onboarding checklists by role
β β βββ faqs.ts # FAQ database
β β βββ missionAndValues.ts # Company mission and values
β β βββ faq.ts # Legacy FAQ file
β βββ utils/
β β βββ llmClient.ts # LLM API client (OpenAI/Anthropic)
β β βββ embeddings.ts # OpenAI embeddings client
β β βββ vectorStore.ts # Vector database for RAG
β βββ scripts/
β βββ ingestDocuments.ts # Document ingestion script
βββ data/ # Generated by ingestion (gitignored)
β βββ vector-store.json # Vector embeddings database
βββ knowledge-base.json # Your custom documentation (gitignored)
βββ knowledge-base.example.json # Example template for knowledge base
βββ RAG-SETUP-GUIDE.md # RAG system usage guide
βββ RAG-SETUP-COMPLETE.md # RAG setup summary
βββ .env # Environment variables (local, not in git)
βββ .env.example # Example environment variables (for documentation)
βββ package.json # Project dependencies and scripts
βββ tsconfig.json # TypeScript configuration
βββ README.md # This file
- Make Changes: Edit TypeScript files in
src/ - Auto Reload:
npm run devautomatically restarts the bot - Type Safety: TypeScript ensures type correctness
- Build:
npm run buildcompiles TypeScript to JavaScript indist/ - Deploy: Run
npm startin production to serve the compiled code
| Component | Setting | Notes |
|---|---|---|
| Token | Bot User OAuth Token | Starts with xoxb- |
| Secret | Signing Secret | Under Basic Information |
| Scopes | app_mentions:read, chat:write, commands, im:*, users:read |
Required for functionality |
| Events | app_mention, message.im |
For responding to mentions and DMs |
| Commands | /onboard, /next-step |
Slash command endpoints |
| URL Base | https://your-domain.com |
Replace with actual domain |
- Check that the bot is running:
npm run devornpm start - Verify
SLACK_BOT_TOKENandSLACK_SIGNING_SECRETare correct - Check Slack app permissions (ensure all required scopes are granted)
- Look for error messages in console output
- Ensure at least one API key is set (
OPENAI_API_KEYorANTHROPIC_API_KEY) - Check that API keys are valid and have appropriate permissions
- Verify API quotas/limits haven't been exceeded
- Check network connectivity to API endpoints
- Change the
PORTenvironment variable to an available port - Or kill the process using the current port
- Run
npm run type-checkto identify issues - Ensure TypeScript version matches
tsconfig.jsonsettings - Check that all dependencies have type definitions
- Follow the existing code style
- Ensure TypeScript type safety (
npm run type-check) - Test changes with
npm run dev - Build before committing (
npm run build)
ISC
For issues or questions about setting up the bot, check:
- Slack API documentation: https://api.slack.com/
- TypeScript documentation: https://www.typescriptlang.org/
- Slack Bolt documentation: https://slack.dev/bolt-js/
- OpenAI API docs: https://platform.openai.com/docs/
- Anthropic API docs: https://docs.anthropic.com/