ProductMarch 28, 2026·8 min read

Auto-Inject: How to Connect Your APIs Directly to the Chat Widget

Citai Team

March 28, 2026 · 8 min read

The problem: real-time user data

Imagine this scenario: a customer opens your chat widget and enters their account code. They want to know their balance, order status, or when their next invoice is due. Your KB has all the procedure and policy documentation, but doesn’t have THAT customer’s specific data.

Until now, tools (Tool Calling) relied on the LLM to “decide” when to call the API. This works fine for optional data like weather, but for mandatory customer data, you need something more reliable.

Auto-Inject solves this: it runs the tool automatically using widget intake data, without waiting for the LLM. 100% deterministic.

Two trigger modes

Citai now offers two modes for each tool:

Mode A: LLM decides

The AI model analyzes the user’s question and decides whether it needs to call the external API. It’s flexible but probabilistic (~85% accuracy).

Ideal for: optional tools like weather, exchange rates, news.

Mode B: Auto-Inject

The tool runs automatically with widget intake filter data. No LLM dependency. 100% deterministic.

Ideal for: CRM, ERP, ticketing — any system where you need user data from the first message.

~85%LLM mode reliability
100%Auto-Inject reliability
0msDecision latency (no LLM wait)

How the flow works

Widget opens
    ↓
Intake filter: "Enter your customer code" → ABC-7842
    ↓
User asks: "What's my balance?"
    ↓
Auto-Inject: calls CRM API with code=ABC-7842
    ↓
API returns: { name: "Maria", plan: "Pro", balance: "$1,250" }
    ↓
LLM responds with KB (policies) + real customer data
    ↓
"Maria, your current balance is $1,250 on the Pro plan.
 Your next invoice is due April 15th."

Step-by-step guide

Step 1: Configure the intake filter

  1. Go to Settings > API Keys
  2. Edit your widget API key
  3. In Intake Filters, add a field:
    • Key: customer_code
    • Question: “Enter your customer code”
    • Type: text
    • Required: yes

Step 2: Create the tool with Auto-Inject

  1. Go to Tools > New Tool
  2. Configure your API endpoint (URL, method, auth)
  3. Add the code parameter (string, required)
  4. Under Trigger mode, select “Auto-inject from filters”
  5. Under Frequency, choose:
    • First message: for static data (profile, plan)
    • Every message: for dynamic data (real-time balance)
  6. In the mapping, connect: codecustomer_code

Step 3: Test

  1. Open the widget on your website
  2. Complete the intake with a test code
  3. Send any message
  4. You’ll see “Loading your data…” before the response

Use cases by industry

Industry Intake API Data
Telecom Phone number CRM Balance, plan, invoices
E-commerce Order number Logistics Shipping status, tracking
Fintech Account number Core banking Balance, transactions
Healthcare Patient ID HIS Appointments, history
Support Ticket ID Helpdesk Status, assignee

Combining both modes

A single tenant can have tools in both modes. For example:

  • lookup_customer → Auto-Inject (always runs with the code)
  • weather → LLM decides (only when the user asks about weather)

Auto-Inject tools are automatically excluded from LLM function calling to avoid double calls.

Fault tolerance

If the external API fails (timeout, HTTP error), the agent continues responding using only the KB. The error is logged but not shown to the end user. The flow never blocks.


Connect your APIs instantly. Try Citai →

Try Citai for free

Create your intelligent knowledge base in minutes. No credit card required.

Create free account