Route, classify and label your support tickets
Overview
This guide demonstrates how to use the Inkeep AI Context API to programmatically triage and route tickets.
With inkeep-context
you can:
- Categorize the ticket (e.g. between "feature_request", "account_billing", or "production_issue").
- Extract static fields - for example, detect if a user has mentioned an invoice ID.
- Label the ticket with a
Subject
or other fields you'd typically ask a user to fill out manually. - Summarize the ticket and leave the summary as an internal note for your team.
For example, you may:
- Route production issues directly to an engineering-led queue.
- Choose topics you'd like Inkeep auto-reply AI to respond to vs ones you'd like to route directly to your team.
- Populate custom, structured fields in your support ticket system from the user's request.
The inkeep-context
API automatically uses your Inkeep knowledge base as context while generating a response.
While this example leverages the Vercel AI SDK and assumes a JavaScript backend, the same principle pattern can be used with any backend language and with any OpenAI compatible SDK.
Since the API follows the OpenAI chat completions format, you can define any custom fields or tool calls relevant for your scenario.
Get started
- Inkeep API Key: If you haven't created one yet, get an Inkeep API Key.
- Install dependencies: Install the
ai
,@ai-sdk/openai
andzod
packages.
Example
In the following scenario, we demonstrate how a single call to the inkeep-context
API can be used to output all the relevant fields we'd like for our workflow.
1. Define a schema
You can use zod
to define a schema of any structured information we'd like from the AI.
We use the describe()
function to prompt the AI on how it should "think" about each field. See our prompting guide for more advanced scenarios.
1. Initiate the AI client
First, lets create the Inkeep AI client.
Alternatively, you can use any AI provider for this task. For example:
This may be beneficial for low-latency scenarios where the AI model doesn't need extensive context about your product.
3. Add business logic
Here, we'll use the generateObject
function to request data in this structure from the inkeep-context
API.
In the BUSINESS LOGIC
section, you can handle creating or updating a ticket in your support platform, calling the inkeep-qa
API to get an automated reply, add internal comments, etc.
For more advanced workflows or AI agents, you can use tool calling as well.