π€ ActionBot
AI-powered support assistant for SaaS applications. Handles action-oriented customer queries securely.Architecture
Quick Start
Prerequisites
- Node.js 18+
- Supabase account (free tier works)
- OpenAI API key
Installation
Database Setup
Generate a Test Token
Run the Server
Test the Dashboard
- Open http://localhost:3002
- Sign up with your email + password
- Complete onboarding (company name + slug)
- Youβre in! The dashboard will show once your tenant is created.
Test the Widget
- Open http://localhost:5173 in your browser
- Paste your JWT token in the form
- Click βLoad Widgetβ
- Try these test messages:
Where is my order #1234?β Track orderCancel my order #5678β Cancel orderWhere is my refund for order #9999?β Check refundTalk to a humanβ Escalation
API Endpoints
Chat API (Widget β tenant JWT auth)
| Endpoint | Method | Description |
|---|---|---|
/api/v1/chat/message | POST | Send message, get AI response |
/api/v1/chat/conversations/:id | GET | Get conversation history |
/api/v1/chat/escalate | POST | Manually request human support |
/ws | WebSocket | Real-time bidirectional messaging |
Admin API (Dashboard β Supabase auth)
| Endpoint | Method | Description |
|---|---|---|
/api/v1/admin/auth/me | GET | Current userβs tenant info |
/api/v1/admin/auth/onboard | POST | Create tenant + link admin user |
/api/v1/admin/stats | GET | Dashboard overview stats |
/api/v1/admin/conversations | GET | List conversations |
/api/v1/admin/tickets | GET | List tickets |
/api/v1/admin/intents | GET/POST | List / create intents |
/api/v1/admin/integrations | GET/POST | List / create integrations |
/api/v1/admin/analytics | GET | Aggregate metrics |
/api/v1/admin/audit | GET | Audit log |
/api/v1/admin/settings | GET/PUT | Tenant configuration |
WebSocket Connection
API Example
Project Structure
Environment Variables
API (apps/api/.env)
| Variable | Description |
|---|---|
DATABASE_URL | PostgreSQL connection string (Supabase) |
SUPABASE_URL | Supabase project URL |
SUPABASE_SERVICE_ROLE_KEY | Supabase service role key (admin auth verification) |
OPENAI_API_KEY | OpenAI API key for intent detection |
JWT_SECRET | Secret for widget JWT signing (auto-generated per tenant) |
PORT | Server port (default: 3001) |
NODE_ENV | Environment (development/production) |
Dashboard (apps/dashboard/.env.local)
| Variable | Description |
|---|---|
NEXT_PUBLIC_SUPABASE_URL | Supabase project URL (public) |
NEXT_PUBLIC_SUPABASE_ANON_KEY | Supabase anon key (public) |
Mock Data for Testing
The seed script creates a demo tenant with these test orders:| Order # | Status | Notes |
|---|---|---|
| #1234 | Shipped | Has tracking number |
| #5678 | Processing | Can be cancelled |
| #9999 | Refunded | Has refund info |