Skip to main content

Overview

Context injection lets you send messages or instructions to your AI agent while a call is in progress. The agent receives the injected content as additional context and can act on it naturally within the conversation. Use cases:
  • Feeding the agent real-time information (e.g. order status lookups)
  • Giving the agent new instructions mid-conversation
  • Passing context from a human supervisor monitoring the call

Request

curl -X POST https://api.kejue.co/api/v1/calls/{call_id}/inject-context \
  -H "X-API-Key: kej_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "text": "The customer'\''s order #12345 shipped yesterday via FedEx.",
    "urgency": "soon"
  }'
FieldTypeRequiredDefaultDescription
textstringYes-The context or instruction to send to the agent
urgencystringNo"soon"Controls when the message is delivered

Urgency Levels

LevelBehavior
immediateInterrupts the current conversation to deliver the message right away
soonDelivers at the next natural pause or speaker turn
laterPassive context — the agent incorporates it when relevant
Use immediate sparingly — it interrupts the natural flow. For most cases, soon provides the best balance of timeliness and conversational quality.

Response

Returns 204 No Content on success.

Error Handling

StatusCondition
404Call not found in this workspace
409Call is not in in_progress status
400Invalid urgency value
502Failed to deliver the message to the active call

Example: Real-Time CRM Lookup

const response = await fetch(
  `https://api.kejue.co/api/v1/calls/${callId}/inject-context`,
  {
    method: 'POST',
    headers: {
      'X-API-Key': 'kej_live_...',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      text: 'Customer has an outstanding invoice of $2,500 due in 3 days.',
      urgency: 'soon',
    }),
  }
);
// 204 = success