Eventbuzz_Concierge/README.md

56 lines
2.4 KiB
Markdown

# EventBuzz Concierge
Independent Node.js service for the EventBuzz Virtual Concierge chatbot. Uses Amazon Bedrock for Call 1 (intent classification). Connects to the same MongoDB as the main EventBuzz backend.
## Setup
```bash
cp .env.example .env
# Set MONGODB_URI and AWS / Bedrock credentials
npm install
npm run dev
```
Server defaults to `http://localhost:3010`.
## Production deploy (same server as backend)
From the repo root (`EventBuzz_Dashboard_V4/`):
```bash
./deploy.sh concierge
# or full stack:
./deploy.sh all
```
Deploys to `/var/www/concierge` on the backend host, reloads PM2 app `concierge-api`, and syncs `public/embed` to the backend so dashboard embed snippets stay current.
First time on the server: create `/var/www/concierge/.env` (copy from `.env.example`), set `MONGODB_URI`, AWS/Bedrock, and mail vars, then run deploy. If `package.json` / lockfile changed, run `npm ci --omit=dev` on the server and deploy again.
## Embed demo
1. Start the server.
2. Open [http://localhost:3010/embed/demo](http://localhost:3010/embed/demo).
3. Set `botId` in the page script to a real `ConciergeBot` document `_id` from MongoDB.
## API
| Method | Path | Purpose |
|--------|------|---------|
| GET | `/api/public/concierge/{botId}/config` | Widget greeting / config |
| POST | `/api/public/concierge/{botId}/chat` | Send message (Call 1 classification) |
| GET | `/api/public/concierge/{botId}/session/{sessionRef}` | Resume session |
| GET | `/webhook/whatsapp` | Meta webhook verification |
| POST | `/webhook/whatsapp` | Inbound WhatsApp (reception + follow-up) |
## Pipeline
1. **Call 1** (Nova Micro) — intent + entities
2. **Call 2** (Claude 3 Haiku) — agenda replies with Sessions DB context
3. **Bookmark mutations** — `agenda_bookmark_add` / `agenda_bookmark_remove` write `SessionBookmark` records (no Call 2)
4. **Email OTP** — required for personal schedule, conflict check, and bookmark mutations; auth is stored on the web chat session
Set `BEDROCK_CALL2_MODEL_ID`, `OTP_PEPPER`, and SMTP/`MAIL_*` vars in `.env` (see `.env.example`). Without SMTP, OTP codes are logged to the server console.
Reception WhatsApp: point the Meta webhook at `GET/POST /webhook/whatsapp` on this service (verify token `META_WHATSAPP_WEBHOOK_VERIFY_TOKEN`). Configure copy and drips in the dashboard **WhatsApp Chatbots → Reception** tab. WABA credentials come from Organisation WhatsApp settings.