Installation
Install the AI Inbx TypeScript SDK using your preferred package manager:Quick Start
Initialize the client with your API key:Built-in Helpers
1. Next.js webhook handler
createNextRouteHandler() generates a ready-to-use POST handler that:
- Validates the request signature using the AI_INBX_SECRETenv variable.
- Parses the webhook payload and routes it to the correct callback.
- 
Add an API route (any path works, e.g., app/api/aiinbx-webhook/route.ts):
- 
Set AI_INBX_SECRETin your environment. The value is shown once when you enable secrets during webhook creation.
 • Secret on/off can’t be toggled later—delete & recreate the webhook to change.
 • Lost or exposed the secret? Click Rotate secret in the webhook dropdown to generate a fresh value and invalidate the old one.
- 
Add the webhook URL (/api/aiinbx-webhook) in the dashboard.
Handler parameters
2. LLM-friendly formatting
UseemailToLLMString() and threadToLLMString() to transform rich email objects into compact, XML-ish strings optimised for Large Language Models:
- Keep only fields relevant for reasoning (addresses, subject, text, etc.).
- Preserve structure with lightweight XML-like tags.
- Return a single string ready to drop into your prompts.
Full example: AI-powered support bot
app/api/aiinbx-webhook/route.ts
ℹ️ The example above is completely serverless and needs no additional infrastructure.
Complete Documentation
For comprehensive documentation including:- Request & response types
- Error handling
- Advanced configuration
- All available methods
- TypeScript examples