EK Hub API

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

cd docs/demo/headless-chat-demo
npm install

Run

Run all flows
API_KEY=api_your_key npm start
Run individual flows
API_KEY=api_your_key npm run flow1   # New conversation
API_KEY=api_your_key npm run flow2   # Resume conversation

What It Does

Flow 1: New Conversation

  1. Lists all agents
  2. Creates a new session
  3. Sends a question
  4. Receives the AI response
  5. Shows follow-up suggestions

Flow 2: Resume Conversation

  1. Lists existing sessions for the agent
  2. Loads the most recent session with message history
  3. Displays previous messages
  4. Sends a follow-up question
  5. Receives the AI response

Environment Variables

VariableRequiredDescription
API_KEYYesYour organisation API key
API_BASE_URLNoAPI base URL (defaults to http://localhost:3002)
AGENT_IDNoSpecific agent ID (defaults to first agent found)

Source Code

The demo is structured as:

  • src/api-client.ts — Reusable API client class
  • src/flow1-new-conversation.ts — New conversation flow
  • src/flow2-resume-conversation.ts — Resume conversation flow
  • src/index.ts — Runs both flows

You can use the ApiClient class as a starting point for your own integration.

On this page