Answerbell docs
v1.2.0
Live demo Get help
● Reference · How it fits together

Architecture
who talks to whom on a call.

The call audio runs between Telnyx and ElevenLabs. Answerbell answers the agent's tool requests, keeps the records, sends e-mails and bills your clients.

Node.js 22HonoSQLite

01Diagram

Callerany phone Telnyx numberone per client ElevenLabs agentspeech · language model · voiceAI disclosure first Answerbell server/tools/<client>/<tool> · /webhooks/stripecall sync · usage alerts · /admin console SQLite (data/) Resende-mails Stripebilling You (operator)browser → /admin callSIP tool requests(HTTPS + secret)conversations(sync, API) console (sessions, roles)

02One call, step by step

  1. Caller dials. The client's Telnyx number sends the call over SIP to ElevenLabs.
  2. AI disclosure. The agent speaks it first; the caller cannot interrupt it.
  3. Tools. The agent calls business_info, check_availability, book_appointment, cancel_appointment, take_message or caller_history on Answerbell, and may transfer the call with ElevenLabs' transfer_to_number. Each request carries the client's secret in the x-answerbell-tool-secret header; Answerbell answers with JSON.
  4. Records and e-mail. Answerbell stores bookings and messages in SQLite (bookings checked inside one transaction) and e-mails the business through Resend. With a linked calendar the booking also appears there; your webhooks get the event.
  5. After the call. The sync job reads the conversation from ElevenLabs into the call log with its labels, adds the minutes to the client's usage (spam left out) and sends call.completed to your webhooks.

03Where things are in the code

FileWhat
src/index.tsstart-up: config, database, console, server, background jobs (call sync, calendars, summaries, reports, overage, webhooks)
src/server.tsHTTP routes, CSP, body size caps, rate limits
src/agent.tsAI disclosure per language, agent configuration, transfers
src/tools.tsthe six server tools, tool secrets
src/provision.ts, src/elevenlabs.ts, src/knowledge.tscreating and updating agents, tools and knowledge documents over the ElevenLabs REST API
src/bookings.ts, src/clients.ts, src/messages.ts, src/time.ts, src/holidays.tsclients, opening hours, special hours, holidays, free times, bookings, messages, timezones
src/calls.ts, src/analytics.tscall sync, labels, usage minutes, usage alerts, analytics
src/contacts.tscallers, VIP, block list
src/report.ts, src/summaries.tsmonthly report, summary e-mails
src/calendar/Google and Outlook two-way, iCal feeds, the bookings feed
src/portal.ts, src/web/portal.tsclient portal accounts and pages
src/webhooks.ts, src/net.tsoutgoing signed webhooks; the guarded fetch for typed addresses
src/templates.ts, src/siteimport.tstrade templates; "Fill from the website"
src/stripe.ts, src/overage.tsCheckout, webhook signature, invoices; minutes above the plan
src/notify.tse-mails through Resend
src/admin/console declaration (sections, pages, checks, metrics) for the Admin Kit
src/web/, public/Today, Call analytics, Clients and their tabs, Bookings, Messages, Calls, Subscriptions, Webhooks
src/addons/followup/the optional Follow-up add-on
src/demo.tssample data for demo mode
packages/admin-kit/operator console: settings, keys, team, audit, status
dist/the compiled server, made by pnpm build; do not edit it

04Customizing

Most changes need no code: brand name, logo, colour and support e-mail are under Brand; every client's facts are on the client page. Code changes most buyers make:

  • Agent prompt wording: basePrompt in src/agent.ts (per language) and the tool rules in src/tools.ts. Keep the disclosure rules.
  • E-mail texts: bookingMail, messageMail, usageMail in src/notify.ts.
  • Console page layout: src/web/ and public/console.css.
  • Trade templates: src/templates.ts.

Run pnpm typecheck and pnpm test after a change, then pnpm build and restart the server (WSL or Git Bash on Windows). While you work, pnpm dev restarts on every change.