HTTP Bot adapter integrates any backend system with a LangBot pipeline over plain HTTP. Ticketing systems, CRMs, internal tools, custom web apps — all can drive a pipeline through it:
- Inbound: your backend POSTs a signed message to a fixed LangBot URL;
- Outbound: LangBot POSTs replies to a callback URL you configure.
- Message aggregation (N→1): a user fires several messages in a row, merged into one turn;
- Multi-part replies (1→M): one turn may produce several replies (function calls, multi-message plugins, streamed chunks).
If you want an in-browser, real-time chat widget, use the Web Page Bot instead. HTTP Bot is designed for backend-to-backend integration.
How it works
- (1) Inbound is fire-and-collect: LangBot returns
202 Acceptedimmediately and does not carry the pipeline result on that response; - (2) Outbound replies arrive later as separate signed POSTs to your
callback_url; a single turn may produce several callbacks; - Everything is keyed by a
session_idyou choose (e.g. a ticket number); eachsession_idmaps to one isolated session.
Create the bot
In the LangBot WebUI, go to Bots > Create Bot, fill in a name, and pickHTTP Bot as the platform/adapter.
Configuration
After binding a pipeline and enabling the bot, the config page shows the Inbound Webhook URL, like
https://your-langbot/bots/<bot_uuid>. Copy it.
Signature scheme
Both directions use the same dependency-free HMAC-SHA256 scheme:
Verify outbound callbacks the same way, using the outbound secret (or the inbound secret if left blank).
Send your first message (curl)
Inbound request format
POST /bots/{bot_uuid}
session_id(required): your stable id, mapped 1:1 to a LangBot session;message(required): a LangBot message chain. Text uses{"type":"Plain","text":"..."}, images use{"type":"Image","url":"..."}(orbase64); other types:Voice,File,At,Quote.
Aggregation (N → 1)
If the pipeline has message aggregation enabled, send several messages with the samesession_id inside the aggregation window and they merge into one turn. No special flag — just reuse the session_id.
Outbound callback format
LangBot POSTs each reply part to your callback URL:2xx quickly. Non-2xx / timeout → LangBot retries with exponential backoff.
Multi-part replies (1 → M)
One turn may emit multiple callbacks, delivered insequence order for a given session:
session_id + sequence; the turn is complete when is_final: true arrives.
Reset a session
Start a fresh conversation for asession_id (drops history):
Synchronous convenience mode
If you don’t need streaming/multi-part and just want one reply back on the same HTTP call, POST to/sync. LangBot waits for the turn to finish and returns all reply parts collapsed into one array:
Error codes
Reference clients & 5-minute demo
The main repo’sexamples/http-bot/ ships an interactive playground plus Python and TypeScript reference clients.
Interactive playground (run this first)
playground.py is a single-file web app: type a message in your browser → it is signed and POSTed to a running http_bot bot → replies stream back into the page, with a debug panel showing the signature, the 202 ack, and each callback’s sequence / verification.
http_bot bot from data/langbot.db and points that bot’s callback_url + secrets back at itself via the LangBot API (live reload, no restart). Requires an enabled http_bot bot bound to a working pipeline.
Command-line reference clients
examples/http-bot/ also ships Python and TypeScript reference clients (with a callback receiver):
[part ] / [FINAL]) with its sequence number — that’s 1→M multi-reply with signature verification, live.
A machine-readable contract is in the main repo at docs/http-bot-openapi.json.
Security checklist
- Keep Require Inbound Signature on in production;
- Use HTTPS callback URLs, set only in config (no per-message override);
- Treat secrets like passwords; rotate via the dashboard;
- The inbound route is unauthenticated at the framework level by design — security comes entirely from the HMAC signature, so never disable it on a public deployment.
