Developer Documentation

Integrate Theazo in minutes

One SDK. Three lines of code. Voice and Chat persona intelligence embedded in your product.

Quick Start

Get Theazo running in your app in under a minute.

1. Install the SDK:

npm install @theazo/sdk

2. Add the component to your app:

App.tsx
import { Theazo } from '@theazo/sdk'

export default function App() {
  return (
    <div>
      <h1>My App</h1>
      <Theazo appId="your-app-id" />
    </div>
  )
}

That is it. Three lines. Theazo handles the UI, the AI, the persona extraction, and the behavioral tracking. Users see a chat widget. You see a growing library of persona intelligence in your dashboard.

You will need an appId from your Theazo dashboard. Sign up at theazo.com/login to get one.

Configuration

The Theazo component accepts the following props for customization.

App.tsx
<Theazo
  appId="your-app-id"
  mode="chat"              // 'chat' | 'voice' | 'both'
  theme="dark"             // 'dark' | 'light' | 'auto'
  position="bottom-right"  // 'bottom-right' | 'bottom-left' | 'inline'
  primaryColor="#6366F1"   // Custom brand color
  onPersonaUpdate={(persona) => {
    console.log('Persona updated:', persona)
  }}
  onConversation={(msg) => {
    console.log('New message:', msg)
  }}
  onSignalCaptured={(signal) => {
    console.log('Signal:', signal)
  }}
/>

Props reference

appId
string
required

Your Theazo application ID from the dashboard.

mode
'chat' | 'voice' | 'both'

Which interface to render. Defaults to 'chat'. Voice requires Grow plan or above.

theme
'dark' | 'light' | 'auto'

Widget color scheme. 'auto' follows the user's system preference.

position
'bottom-right' | 'bottom-left' | 'inline'

Where to render the widget. 'inline' places it in the DOM flow instead of as an overlay.

primaryColor
string

