A chatbot that syncs documents from Box and gives you grounded, cited Q&A over them, powered by Interfaze.
Interfaze ยท Docs ยท Box ยท Chrome Extension
Drop a file into your Box account and watch it flow automatically through OCR, chunking, embedding, and indexing, with the UI updating live at every step. Then ask questions and get answers grounded in your own documents, streamed to your browser in real time.
Most "chat with your docs" demos make you manually upload files. This one wires directly into Box: the moment a file lands in your account, a webhook kicks off the pipeline and the document becomes searchable, with no manual import step.
- ๐ค Zero-touch sync: a Box
FILE.UPLOADEDwebhook starts indexing automatically, with no manual upload - ๐ OCR extraction: Interfaze pulls text from PDFs, scans, and images
- ๐ง Semantic search: Interfaze embeddings power top-k retrieval over your documents
- ๐ฌ Grounded chat: answers cited to your documents, streamed to your browser in real time
- โก Live status:
Queued,Extracting,Embedding,Indexed, pushed to the UI as it happens - ๐งฉ Chrome extension: chat with your indexed Box docs from any tab (side panel)
- ๐ Per-account isolation: anonymous sessions keep each user's documents separate
- ๐ Production-ready: one-command deploy included
Box File Upload
โ
[FILE.UPLOADED webhook] โ Queue
โ
[POST /api/process] (async job)
โโ Interfaze: OCR extract text
โโ Chunk text into segments
โโ Interfaze: embed each chunk
โโ Vector index: upsert indexed chunks (idempotent)
โ
Live UI: File status Queued โ Extracting โ Embedding โ Indexed
โ
Chat: User question
โโ Interfaze: embed question
โโ Vector index: semantic search (top 6 chunks)
โโ Interfaze: generate grounded answer
โโ Stream to browser
git clone https://github.com/InterfazeAI/ask-box.git
cd ask-box
npm installCopy the template and fill in all values:
cp .env.example .env.localRequired environment variables (see .env.example):
APP_URL: public URL for webhook callbacks (see "Public URL" below)BOX_CLIENT_ID,BOX_CLIENT_SECRET: from Box appBOX_REDIRECT_URI: set by Next.js; typically${APP_URL}/api/box/oauth/callbackBOX_WEBHOOK_PRIMARY_KEY,BOX_WEBHOOK_SECONDARY_KEY: Box webhook signature keysINTERFAZE_API_KEY,INTERFAZE_BASE_URL: Interfaze OCR serviceJIGSAWSTACK_API_KEY: embeddingsUPSTASH_VECTOR_REST_URL,UPSTASH_VECTOR_REST_TOKEN: vector indexUPSTASH_REDIS_REST_URL,UPSTASH_REDIS_REST_TOKEN: status pub/subQSTASH_TOKEN,QSTASH_CURRENT_SIGNING_KEY,QSTASH_NEXT_SIGNING_KEY: async job queue
- Create a Vector index with your provider
- Before creating the index, determine your embedding dimension:
- Run this snippet in your project (after setting
JIGSAWSTACK_API_KEYin.env.local):import { embed } from "@/lib/jigsawstack"; console.log((await embed("test")).length); // <- this is your dimension
- v1 = 768 dims, v2 = 4096 dims (assume 4096 unless you verified otherwise)
- Run this snippet in your project (after setting
- Create the Vector index with exactly that dimension (e.g., 4096)
- Copy
UPSTASH_VECTOR_REST_URLandUPSTASH_VECTOR_REST_TOKENto.env.local
- Create a Redis database
- Copy
UPSTASH_REDIS_REST_URLandUPSTASH_REDIS_REST_TOKENto.env.local
- Create a QStash instance
- Copy
QSTASH_TOKEN,QSTASH_CURRENT_SIGNING_KEY, andQSTASH_NEXT_SIGNING_KEYto.env.local
- Go to developer.box.com
- Create a new app with OAuth 2.0 (user auth)
- Set redirect URI to:
${APP_URL}/api/box/oauth/callback(e.g.,https://example-tunnel.ngrok.io/api/box/oauth/callback) - Copy Client ID and Client Secret to
.env.local - Set up a webhook for file uploads:
- In your Box app settings, go to Webhooks and add a webhook pointing to
${APP_URL}/api/box/webhook - Event:
FILE.UPLOADED - Copy the Primary and Secondary signature keys to
BOX_WEBHOOK_PRIMARY_KEYandBOX_WEBHOOK_SECONDARY_KEYin.env.local
- In your Box app settings, go to Webhooks and add a webhook pointing to
Box webhooks and queue callbacks require a public URL.
Use ngrok or similar to expose localhost:3000:
ngrok http 3000Copy the tunnel URL (e.g., https://abc123-tunnel.ngrok.io) and set:
APP_URL=https://abc123-tunnel.ngrok.iovercel deployThen set:
APP_URL=https://your-project.vercel.appAll environment variables must be set before running npm run build or npm run dev, because client modules (e.g., lib/jigsawstack.ts) read env vars at import time. A build with missing keys will fail at startup.
npm run devNavigate to http://localhost:3000.
Deploy your own instance to Vercel:
After deploying, set APP_URL to your Vercel URL and point your Box webhook and redirect URI at it.
-
Click "Connect Box" in the top-right
- You'll be redirected to Box login and asked to authorize the app
- After successful OAuth, the app stores your tokens
-
Upload a file to your Box account
- The Box webhook triggers, queues an async job, and the job starts
- Watch the Files panel on the left as the status changes:
- Queued, then Extracting (Interfaze OCR)
- then Embedding (Interfaze)
- then Indexed
-
Ask a question in the Chat panel
- The app embeds your question, searches the vector index for relevant chunks, and streams a grounded answer from Interfaze
-
Try uploading multiple files to see them all indexed and searchable together in one session
Run all unit tests (chunk extraction, status pub/sub, Box signature validation, embedding parsing, context building):
npm run testWatch mode:
npm run test:watch- Interfaze model IDs (
interfaze-ocrinlib/interfaze.tsandinterfazeinapp/api/chat/route.ts) are placeholders. Verify against current Interfaze docs before relying on them in production. - Dimension mismatch error: If you see a vector dimension error, you likely created your vector index at the wrong dimension. Run the snippet above to confirm your embedding size and recreate the index at the correct dimension.
- Webhook delivery: Box webhooks may take a few seconds to deliver. If a file doesn't appear in the UI, check the queue or status logs.
- "Build failed: Cannot find module '@/lib/jigsawstack'": Set all env vars in
.env.localbefore building. - "403 bad signature" on webhook: Verify
BOX_WEBHOOK_PRIMARY_KEYandBOX_WEBHOOK_SECONDARY_KEYmatch your Box app settings. - "Vector dimension mismatch": Run the embedding size check above and recreate your vector index at the correct dimension.
- Box: file management and webhooks
- Interfaze: OCR text extraction, embeddings, and grounded chat
A Chrome side-panel extension to chat with your indexed Box documents from any
tab. It reuses this app's /api/chat backend and chat UI.
Install from the Chrome Web Store, or build it from source below.
# from the repo root (ensures runtime deps are installed)
npm install
cd extension
npm install
npm run build # outputs extension/dist/
# or: npm run dev # watch mode, rebuilds on change- Open
chrome://extensions, enable Developer mode. - Click Load unpacked and select
extension/dist/. - Click the Ask Box toolbar icon to open the side panel.
- Click the gear icon and set the Backend URL (default
http://localhost:3000), then Save. - Ask questions about your indexed Box documents.
Requires Chrome 114+ (Side Panel API). The backend URL is stored in
chrome.storage.sync; switch it any time to point at a deployed instance.
Released under the MIT License.
