> ## Documentation Index
> Fetch the complete documentation index at: https://docs.callkaro.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Variable Source & Formatting

> Configure variable formatting and source from integrated CRMs

## Overview

Variable Source & Formatting allows you to:

1. **Format Variables** - Control how numbers, dates, and times are spoken
2. **Source from CRMs** - Pull variable values from integrated systems like LeadSquared or HubSpot

This ensures your agent speaks data in a natural, human-friendly way and can access customer information from your CRM during calls.

***

## How It Works

For each variable in your system prompt (like `{{customer_name}}` or `{{order_amount}}`), you can:

**1. Set Format:** How the value should be spoken

```
Variable: order_amount = 2500
Format: [Number] Nearest Thousands
Agent says: "Your order is for two thousand five hundred rupees"
```

**2. Set Source:** Where to get the value from

```
Variable: customer_name
Source: LeadSquared
Key: ProspectFirstName
Agent gets: Value from your LeadSquared CRM
```

***

## Variable Formatting

### Number Formats

<AccordionGroup>
  <Accordion title="Full Words" icon="spell-check">
    **Format:** `[Number] Full Words`

    **Use For:** Exact amounts, prices, quantities

    **Examples:**

    ```
    2500 → "two thousand five hundred"
    15000 → "fifteen thousand"
    125000 → "one lakh twenty-five thousand"
    ```
  </Accordion>

  <Accordion title="Nearest Hundreds" icon="hundred-points">
    **Format:** `[Number] Nearest Hundreds`

    **Use For:** Approximate amounts, quick estimates

    **How It Works:** Rounds to nearest 100

    **Examples:**

    ```
    2459 → Rounds to 2500 → "two thousand five hundred"
    15723 → Rounds to 15700 → "fifteen thousand seven hundred"
    987 → Rounds to 1000 → "one thousand"
    ```
  </Accordion>

  <Accordion title="Nearest Thousands" icon="k">
    **Format:** `[Number] Nearest Thousands`

    **Use For:** Large amounts, simplified pricing

    **How It Works:** Rounds to nearest 1,000

    **Examples:**

    ```
    2459 → Rounds to 2000 → "two thousand"
    15723 → Rounds to 16000 → "sixteen thousand"
    125890 → Rounds to 126000 → "one lakh twenty-six thousand"
    ```
  </Accordion>

  <Accordion title="Nearest Lakhs" icon="indian-rupee-sign">
    **Format:** `[Number] Nearest Lakhs`

    **Use For:** Indian numbering system, real estate, salaries

    **How It Works:** Rounds to nearest 1,00,000 (1 lakh)

    **Examples:**

    ```
    145000 → Rounds to 100000 → "one lakh"
    2456789 → Rounds to 2500000 → "twenty-five lakhs"
    10234567 → Rounds to 10000000 → "one crore"
    ```
  </Accordion>
</AccordionGroup>

***

### Date Formats

<AccordionGroup>
  <Accordion title="Day Only" icon="calendar-day">
    **Format:** `[Date] Day`

    **Input:** ISO date format (YYYY-MM-DD)

    **Examples:**

    ```
    2024-12-25 → "Twenty-fifth"
    2024-01-01 → "First"
    2024-03-21 → "Twenty-first"
    ```
  </Accordion>

  <Accordion title="Day Month" icon="calendar">
    **Format:** `[Date] Day Month`

    **Input:** ISO date format (YYYY-MM-DD)

    **Examples:**

    ```
    2024-12-25 → "Twenty-fifth December"
    2024-01-01 → "First January"
    2024-03-21 → "Twenty-first March"
    ```
  </Accordion>

  <Accordion title="Day Month Year" icon="calendar-days">
    **Format:** `[Date] Day Month Year`

    **Input:** ISO date format (YYYY-MM-DD)

    **Examples:**

    ```
    2024-12-25 → "Twenty-fifth December Twenty twenty-four"
    2024-01-01 → "First January Twenty twenty-four"
    2015-06-15 → "Fifteenth June Twenty fifteen"
    ```
  </Accordion>
</AccordionGroup>

***

### Time Formats

<Accordion title="Hour Minute AM/PM" icon="clock">
  **Format:** `[Time] Hour Minute AM/PM`

  **Input:** ISO datetime format (YYYY-MM-DDTHH:MM:SS) or just time

  **Examples:**

  ```
  2024-12-25T14:30:00 → "Two thirty pm"
  2024-01-15T09:15:00 → "Nine fifteen am"
  2024-06-10T00:00:00 → "Twelve am"
  ```
</Accordion>

***

### DateTime Formats

