Hooman Labs DocsGuideReference

Pre Call Actions

These actions allow your agent to fetch and improve context before a call starts.

Pre Call API

This endpoint enables your agent to fetch contextual information from a CRM or internal database at the start of a call. It’s typically used to:

  1. Automatically retrieve customer information or metadata.

  2. Make that data available to the agent for use in prompts, messages, or API calls during the conversation.

This allows agents to tailor the conversation using real-time context, improving personalization and efficiency.

Configure

  1. Navigate: Agents → Select Agent → Edit → Pre Call API.

  2. Toggle to enabled.

  3. Fill out the form and publish.

Field

Purpose

Notes

Method

HTTP verb used to reach your endpoint.

Choose GET, POST, or PUT.

URL

Full endpoint (e.g. https://crm.example.com/lookup).

Query‑string params allowed, e.g. ...?phone=${caller}.

Timeout

Max time (ms) to wait for the response before we abort.

Default 15000 (15 s).

Headers

JSON object of request headers.

Must include "content-type": "application/json" if you send a JSON body. Add any auth tokens etc.

Body (optional, POST/PUT only)

Raw JSON your endpoint expects.

Free‑form—completely defined by you. Use variable placeholders (${variable}) to pass data (e.g. caller phone number).

Variables

  • ${caller} – caller’s number

  • ${callee} – callee’s number

  • any context keys you injected during task creation

The same syntax is available in URL, headers, and body.

Response mapping

After your endpoint responds, pick which JSON properties should become variables inside the agent:

Response variables

  • Click ➕ Add Variable.

  • Left column: give the variable a friendly name (e.g. customerTier).

  • Right column: enter its JSON path in the response (e.g. data.tier).

  • Repeat for each key you need.

Pass a unique customer ID into agent context to help link pre and post call data reliably in your system.

Calculated variables (optional)

Build logic on top of response variables so the agent doesn’t have to.

Example:

  • Calculated variable: eligibleForUpgrade

  • IF customerTier == "gold" THEN true ELSE false

These calculated variables are written into the same context object and can be referenced exactly like response variables.

Example

Request

{
  "method": "POST",
  "url": "https://crm.example.com/v1/customer-lookup",
  "headers": {
    "content-type": "application/json",
    "Authorization": "Bearer your-api-token"
  },
  "timeout": 15000,
  "body": {
    "phone": "${caller}",
    "agentId": "${agent}"
  }
}

Sample response from CRM

{
  "data": {
    "customerId": "C12345",
    "name": "Aditi Agarwal",
    "tier": "gold",
    "openTickets": 2,
    "preferredLanguage": "hi-IN"
  },
  "meta": { "source": "Salesforce" }
}

Response variable mapping

Variable name

JSON path

customerId

data.customerId

customerName

data.name

customerTier

data.tier

ticketCount

data.openTickets

languagePref

data.preferredLanguage

Calculated variable

Calculated variable

Logic

vipCustomer

IF customerTier == "gold" THEN true ELSE false

Now the agent prompt can reference values like Hi ${customerName}! I see you’re a ${customerTier} member.

We do not retry failed API calls; handle idempotency/replay your side if needed. The call will start without specific variable addition to the context.

Task Context Enrichment

This feature allows you to enrich and transform your task context before it is provided to the agent. Typically used to clean real world messy data into a clean, speech ready format for agent to use.

This feature is only applicable for outbound calling tasks.

Configure

  1. Select an LLM model and temperature.

  2. Add clear instructions for LLM to generate new variables based on given task context.

  3. Add parameter name, type, description, and validation rules.

  4. Reference these new variables in your prompt using ${variable_name} notation.

If parameter names are same as original context variables then post transformation those variables will be replaced.

Example

Context

{
  "name": "Tarun tarun -",
  "address": "H. No. 45 Sector-3 Bangalore Koramangala 435678"
}

Prompt

You are an expert data transformation agent. Extract and convert specific fields from a given JSON input into a tool call, following the formatting rules described below.

<rules>
- name: Clean the name by removing duplication, unnecessary words, or symbols.
- name_hindi: Transliterate the cleaned name into Hindi (Devanagari script).
- address: Clean and transform the address by removing any duplications, separating the pincode, expanding abbreviations to their full form, and converting relevant numbers to spoken format.
- pincode: Convert the pincode into words, digit by digit (e.g., "435678" → "four three five six seven eight").
</rules>

Context (updated)

{
  "name": "Tarun",
  "name_hindi": "तरुण",
  "address": "House number forty five, sector three, Koramangala, Bangalore",
  "pincode": "four three five six seven eight"
}