Skip to main content
📦 View on npm

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_SECRET env variable.
  • Parses the webhook payload and routes it to the correct callback.

Handler parameters


2. LLM-friendly formatting

Use emailToLLMString() and threadToLLMString() to transform rich email objects into compact, XML-ish strings optimised for Large Language Models:
These helpers:
  • 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
Visit the complete TypeScript SDK documentation on npm.