<AccordionGroup>
  <Accordion title="Full Sentence" icon="comment">
    **Format:** `[DateTime] Full Sentence`

    **Input:** ISO datetime format (YYYY-MM-DDTHH:MM:SS)

    **Output:** `Time, on Day, Date Month, Year`

    **Examples:**

    ```
    2024-12-25T14:30:00 → "Two thirty pm, on Wednesday, Twenty-fifth December, Twenty twenty-four"
    2024-01-01T09:00:00 → "Nine am, on Monday, First January, Twenty twenty-four"
    ```
  </Accordion>

  <Accordion title="Sentence Without Year" icon="calendar-minus">
    **Format:** `[DateTime] Sentence Without Year`

    **Input:** ISO datetime format (YYYY-MM-DDTHH:MM:SS)

    **Output:** `Time, on Day, Date Month`

    **Examples:**

    ```
    2024-12-25T14:30:00 → "Two thirty pm, on Wednesday, Twenty-fifth December"
    2024-01-01T09:00:00 → "Nine am, on Monday, First January"
    ```
  </Accordion>

  <Accordion title="Hour Minute AM/PM" icon="clock">
    **Format:** `[DateTime] Hour Minute AM/PM`

    **Input:** ISO datetime format (YYYY-MM-DDTHH:MM:SS)

    **Examples:**

    ```
    2024-12-25T14:30:00 → "Two thirty pm"
    2024-01-01T09:00:00 → "Nine am"
    ```
  </Accordion>

  <Accordion title="Day" icon="calendar-day">
    **Format:** `[DateTime] Day`

    **Input:** ISO datetime format (YYYY-MM-DDTHH:MM:SS)

    **Examples:**

    ```
    2024-12-25T14:30:00 → "Twenty-fifth"
    2024-01-01T09:00:00 → "First"
    ```
  </Accordion>

  <Accordion title="Day Month" icon="calendar">
    **Format:** `[DateTime] Day Month`

    **Input:** ISO datetime format (YYYY-MM-DDTHH:MM:SS)

    **Examples:**

    ```
    2024-12-25T14:30:00 → "Twenty-fifth December"
    2024-01-01T09:00:00 → "First January"
    ```
  </Accordion>

  <Accordion title="Day Month Year" icon="calendar-days">
    **Format:** `[DateTime] Day Month Year`

    **Input:** ISO datetime format (YYYY-MM-DDTHH:MM:SS)

    **Examples:**

    ```
    2024-12-25T14:30:00 → "Twenty-fifth December Twenty twenty-four"
    2024-01-01T09:00:00 → "First January Twenty twenty-four"
    ```
  </Accordion>
</AccordionGroup>

***

## CRM Integration Sourcing

Pull variable values from your integrated CRM systems.

### Supported Integrations

<Tabs>
  <Tab title="LeadSquared">
    **Purpose:** Source customer data from LeadSquared CRM

    **Setup:**

    1. Connect LeadSquared integration
    2. Select variable
    3. Choose "LeadSquared" as source
    4. Select field from dropdown (auto-loaded from your LeadSquared)
  </Tab>

  <Tab title="HubSpot">
    **Purpose:** Source customer data from HubSpot CRM

    **Setup:**

    1. Connect HubSpot integration
    2. Select variable
    3. Choose "HubSpot" as source
    4. Select property from dropdown (auto-loaded from your HubSpot)
  </Tab>
</Tabs>

***

## Configuration

<Steps>
  <Step title="Navigate to Variable Source">
    In your agent configuration, find the **Variable Source and Pre Format** section

    <Note>
      Variables from your system prompt (like `{{customer_name}}`) automatically appear in the list
    </Note>
  </Step>

  <Step title="Click Edit on a Variable">
    Click the **Edit** button next to any variable you want to configure
  </Step>

  <Step title="Set Format">
    **Format:** Choose how the variable should be spoken

    * Select "No" for no formatting (default)
    * Select appropriate format based on data type

    **Examples:**

    * `order_amount` → `[Number] Full Words`
    * `appointment_date` → `[Date] Day Month Year`
    * `delivery_time` → `[Time] Hour Minute AM/PM`
  </Step>

  <Step title="Set Source (Optional)">
    If you have CRM integrations:

    **Source:** Select integration (LeadSquared, HubSpot, etc.)

    **Key Value:** Select the field from your CRM

    <Tip>
      If you don't select a source, the variable uses the value from call metadata (passed via API).
    </Tip>
  </Step>

  <Step title="Save">
    Click **"Save"** to apply the configuration
  </Step>
</Steps>

***

## Use Cases

### E-commerce Order Confirmation

**Variables:**

```
{{customer_name}}
Format: No
Source: LeadSquared → ProspectFirstName

{{order_amount}}
Format: [Number] Full Words
Source: (from call metadata)

{{delivery_date}}
Format: [Date] Day Month
Source: (from call metadata)
```

