Setup Guide - Yappa Knowledge Hub (TypeScript)
Complete setup instructions from zero to running TypeScript-powered POC in under 10 minutes.
Prerequisites
Before starting, ensure you have:
- Node.js >= 18.0.0 (Download)
- PHP >= 8.2 (Download)
- Composer (Download)
- Slack workspace with admin permissions
- Terminal/Command line access
Part 1: Local Setup (5 minutes)
Step 1: Clone and Install Dependencies
# Navigate to project directory
cd /home/ubuntu/yappa-knowledge-hub
# Install Node.js dependencies (includes TypeScript)
npm install
# Install PHP dependencies
cd backend
composer install
cd ..Step 2: Configure Environment
# Copy example environment file
cp .env.example .env
# The .env file will look like this (you'll fill in Slack tokens in Part 2):# Slack Configuration (fill these in after Part 2)
SLACK_BOT_TOKEN=xoxb-your-bot-token-here
SLACK_SIGNING_SECRET=your-signing-secret-here
SLACK_APP_TOKEN=xapp-your-app-token-here
# Server Configuration
PORT=3000
API_PORT=3001
# Backend API Configuration
DATABASE_API_URL=http://127.0.0.1:8000
# OpenAI Configuration (mock mode for POC)
OPENAI_API_KEY=mock-key
OPENAI_MODEL=gpt-4
OPENAI_MOCK=trueStep 3: Build TypeScript
# Compile TypeScript to JavaScript
npm run build
# This creates the dist/ directory with compiled .js filesStep 4: Initialize Database
cd backend
# Create database and run migrations
php bin/console doctrine:database:create
php bin/console doctrine:migrations:migrate --no-interaction
# Seed demo data (20 realistic Dutch knowledge items)
php bin/console app:seed-poc-data
cd ..Part 2: Slack App Setup (5 minutes)
Step 1: Create Slack App
- Go to https://api.slack.com/apps
- Click "Create New App"
- Select "From an app manifest"
- Choose your workspace
- Select "YAML" tab
- Copy the entire contents of
slack-app-manifest.yamlfrom this repository - Paste into the YAML editor
- Click "Next"
- Review the configuration
- Click "Create"
Step 2: Enable Socket Mode
Socket Mode allows the bot to receive events without exposing a public URL (perfect for development).
- In your app settings, click "Socket Mode" in the left sidebar
- Toggle "Enable Socket Mode" to ON
- Click "Generate" to create an app-level token
- Name it "Socket Mode Token"
- Add the
connections:writescope - Click "Generate"
- Copy the token (starts with
xapp-) - Save it in your
.envfile asSLACK_APP_TOKEN
Step 3: Install App to Workspace
- In the left sidebar, click "Install App"
- Click "Install to Workspace"
- Review the permissions
- Click "Allow"
- Copy the "Bot User OAuth Token" (starts with
xoxb-) - Save it in your
.envfile asSLACK_BOT_TOKEN
Step 4: Get Signing Secret
- In the left sidebar, click "Basic Information"
- Scroll down to "App Credentials"
- Copy the "Signing Secret"
- Save it in your
.envfile asSLACK_SIGNING_SECRET
Step 5: Verify Environment Variables
Your .env file should now look like this:
SLACK_BOT_TOKEN=xoxb-1234567890-1234567890123-abcdefghijklmnopqrstuvwx
SLACK_SIGNING_SECRET=a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
SLACK_APP_TOKEN=xapp-1-A01234567-1234567890123-abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnop
PORT=3000
API_BASE_URL=http://localhost:8000
OPENAI_API_KEY=mock-key
OPENAI_MODEL=gpt-4
OPENAI_MOCK=truePart 3: Start Services
Terminal 1: Start Symfony Backend
cd /home/ubuntu/yappa-knowledge-hub/backend
symfony server:start
# Or if you don't have Symfony CLI:
php -S localhost:8000 -t publicYou should see:
[OK] Web server listening on http://127.0.0.1:8000Terminal 2: Start TypeScript Bot
cd /home/ubuntu/yappa-knowledge-hub
# Build TypeScript (if not already built)
npm run build
# Start the bot
npm start
# Or use development mode with hot reload
npm run devYou should see:
[View Tracker] Periodic cleanup started
[INFO] socket-mode:SocketModeClient:0 Going to establish a new connection to Slack ...
[Yappa Kennishub] Bot is actief op poort 3000
[Yappa Kennishub] Socket Mode: ingeschakeld
[Yappa Kennishub] Handlers:
- /knowledge commando
- Message shortcuts: save_to_knowledge, add_to_hub
- Global shortcut: quick_add_knowledge
- Events: message, app_home_opened, file_shared
- View submissions & action handlers
[Yappa Kennishub] API server actief op poort 3001
- POST /api/slack/refresh-homes - Refresh all home pages
- POST /api/slack/refresh-home - Refresh specific user home
- GET /health - Health check
[INFO] socket-mode:SocketModeClient:0 Now connected to SlackPart 4: Verify Setup
Test 1: API is Running
curl http://127.0.0.1:8000/api/categoriesExpected: JSON response with categories
Test 2: Bot Health Check
curl http://localhost:3001/healthExpected: {"status":"ok","service":"yappa-knowledge-hub"}
Test 3: Bot is Connected
In Slack:
/knowledgeExpected: Dashboard modal opens
Test 4: View Demo Data
In Slack:
/knowledgeExpected: Dashboard modal opens with knowledge items
Test 5: Generate Digest
In Slack:
Click "Digest" button in dashboardExpected: Modal opens with target group and filter options
Troubleshooting
Bot Not Responding
Problem: /knowledge command does nothing
Solutions:
- Check bot is running:
ps aux | grep "node src/app.js" - Check logs:
tail -f /tmp/slack-bot.log - Verify
SLACK_APP_TOKENstarts withxapp- - Verify Socket Mode is enabled in Slack app settings
- Restart bot:
./start-bot.sh
API Errors
Problem: Bot says "API error" or "Failed to fetch"
Solutions:
- Check Symfony is running:
curl http://localhost:8000/api/categories - Check logs:
tail -f backend/var/log/dev.log - Verify
API_BASE_URL=http://localhost:8000in.env - Restart Symfony:
cd backend && symfony server:start
Database Errors
Problem: "Table not found" or "Database does not exist"
Solutions:
cd backend
php bin/console doctrine:database:drop --force
php bin/console doctrine:database:create
php bin/console doctrine:migrations:migrate --no-interaction
php bin/console app:seed-poc-dataPermission Errors
Problem: "Missing scope" or "Not authorized"
Solutions:
- Go to https://api.slack.com/apps
- Select your app
- Go to "OAuth & Permissions"
- Verify all required scopes are present (see
slack-app-manifest.yaml) - Click "Reinstall App"
- Update
SLACK_BOT_TOKENin.envif it changed
Socket Mode Connection Issues
Problem: Bot starts but doesn't respond to events
Solutions:
- Verify
SLACK_APP_TOKENis correct - Check token has
connections:writescope - Ensure no firewall is blocking WebSocket connections
- Try regenerating the app-level token
Next Steps
Now that setup is complete:
- Read the POC Documentation: /poc-guide
- Try the Demo Workflow: Test all 7 input methods
- Generate a Digest:
/knowledge digest - Explore the API: http://localhost:8000/api
- Provide Feedback: Document what works and what doesn't
Quick Reference
Start Services:
# Terminal 1
cd backend && symfony server:start
# Terminal 2
./start-bot.shStop Services:
# Stop bot: Ctrl+C in Terminal 2
# Stop Symfony: Ctrl+C in Terminal 1Reset Database:
cd backend
php bin/console doctrine:database:drop --force
php bin/console doctrine:database:create
php bin/console doctrine:migrations:migrate --no-interaction
php bin/console app:seed-poc-dataView Logs:
# Bot logs
tail -f /tmp/slack-bot.log
# Symfony logs
tail -f backend/var/log/dev.logTest Commands:
# In Slack
/knowledge help
/knowledge
/knowledge add
/knowledge search <query>
/knowledge digestAdditional Resources
- POC Documentation - Complete POC guide
- Slack App Setup Details - Advanced Slack configuration
- Testing Guide - How to run tests
- API Documentation - API Platform docs (when running)
Setup complete! You're ready to test the POC.