Bob Office 168/52 developer documentation

API-referentie, webhooks en de in te sluiten widget voor Bob β€” jullie beheerde AI-frontoffice.

πŸ” Authenticatie

POST /api/auth/login
Admin-gebruikers authenticeren en toegangstoken verkrijgen
{
  "email": "admin@office16852.com",
  "password": "your_password"
}
POST /api/customers/auth/login
Klantgebruikers authenticeren (multi-tenant)
{
  "email": "customer@business.com",
  "password": "customer_password"
}

Chat en gesprekken

Drie routes: (1) Publiek, dezelfde herkomst, anoniem. β†’ POST /api/chat (bijv. widget op marketingwebsite; geen login). (2) Cross-origin embed β†’ POST /api/widget/chat with X-Widget-Key and allowed Origin. (3) Geauthenticeerde app / Mission Control β†’ POST /api/chat/session en POST /api/chat/message (vereist chat.manage and session/CSRF for cookie auth) β€” niet for anonymous fetch van openbare pagina's.

1) Publiek anoniem (same-origin)

POST /api/chat
Unified pipeline for visitors on your own domain without signing in. Body includes message, session_id, optioneel business_id.

2) Cross-origin widget

POST /api/widget/chat
Ingesloten op klantsites. Headers: X-Widget-Key, Content-Type: application/json. Origin must be allowed for the key. See docs/REQUEST_FLOWS.md in de repository voor CORS-details.

3) Alleen geauthenticeerde sessie / admin-UI

POST /api/chat/session
Maak een sessie aan bij inloggen op Mission Control of dashboard (RBAC + CSRF voor cookies).
POST /api/chat/message
Send a message from geauthenticeerd admin/chat UI (chat.manage). Retourneert 401 if called anonymously from a public page β€” use POST /api/chat voor dat geval in plaats daarvan.
{
  "session_id": "session_123",
  "message": "Hello, I need help with my order"
}
GET /api/chat/history/:session_id
Chatgeschiedenis ophalen (geauthenticeerd)

πŸ“Š Analytics en monitoring

GET /api/analytics/overview
Overzicht van systeemanalyse ophalen
GET /api/health
Systeemstatus controleren
GET /api/metrics/business
Bedrijfsspecifieke metrics ophalen

Multi-tenant klantbeheer

GET /api/customers/dashboard/:businessId
Klantdashboardgegevens ophalen voor een specifiek bedrijf
GET /api/customers/analytics/:businessId
Bedrijfsanalyses ophalen voor een specifieke klant
GET /api/customers/integration/:businessId/status
Integratiestatus voor bedrijf controleren

🎯 UnityXpressions-pilot

GET /api/unityxpressions/dashboard
UnityXpressions pilot-dashboardgegevens
GET /api/pilot/metrics/realtime
Realtime pilot-prestaties
GET /api/pilot/feedback/recent
Recent klantenvoor pilot

πŸŽ“ Training en leren

POST /api/training/unityxpressions/analyze
Analyseer UnityXpressions-business voor training
POST /api/training/unityxpressions/quick-setup
Snelle inrichtingstraining voor UnityXpressions
GET /api/learning/health
Status van de leerengine

πŸ”Œ Widget-installatie

Voeg Bob toe aan elke website met één script-tag. Na onboarding is je widget-embedcode beschikbaar in het Customer Portal onder Widget-instellingen.

<!-- Canonical tenant-scoped bundle from Customer Portal Widget Setup (no API key in HTML). -->
<script src="https://YOUR_OFFICE_HOST/widget/YOUR_TENANT_UUID/widget.js" async></script>
GET /api/customer-portal/widget-code
Levert kant-en-klare embed-code. Klant-JWT vereist.

🎭 Persona-aanpassing

Persona’s: toon, naam, instructies. Elke tenant: standaard; aanpasbaar in Admin of API.

GET /api/personas/:tenantId
Alle persona’s voor een tenant weergeven.
POST /api/personas/:tenantId
Maak een nieuwe persona aan. Body: { name, description, tone, systemPrompt }
PUT /api/personas/:tenantId/:personaId
Werk de toon, instructies of naam van een bestaande persona bij.

πŸ’° Abonnementen en prijzen

Published pricebook is the source of truth. Use the APIs below for live numbers; this table matches pricebook-seed V1 (past zich aan wanneer je een nieuwe versie publiceert).

Functie Starter Pro (abon.) Enterprise
Catalogusprijs (USD/maand) $79 $249 $899
Inbegrepen AI-credits / maand 15,000 75,000 250,000
Teamplaatsen Tot 3 Tot 10 Onbeperkt
Standaardintegraties (inbegrepen) 1 3 10
Ondersteuning E-mail Prioriteit Toegewijd
GET /api/pricing/marketing-cards
Plankaarten voor marketing en checkout (prijzen, credits, schattingen) β€” uit gepubliceerde prijslijst. Geen auth.
GET /api/pricing/snapshot
Publiek veilige, volledige pricebook-snapshot (geen leverancierskostenvelden). Geen inlog vereist.

πŸ› οΈ Integratievoorbeelden

Gebruik het blok dat bij jouw scenario past. Kopieer het admin-voorbeeld niet naar anonieme marketing-HTML.

Publiek, zelfde origin (anoniem).

const response = await fetch('/api/chat', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    session_id: sessionId,
    message: userMessage,
    business_id: 'office16852-platform'
  })
});
const data = await response.json();

Cross-origin widget

const response = await fetch('https://office16852.com/api/widget/chat', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Widget-Key': 'pk_live_...',
    'Origin': 'https://your-customer-site.com'
  },
  body: JSON.stringify({ session_id: sessionId, message: userMessage })
});

Alleen geauthenticeerde admin (Bearer)

// JavaScript β€” requires logged-in admin / Mission Control (Bearer)
const response = await fetch('/api/chat/message', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer ' + token
  },
  body: JSON.stringify({
    session_id: sessionId,
    message: userMessage
  })
});
const data = await response.json();
// Python β€” authenticated only
import requests
response = requests.post(
    'https://office16852.com/api/chat/message',
    headers={
        'Content-Type': 'application/json',
        'Authorization': f'Bearer {token}'
    },
    json={ 'session_id': session_id, 'message': user_message }
)