**Agent says:**
"Hi Rajesh, your order for two thousand five hundred rupees will be delivered on twenty-fifth December"

***

### Appointment Booking

**Variables:**

```
{{customer_name}}
Format: No
Source: HubSpot → firstname

{{appointment_date}}
Format: [DateTime] Sentence Without Year
Source: (from call metadata)
```

**Agent says:**
"Hello Sarah, your appointment is on fifteenth January at three thirty PM"

***

### Loan Application

**Variables:**

```
{{applicant_name}}
Format: No
Source: LeadSquared → ProspectFirstName

{{loan_amount}}
Format: [Number] Nearest Lakhs
Source: (from call metadata)

{{application_id}}
Format: No
Source: (from call metadata)
```

**Agent says:**
"Dear Amit, your loan application for five lakhs has been received. Your application ID is A-B-C-one-two-three-four"

***

## Best Practices

<AccordionGroup>
  <Accordion title="Match Format to Context" icon="bullseye">
    Choose formats that sound natural for your use case

    **Good:**

    * Price → `[Number] Full Words` ("two thousand five hundred")
    * Large numbers → `[Number] Nearest Lakhs` ("five lakhs")
    * Dates → `[Date] Day Month` ("twenty-fifth December")

    **Avoid:**

    * Price → `[Number] Nearest Hundreds` (sounds imprecise)
    * Appointment → `[Date] Day` only (missing month context)
  </Accordion>

  <Accordion title="Test Formatting" icon="vial">
    Use Test Call to hear how formatted variables sound

    **Process:**

    1. Configure format
    2. Run test call with sample data
    3. Listen to how agent speaks the value
    4. Adjust format if needed
  </Accordion>

  <Accordion title="Keep CRM Mappings Updated" icon="rotate">
    When CRM fields change:

    1. Review variable mappings
    2. Update field selections
    3. Test with live data
  </Accordion>

  <Accordion title="Use Consistent Formatting" icon="equals">
    Apply the same format to similar variables

    **Example:**

    ```
    order_amount → [Number] Full Words
    discount_amount → [Number] Full Words
    total_amount → [Number] Full Words
    ```
  </Accordion>
</AccordionGroup>

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="Variable not formatted" icon="text-slash">
    **Possible Causes:**

    * Format set to "No"
    * Variable value is not in expected format
    * Data type mismatch

    **Solutions:**

    1. Verify format is selected (not "No")
    2. Check variable value is correct type (number for number formats, date for date formats)
    3. Test with sample values
  </Accordion>

  <Accordion title="CRM field not loading" icon="database">
    **Issue:** Can't see CRM fields in dropdown

    **Causes:**

    * Integration not connected
    * Integration permissions issue
    * API connection problem

    **Solutions:**

    1. Verify CRM integration is connected in Integrations page
    2. Check integration has read permissions for contacts/leads
    3. Try reconnecting integration
    4. Contact support if persistent
  </Accordion>

  <Accordion title="Wrong value from CRM" icon="circle-xmark">
    **Issue:** Agent speaks wrong customer data

    **Causes:**

    * Wrong field mapped
    * Customer not found in CRM
    * Field empty in CRM

    **Solutions:**

    1. Verify correct CRM field is selected
    2. Check customer exists in CRM with matching phone/email
    3. Ensure CRM field has data
    4. Review call logs for CRM lookup results
  </Accordion>

  <Accordion title="Date sounds unnatural" icon="calendar-xmark">
    **Issue:** Date pronunciation is awkward

    **Examples:**

    ```
    Wrong format: "two zero two four twelve twenty-five"
    Right format: "twenty-fifth December twenty twenty-four"
    ```

    **Solution:**
    Use appropriate date format:

    * `[Date] Day Month Year` for full dates
    * `[Date] Day Month` for dates in current year
  </Accordion>
</AccordionGroup>

***

## Advanced Configuration

### Custom Variable Addition

You can add custom variables not in your system prompt:

<Steps>
  <Step title="Click + Button">
    Click the **"+"** button below the variable list
  </Step>

  <Step title="Enter Variable Name">
    Type the variable name (will be available as `{{variable_name}}`)
  </Step>

  <Step title="Configure Format and Source">
    Set format and CRM source as needed
  </Step>

  <Step title="Use in System Prompt">
    Add the variable to your system prompt to use it
  </Step>
</Steps>

***

## Getting Help

<CardGroup cols={2}>
  <Card title="Test Formatting" icon="vial">
    Use Test Call to verify variables are formatted and sourced correctly
  </Card>

  <Card title="Contact Support" icon="headset">
    Our team can help configure CRM integrations and variable formatting
  </Card>
</CardGroup>
