BookbagBookbag
Developers

Build with the Bookbag API

A clean REST API and SDKs to send messages to your AI support agent, define custom actions, sync your knowledge, and react to events with webhooks.

support.js
// npm install @bookbag/sdk
import { Bookbag } from '@bookbag/sdk'

const bookbag = new Bookbag({ apiKey: process.env.BOOKBAG_API_KEY })

// Send a customer message to your AI agent and get a reply
const { reply, resolved, handoff } = await bookbag.chat({
  agentId: 'support-agent',
  conversationId: 'conv_123',
  message: 'Where is my order #1042?',
  customer: { email: 'sam@example.com' },
})

console.log(reply)       // grounded answer with live order status
console.log(resolved)    // true if the agent fully resolved it
console.log(handoff)     // set when the agent escalates to a human
# pip install bookbag
import os
from bookbag import Bookbag

client = Bookbag(api_key=os.environ["BOOKBAG_API_KEY"])

resp = client.chat(
    agent_id="support-agent",
    conversation_id="conv_123",
    message="Can I return this for a different size?",
    customer={"email": "sam@example.com"},
)
print(resp.reply)
// Define a custom action the agent can call mid-conversation
{
  "name": "lookup_loyalty_points",
  "description": "Get a customer's loyalty point balance",
  "parameters": {
    "type": "object",
    "properties": { "email": { "type": "string" } },
    "required": ["email"]
  },
  "endpoint": "https://api.yourstore.com/loyalty",
  "auth": { "type": "bearer", "secretRef": "LOYALTY_API_KEY" }
}
// POST to your endpoint when a conversation is handed off
{
  "event": "conversation.handoff",
  "conversation_id": "conv_123",
  "reason": "refund_over_limit",
  "summary": "Customer requests $240 refund; exceeds $200 auto-limit.",
  "customer": { "email": "sam@example.com" },
  "transcript_url": "https://app.bookbag.ai/c/conv_123"
}

What you can build

Chat API

Send customer messages and get grounded, action-taking replies for any surface — your app, kiosk, or backend.

Custom actions

Let the agent call your own endpoints (loyalty, warranty, OMS) with auth and guardrails you define.

Webhooks

React to handoffs, resolutions, CSAT, and tags in real time to sync with your stack.

Knowledge sync

Programmatically add and refresh knowledge sources so the agent always answers from current content.

Widget JS API

Open/close the widget, prefill customer identity, and pass page context for smarter answers.

Scoped keys

Issue scoped API keys per environment, with test keys and a sandbox agent for safe development.

Frequently Asked Questions

Yes. Bookbag offers a REST API plus Node and Python SDKs to send customer messages to your AI agent, manage conversations, sync knowledge sources, define custom actions, and receive events via webhooks.

Yes. You can register custom actions that point to your own API endpoints (with auth), and the agent will call them when relevant — for example, looking up loyalty points or checking warranty status — within the guardrails you set.

Subscribe to webhooks like conversation.handoff and conversation.resolved. Bookbag POSTs a payload with the conversation summary, reason, and a link to the full transcript so you can route it into your own systems.

Yes. Add the widget with a one-line script tag, or control it via the JavaScript API to open/close it, prefill customer identity, and pass page context.

Yes. Every workspace includes test API keys so you can build and verify your integration against a sandbox agent before going live.

Start building with Bookbag

Join the ecommerce teams resolving more tickets, answering 24/7, and turning support into a revenue channel with Bookbag.