-
Notifications
You must be signed in to change notification settings - Fork 59
Description
Summary
Add a config-driven webhook that fires after every agent response, enabling external integrations (analytics, logging, observability) without modifying core code.
Motivation
Community user (bibbs) runs 3 lettabot instances on a Raspberry Pi with a local analytics server that evaluates agent responses after each exchange. Currently requires patching bot.ts, config/types.ts, and main.ts on every upstream rebase (~17 lines). This is the most generally useful hook for the community -- anyone doing logging, analytics, or external integrations would benefit.
Related to #388 (message-level hooks) but much narrower in scope. This proposal is fire-and-forget only (no response transformation), which makes it significantly simpler to implement and maintain.
Proposed Config
features:
webhooks:
afterResponse:
url: http://localhost:3847/api/evaluate
headers:
Authorization: "Bearer ${ANALYTICS_TOKEN}"Implementation Notes
- Fire-and-forget POST after
sentAnyMessageis confirmed and response is non-empty - Should never block or affect the response pipeline
- Body should include: agent ID, user text, agent response, channel, chatId, timestamp
- Environment variable interpolation in URL and headers (already have precedent in config)
- Failure should be logged but never surface to the user
Context
This is one of 5 issues filed from a community user's multi-bot deployment feedback. See also: #388 for the broader message hooks discussion.