[PT-BR] Bob [PT-BR] Office 168/52 developer documentation

[PT-BR] API reference, webhooks, and the embeddable widget for Bobโ€”your governed AI front office.

[PT-BR] ๐Ÿ” Authentication

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

[PT-BR] ๐Ÿ’ฌ Chat & Conversations

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

[PT-BR] 1) Public anonymous (same-origin)

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

[PT-BR] 2) Cross-origin widget

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

[PT-BR] 3) Authenticated session / admin UI only

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

[PT-BR] ๐Ÿ“Š Analytics & Monitoring

GET /api/analytics/overview
[PT-BR] Get system analytics overview
GET /api/health
[PT-BR] Check system health status
GET /api/metrics/business
[PT-BR] Get business-specific metrics

[PT-BR] ๐Ÿข Multi-Tenant Customer Management

GET /api/customers/dashboard/:businessId
[PT-BR] Get customer dashboard data for specific business
GET /api/customers/analytics/:businessId
[PT-BR] Get business analytics for specific customer
GET /api/customers/integration/:businessId/status
[PT-BR] Check integration status for business

[PT-BR] ๐ŸŽฏ UnityXpressions Pilot

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

[PT-BR] ๐ŸŽ“ Training & Learning

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

[PT-BR] ๐Ÿ”Œ Widget Installation

[PT-BR] Add Bob to any website with a single script tag. After onboarding, your widget embed code is available in the Customer Portal under [PT-BR] 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
[PT-BR] Returns ready-to-paste embed code for your website. Requires customer JWT.

[PT-BR] ๐ŸŽญ Persona Customization

[PT-BR] 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
[PT-BR] List all personas for a tenant.
POST /api/personas/:tenantId
[PT-BR] Create a new persona. Body: { name, description, tone, systemPrompt }
PUT /api/personas/:tenantId/:personaId
[PT-BR] Update an existing persona's tone, instructions, or name.

[PT-BR] ๐Ÿ’ฐ Plans & Pricing

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

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

[PT-BR] ๐Ÿ› ๏ธ Integration Examples

[PT-BR] Use the block that matches your scenario. Do not copy the admin example into anonymous marketing HTML.

[PT-BR] 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();

[PT-BR] 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 })
});

[PT-BR] 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 }
)