Demo App
A working TypeScript demo that exercises all API flows.
A complete TypeScript demo application is included in the repository at docs/demo/headless-chat-demo/.
Setup
Run
What It Does
Flow 1: New Conversation
- Lists all agents
- Creates a new session
- Sends a question
- Receives the AI response
- Shows follow-up suggestions
Flow 2: Resume Conversation
- Lists existing sessions for the agent
- Loads the most recent session with message history
- Displays previous messages
- Sends a follow-up question
- Receives the AI response
Environment Variables
| Variable | Required | Description |
|---|---|---|
API_KEY | Yes | Your organisation API key |
API_BASE_URL | No | API base URL (defaults to http://localhost:3002) |
AGENT_ID | No | Specific agent ID (defaults to first agent found) |
Source Code
The demo is structured as:
src/api-client.ts— Reusable API client classsrc/flow1-new-conversation.ts— New conversation flowsrc/flow2-resume-conversation.ts— Resume conversation flowsrc/index.ts— Runs both flows
You can use the ApiClient class as a starting point for your own integration.