Bob Office 168/52 developer documentation

Bob向けのAPIリファレンス、Webhook、埋め込みウィジェット — ガバナンス付きAIフロントオフィス。

🔐 認証

POST /api/auth/login
管理者ユーザーを認証しアクセストークンを取得
{
  "email": "admin@office16852.com",
  "password": "your_password"
}
POST /api/customers/auth/login
顧客ユーザーを認証(マルチテナント)
{
  "email": "customer@business.com",
  "password": "customer_password"
}

チャットと会話

3つの道: (1) 同一オリジン、公開、匿名でアクセス。POST /api/chat (例:マーケティングサイトのウィジェット、ログイン不要)。(2) クロスオリジン埋め込みPOST /api/widget/chat with X-Widget-Key and allowed Origin。(3) 認証済みアプリ / Mission ControlPOST /api/chat/sessionPOST /api/chat/message (要 chat.manage and session/CSRF for cookie auth) — ない for anonymous fetch 公開ページから。

1) 公開匿名(same-origin)

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

2) クロスオリジン・ウィジェット

POST /api/widget/chat
顧客サイトに埋め込みます。ヘッダー: X-Widget-Key, Content-Type: application/json. Origin must be allowed for the key. See docs/REQUEST_FLOWS.md CORSの詳細はリポジトリを参照。

3) 認証済みセッション / 管理UIのみ

POST /api/chat/session
Mission Controlまたはダッシュボードにログインしたときにセッションを作成(Cookie向けRBAC + CSRF)。
POST /api/chat/message
Send a message from 認証済み admin/chat UI (chat.manage)。戻り値 401 if called anonymously from a public page — use POST /api/chat その場合はこちらを。
{
  "session_id": "session_123",
  "message": "Hello, I need help with my order"
}
GET /api/chat/history/:session_id
チャット会話履歴を取得(認証済み)

📊 アナリティクスと監視

GET /api/analytics/overview
システム分析の概要を取得
GET /api/health
システム健全性ステータスを確認
GET /api/metrics/business
ビジネス固有の指標を取得

マルチテナント顧客管理

GET /api/customers/dashboard/:businessId
特定のビジネス向けの顧客ダッシュボードデータを取得
GET /api/customers/analytics/:businessId
特定の顧客向けのビジネス分析を取得
GET /api/customers/integration/:businessId/status
ビジネスの統合ステータスを確認

🎯 UnityXpressions パイロット

GET /api/unityxpressions/dashboard
UnityXpressions パイロットダッシュボードのデータ
GET /api/pilot/metrics/realtime
パイロットKPIをリアルタイム表示
GET /api/pilot/feedback/recent
直近のお客様の声(パイロット)

🎓 トレーニングと学習

POST /api/training/unityxpressions/analyze
学習用に UnityXpressions の事業を分析
POST /api/training/unityxpressions/quick-setup
UnityXpressions 向けクイック導入トレーニング
GET /api/learning/health
学習エンジンの稼働状態

🔌 ウィジェットのインストール

Bobは1つのscriptタグでどのWebサイトにも追加できます。オンボーディング後、ウィジェット埋め込みコードはCustomer Portalの次の場所で確認できます: ウィジェットの設定.

<!-- 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
貼り付け用埋め込みコードを返却。顧客JWTが必要。

🎭 ペルソナのカスタマイズ

ペルソナはBobの話し方(トーン、名前、指示)を制御。テナントごとに初期値あり。管理画面かAPIで変更可

GET /api/personas/:tenantId
テナントのすべてのペルソナを一覧表示します。
POST /api/personas/:tenantId
新しいペルソナを作成。本文: { name, description, tone, systemPrompt }
PUT /api/personas/:tenantId/:personaId
既存のペルソナのトーン、指示、または名前を更新します。

💰 プランと料金

Published pricebook is the source of truth. Use the APIs below for live numbers; this table matches pricebook-seed V1(新しいバージョンを公開すると調整されます)。

機能 スターター Pro(上位プラン) エンタープライズ
定価(USD/月) $79 $249 $899
含まれる AI クレジット / 月 15,000 75,000 250,000
チーム席 最大3 最大10 無制限
標準連携(含む) 1 3 10
サポート メール 優先度 専用
GET /api/pricing/marketing-cards
価格表(公開版)に基づくマーケ/チェックアウト用のプランカード(価格・クレジット・見積り)。認証不要
GET /api/pricing/snapshot
価格表(プライスブック)の一般公開向け安全スナップショット全件。事業者向け原価項目は含みません。認証は不要です。

🛠️ 連携の例

シナリオに合うブロックを使ってください。管理画面の例を匿名のマーケティングHTMLにそのまま貼り付けないでください。

同一オリジン、公開、匿名扱い。

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

クロスオリジンウィジェット

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

認証済み管理者のみ(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 }
)