Hex color for the widget accent. Defaults to Theazo indigo (#6366F1).

onPersonaUpdate
(persona: Persona) => void

Callback fired whenever the user's persona is recalculated.

onConversation
(message: Message) => void

Callback fired on each new message in the conversation.

onSignalCaptured
(signal: BehavioralSignal) => void

Callback fired when a behavioral signal is captured (hover, click, scroll, etc.).

SDK Reference

The SDK exposes methods for programmatic control of chat and voice interfaces.

Chat SDK

Control the chat interface programmatically. All methods are available on the Theazo instance returned by useTheazo().

chat-example.tsx
import { useTheazo } from '@theazo/sdk'

function MyComponent() {
  const theazo = useTheazo()

  // Start a new chat session
  await theazo.chat.start()

  // Send a message programmatically
  await theazo.chat.sendMessage('Looking for a birthday gift')

  // Get current conversation
  const conversation = theazo.chat.getConversation()

  // End the session (persona is saved)
  await theazo.chat.end()
}
chat.start()Promise<void>Initializes a new chat session. Creates a conversation record.
chat.sendMessage(text)Promise<Message>Sends a user message and returns the AI response.
chat.getConversation()ConversationReturns the current conversation object with all messages.
chat.end()Promise<void>Ends the session. Triggers final persona synthesis.

Voice SDK

Real-time voice interface powered by Deepgram (speech-to-text) and ElevenLabs (text-to-speech). Requires Grow plan or above.

voice-example.tsx
import { useTheazo } from '@theazo/sdk'

function VoiceControl() {
  const theazo = useTheazo()

  // Start listening (opens microphone)
  await theazo.voice.startListening()

  // Stop listening (processes final utterance)
  await theazo.voice.stopListening()

  // Speak a response (text-to-speech)
  await theazo.voice.speak('How can I help you today?')

  // Check if currently listening
  const isListening = theazo.voice.isListening()
}
voice.startListening()Promise<void>Opens the microphone and begins real-time transcription via Deepgram.
voice.stopListening()Promise<string>Stops listening and returns the final transcribed text.
voice.speak(text)Promise<void>Converts text to speech via ElevenLabs and plays the audio.
voice.isListening()booleanReturns whether the microphone is currently active.

Events

Subscribe to real-time events from the SDK.

events-example.tsx
import { useTheazo } from '@theazo/sdk'

function EventListeners() {
  const theazo = useTheazo()

  useEffect(() => {
    const unsub1 = theazo.on('message', (msg: Message) => {
      console.log('New message:', msg.role, msg.content)
    })

    const unsub2 = theazo.on('persona.updated', (persona: Persona) => {
      console.log('Persona:', persona.archetype, persona.confidence)
    })

    const unsub3 = theazo.on('signal.captured', (signal: BehavioralSignal) => {
      console.log('Signal:', signal.type, signal.element, signal.strength)
    })

    const unsub4 = theazo.on('error', (error: TheazoError) => {
      console.error('SDK Error:', error.code, error.message)
    })

    return () => {
      unsub1()
      unsub2()
      unsub3()
      unsub4()
    }
  }, [theazo])
}
messageMessageFired on every new message (user or AI).
persona.updatedPersonaFired when the persona engine recalculates the user's profile.
signal.capturedBehavioralSignalFired when a behavioral signal is captured (hover, click, scroll, viewport time).
errorTheazoErrorFired on SDK errors (network, auth, rate limit).

API Reference

REST API for server-side access to personas, conversations, and insights. All endpoints require authentication via the X-Theazo-Key header.

Base URL: https://api.theazo.com/v1

Personas

GET/api/v1/personas

List all personas for your application. Supports pagination and filtering by archetype, confidence threshold, or date range.

Parameters

limitnumberMax results to return (default 50, max 200)
offsetnumberPagination offset
min_confidencenumberFilter by minimum confidence (0-100)
archetypestringFilter by archetype name

Response

{ data: Persona[], total: number, hasMore: boolean }

Example

curl -X GET https://api.theazo.com/v1/personas \
  -H "X-Theazo-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"limit": 20, "min_confidence": 60}'
GET/api/v1/personas/:id

Get a single persona by ID. Returns the full persona object including SAID, DID, INFERRED sections, predictions, and conversation history.

Response

Persona

Example

curl -X GET https://api.theazo.com/v1/personas/usr_abc123 \
  -H "X-Theazo-Key: your-api-key"

Conversations

GET/api/v1/conversations

List all conversations. Filter by channel, sentiment, date range, or user ID.

Parameters

channelstringFilter by 'voice' or 'chat'
sentimentstringFilter by 'positive', 'neutral', or 'negative'
user_idstringFilter by specific user
limitnumberMax results (default 50)

Response

{ data: Conversation[], total: number, hasMore: boolean }

Example

curl -X GET "https://api.theazo.com/v1/conversations?channel=voice&sentiment=positive" \
  -H "X-Theazo-Key: your-api-key"
GET/api/v1/conversations/:id

Get a conversation by ID. Returns the full transcript, extracted insights, sentiment analysis, and linked persona data.

Response

Conversation

Example

curl -X GET https://api.theazo.com/v1/conversations/conv_xyz789 \
  -H "X-Theazo-Key: your-api-key"

Insights

GET/api/v1/insights

Get aggregated insights across your user base. Returns theme trends, sentiment analysis, frustration alerts, and feature requests.

Parameters

periodstringTime period: 'today', 'week', 'month', 'all'

Response

InsightsReport

Example

curl -X GET "https://api.theazo.com/v1/insights?period=week" \
  -H "X-Theazo-Key: your-api-key"

Ask

POST/api/v1/ask

Ask a natural language question about your customer base. Returns structured findings with evidence.

Parameters

questionstring
required
The question to ask about your users
streambooleanEnable streaming response (default false)

Response

{ findings: Finding[], recommendation: string }

Example

curl -X POST https://api.theazo.com/v1/ask \
  -H "X-Theazo-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"question": "What do churned customers have in common?"}'

Webhooks

Receive real-time notifications when events occur in your Theazo application. Configure webhook endpoints in your dashboard under Settings > Webhooks.

persona.updated

Fired when a user's persona is recalculated after new data.

conversation.completed

Fired when a conversation session ends.

signal.captured

Fired when a high-confidence behavioral signal is captured.

insight.generated

Fired when a new aggregated insight is generated from accumulated data.

Example webhook payload for persona.updated:

webhook-payload.json
{
  "event": "persona.updated",
  "timestamp": "2026-02-09T14:23:00Z",
  "data": {
    "userId": "usr_abc123",
    "appId": "app_xyz789",
    "persona": {
      "archetype": "The Understated Creative",
      "confidence": 72,
      "said": [
        { "category": "style", "items": [{ "name": "minimalist", "score": 0.9 }] }
      ],
      "did": [
        { "type": "hover", "element": "Leather Jacket", "duration": 12400 }
      ],
      "aversions": [
        { "signal": "bright colors", "strength": -0.7, "type": "rejected" }
      ],
      "predictions": {
        "purchaseLikelihood": 0.78,
        "ltv": "$340-$520",
        "churnRisk": 0.12
      }
    }
  }
}

Webhook requests include an X-Theazo-Signature header for payload verification. Verify this signature using your webhook secret to ensure requests originate from Theazo.

Data Models

TypeScript interfaces for all data structures returned by the API and SDK.

types/persona.ts
interface Persona {
  id: string
  userId: string
  appId: string
  archetype: string
  description: string
  confidence: number                    // 0-100
  said: {
    category: string
    items: { name: string; score: number }[]
  }[]
  did: {
    type: 'hover' | 'click' | 'scroll' | 'viewport'
    element: string
    duration?: number                   // milliseconds
    timestamp: number
  }[]
  aversions: {
    signal: string
    strength: number                    // -0.3 to -1.0
    type: 'mild' | 'rejected' | 'permanent' | 'mismatch'
    source: 'behavior' | 'chat' | 'voice'
  }[]
  predictions: {
    purchaseLikelihood: number          // 0-1
    ltv: string
    churnRisk: number                   // 0-1
    priceTrigger: string
    bestChannel: 'chat' | 'voice' | 'email'
  }
  traits: string[]
  approach: string
  createdAt: string
  updatedAt: string
}
types/conversation.ts
interface Conversation {
  id: string
  userId: string
  appId: string
  channel: 'chat' | 'voice'
  sentiment: 'positive' | 'neutral' | 'negative'
  sentimentScore: number                // -1 to 1
  messages: Message[]
  insights: ConversationInsight[]
  duration: number                      // seconds
  createdAt: string
  completedAt: string | null
}

interface Message {
  id: string
  role: 'user' | 'assistant'
  content: string
  timestamp: string
  metadata?: {
    voiceTranscription?: boolean
    confidence?: number
  }
}
types/signals.ts
interface BehavioralSignal {
  id: string
  userId: string
  sessionId: string
  type: 'hover' | 'click' | 'scroll' | 'viewport' | 'scroll_past'
  element: string
  duration?: number
  strength: number                      // -1.0 to 1.0
  category: string
  timestamp: string
}

interface Insight {
  id: string
  appId: string
  type: 'theme' | 'frustration' | 'feature_request' | 'correlation'
  title: string
  description: string
  mentions: number
  sentiment: number
  trend: 'up' | 'down' | 'stable'
  evidence: string[]
  createdAt: string
}

Authentication

Theazo uses two types of credentials:

App ID (client-side)

Used in the SDK component. Safe to expose in client-side code. Identifies your application but does not grant API access.

<Theazo appId="app_live_abc123def456" />

API Key (server-side)

Used for REST API access. Must be kept secret. Include in the X-Theazo-Key header.

curl -H "X-Theazo-Key: sk_live_your_secret_key" \
  https://api.theazo.com/v1/personas

Never expose your API key in client-side code, public repositories, or browser network requests. Use environment variables and server-side routes to make API calls.

Framework Guides

Theazo works with any JavaScript framework. Here are integration examples for the most common ones.

React

First-class support. The SDK is built with React and exports native hooks and components.

react-app.tsx
import { Theazo, useTheazo } from '@theazo/sdk'

function App() {
  return (
    <Theazo appId="your-app-id" mode="both" theme="dark">
      <MyStore />
    </Theazo>
  )
}

function MyStore() {
  const theazo = useTheazo()

  useEffect(() => {
    const unsub = theazo.on('persona.updated', (persona) => {
      // Use persona data to personalize the UI
      updateRecommendations(persona.predictions)
    })
    return unsub
  }, [theazo])

  return <ProductGrid />
}

Vue

Use the web component wrapper for Vue applications.

App.vue
<template>
  <div>
    <theazo-widget
      app-id="your-app-id"
      mode="chat"
      theme="dark"
      @persona-update="onPersonaUpdate"
    />
  </div>
</template>

<script setup lang="ts">
import '@theazo/sdk/web-component'

function onPersonaUpdate(event: CustomEvent) {
  const persona = event.detail
  console.log('Persona:', persona.archetype)
}
</script>

Angular

Register the web component with Angular's custom element schema.

app.module.ts
// app.module.ts
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'
import '@theazo/sdk/web-component'

@NgModule({
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  // ...
})
export class AppModule {}

// app.component.html
<theazo-widget
  app-id="your-app-id"
  mode="chat"
  theme="dark"
  (persona-update)="onPersonaUpdate($event)"
></theazo-widget>

Flutter

Use the Flutter plugin for native mobile integration.

main.dart
// pubspec.yaml
dependencies:
  theazo_sdk: ^1.0.0

// main.dart
import 'package:theazo_sdk/theazo_sdk.dart';

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late TheazoClient _theazo;

  @override
  void initState() {
    super.initState();
    _theazo = TheazoClient(appId: 'your-app-id', mode: TheazoMode.chat);
    _theazo.onPersonaUpdate.listen((persona) {
      print('Archetype: ${persona.archetype}');
    });
  }

  @override
  Widget build(BuildContext context) {
    return TheazoWidget(client: _theazo);
  }
}

Ready to start building?

Create a free account and start capturing persona intelligence in minutes.