Bob Office 168/52 developer documentation

API reference, webhooks, and the embeddable widget for Bobโ€”your governed AI front office.

๐Ÿ” Authentication

POST /api/auth/login
Authenticate admin users and obtain access token
{
  "email": "admin@office16852.com",
  "password": "your_password"
}
POST /api/customers/auth/login
Authenticate customer users (multi-tenant)
{
  "email": "customer@business.com",
  "password": "customer_password"
}

๐Ÿ’ฌ Chat & Conversations

Three paths: (1) Public same-origin anonymous โ†’ POST /api/chat (e.g. marketing site widget; no login). (2) Cross-origin embed โ†’ POST /api/widget/chat with X-Widget-Key and allowed Origin. (3) Authenticated app / Mission Control โ†’ POST /api/chat/session and POST /api/chat/message (requires chat.manage and session/CSRF for cookie auth) โ€” not for anonymous fetch from public pages.

1) Public anonymous (same-origin)

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

2) Cross-origin widget

POST /api/widget/chat
Embeds on customer sites. Headers: X-Widget-Key, Content-Type: application/json. Origin must be allowed for the key. See docs/REQUEST_FLOWS.md in the repository for CORS details.

3) Authenticated session / admin UI only

POST /api/chat/session
Create session when logged into Mission Control or dashboard (RBAC + CSRF for cookies).
POST /api/chat/message
Send a message from authenticated admin/chat UI (chat.manage). Returns 401 if called anonymously from a public page โ€” use POST /api/chat for that case instead.
{
  "session_id": "session_123",
  "message": "Hello, I need help with my order"
}
GET /api/chat/history/:session_id
Retrieve chat conversation history (authenticated)

๐Ÿ“Š Analytics & Monitoring

GET /api/analytics/overview
Get system analytics overview
GET /api/health
Check system health status
GET /api/metrics/business
Get business-specific metrics

๐Ÿข Multi-Tenant Customer Management

GET /api/customers/dashboard/:businessId
Get customer dashboard data for specific business
GET /api/customers/analytics/:businessId
Get business analytics for specific customer
GET /api/customers/integration/:businessId/status
Check integration status for business

๐ŸŽฏ UnityXpressions Pilot

GET /api/unityxpressions/dashboard
UnityXpressions pilot dashboard data
GET /api/pilot/metrics/realtime
Real-time pilot performance metrics
GET /api/pilot/feedback/recent
Recent customer feedback from pilot

๐ŸŽ“ Training & Learning

POST /api/training/unityxpressions/analyze
Analyze UnityXpressions business for training
POST /api/training/unityxpressions/quick-setup
Quick setup training for UnityXpressions
GET /api/learning/health
Learning engine health status

๐Ÿ”Œ Widget Installation

Add Bob to any website with a single script tag. After onboarding, your widget embed code is available in the Customer Portal under Widget Setup.

<!-- Paste before </body> -->
<script
  src="https://your-domain.com/widget/loader.js"
  data-widget-key="YOUR_WIDGET_KEY"
  data-position="bottom-right"
  async>
</script>
GET /api/customer-portal/widget-code
Returns ready-to-paste embed code for your website. Requires customer JWT.

๐ŸŽญ Persona Customization

Personas control how Bob communicates โ€” tone, name, and system instructions. Every tenant gets a default persona on signup; you can customize it from the Admin Dashboard or the API.

GET /api/personas/:tenantId
List all personas for a tenant.
POST /api/personas/:tenantId
Create a new persona. Body: { name, description, tone, systemPrompt }
PUT /api/personas/:tenantId/:personaId
Update an existing persona's tone, instructions, or name.

๐Ÿ’ฐ Plans & Pricing

Published pricebook is the source of truth. Use the APIs below for live numbers; this table matches pricebook-seed V1 (adjusts when you publish a new version).

Feature Starter Pro Enterprise
List price (USD/mo) $79 $249 $899
Included AI credits / mo 15,000 75,000 250,000
Team seats Up to 3 Up to 10 Unlimited
Standard integrations (included) 1 3 10
Support Email Priority Dedicated
GET /api/pricing/marketing-cards
Plan cards for marketing and checkout UI (prices, credits, estimates)โ€”derived from the published pricebook. No authentication required.
GET /api/pricing/snapshot
Public-safe full pricebook snapshot (no provider cost fields). No authentication required.

๐Ÿ› ๏ธ Integration Examples

Use the block that matches your scenario. Do not copy the admin example into anonymous marketing HTML.

Public same-origin (anonymous)

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 })
});

Authenticated admin only (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 }
)