Eventbuzz_Concierge/README.md

61 lines
3.5 KiB
Markdown

# EventBuzz Concierge
Independent Node.js service for the EventBuzz Virtual Concierge chatbot. Uses Amazon Bedrock **tool calling** (router + synthesis). 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) for the floating widget, or [http://localhost:3010/embed/avatar](http://localhost:3010/embed/avatar) for the SIMLI avatar + chat page.
3. Set `botId` in the page script to a real `ConciergeBot` document `_id` from MongoDB. The avatar page also needs `SIMLI_API_KEY` and `SIMLI_FACE_ID` in `.env`, plus LiveKit voice.
## API
| Method | Path | Purpose |
|--------|------|---------|
| GET | `/api/public/concierge/{botId}/config` | Widget greeting / config |
| POST | `/api/public/concierge/{botId}/chat` | Send a chat turn (tool-calling agent) |
| GET | `/api/public/concierge/{botId}/session/{sessionRef}` | Resume session |
| POST | `/api/public/concierge/{botId}/voice/token` | LiveKit visitor token |
| POST | `/api/public/concierge/{botId}/simli/token` | SIMLI session token (API key stays on the server) |
| GET | `/webhook/whatsapp` | Meta webhook verification |
| POST | `/webhook/whatsapp` | Inbound WhatsApp (reception + follow-up) |
## Agent
One Bedrock model (`BEDROCK_AGENT_MODEL_ID`, defaulting to Claude Haiku 4.5) chooses EventBuzz tools, the service executes them against Mongo (identity injected from the chat session), then the same model writes the visitor-facing reply.
Default model: `global.anthropic.claude-haiku-4-5-20251001-v1:0` (global inference profile — required in `ap-south-1`). Prompt caching is on by default (`BEDROCK_PROMPT_CACHE=true`): tools, the system prompt, and the static EVENT brief are marked with `cachePoint` (1-hour TTL). Haiku 4.5 only records a cache hit after ~4096 tokens in that prefix; check `cacheReadInputTokens` / `cacheWriteInputTokens` in Bedrock logs. Claude 3 Haiku (20240307) cannot use `cachePoint`.
Tools: `get_my_tickets`, `get_my_agenda`, `email_my_ticket`, `get_agenda`, `get_speakers`, `get_exhibitors`, `get_venue`, `get_local`, `get_tech_help`, `search_faqs`, `save_session`, `remove_saved_session`, `contact_organizer`.
Personal tools and mutations require email OTP (`identity.service`). Widget, WhatsApp, and LiveKit voice all share this runner.
Set `BEDROCK_AGENT_MODEL_ID` or `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.