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

# Custom Variables

> Personalize conversations with dynamic variables

## What are Custom Variables?

Custom variables allow you to personalize each conversation by dynamically inserting customer-specific information into your agent's dialogue.

## Default Variables

Every agent comes with two pre-configured variables:

| Variable        | Description     | Example       |
| --------------- | --------------- | ------------- |
| `callee_name`   | Customer's name | John Doe      |
| `mobile_number` | Phone number    | +919876543210 |

## Creating Custom Variables

<Steps>
  <Step title="Open Agent Configuration">
    Navigate to your agent's configuration page
  </Step>

  <Step title="Find Custom Variables Section">
    Scroll to the Custom Variables section
  </Step>

  <Step title="Add New Variable">
    Click "Add Variable" and provide: - **Variable Name**: Use descriptive names
    (e.g., `appointment_date`, `order_number`) - **Default Value**: Optional
    fallback value
  </Step>

  <Step title="Save Changes">
    Save your agent configuration
  </Step>
</Steps>

## Using Variables in Conversations

Reference variables in your prompts using curly braces:

```plaintext theme={null}
Hello {callee_name}, I'm calling about your appointment on {appointment_date}.
Your order number is {order_number}.
```

During the call, variables are automatically replaced:

```plaintext theme={null}
Hello John Doe, I'm calling about your appointment on January 15th, 2025.
Your order number is ORD001.
```

## Variable Naming Guidelines

<CardGroup cols={2}>
  <Card title="Use Descriptive Names" icon="tag">
    `appointment_date` not `var1`
  </Card>

  <Card title="Use Underscores" icon="minus">
    `order_number` not `order-number` or `orderNumber`
  </Card>

  <Card title="Lowercase Only" icon="font-case">
    `customer_id` not `Customer_ID`
  </Card>

  <Card title="No Special Characters" icon="ban">
    Avoid spaces, @, #, etc.
  </Card>
</CardGroup>

## Common Use Cases

### Appointment Reminders

```plaintext theme={null}
Variables: appointment_date, appointment_time, doctor_name

Greeting: "Hello {callee_name}, this is a reminder about your appointment
with Dr. {doctor_name} on {appointment_date} at {appointment_time}."
```

### Order Confirmations

```plaintext theme={null}
Variables: order_number, order_total, delivery_date

Message: "Your order #{order_number} totaling ₹{order_total} will be
delivered on {delivery_date}."
```

### Payment Reminders

```plaintext theme={null}
Variables: invoice_number, amount_due, due_date

Message: "This is a reminder that invoice {invoice_number} for ₹{amount_due}
is due on {due_date}."
```

### Survey Responses

```plaintext theme={null}
Variables: product_name, purchase_date, transaction_id

Message: "We'd love your feedback on {product_name} that you purchased on
{purchase_date}. Your transaction ID is {transaction_id}."
```

## CSV Integration

Custom variables must be included as columns in your campaign CSV:

```csv theme={null}
callee_name,mobile_number,appointment_date,doctor_name
John Doe,+919876543210,Jan 15,Smith
Jane Smith,+911234567890,Jan 16,Johnson
```

<Warning>
  CSV column names must exactly match your variable names (case-sensitive)
</Warning>

## Best Practices

<AccordionGroup>
  <Accordion title="Start with Essential Variables">
    Don't create too many variables initially. Start with 3-5 essential ones and add more as needed.
  </Accordion>

  <Accordion title="Use Clear Names">
    Future you (and your team) will thank you for using self-explanatory variable
    names.
  </Accordion>

  <Accordion title="Provide Default Values">
    Set sensible defaults for variables in case CSV data is missing or invalid.
  </Accordion>

  <Accordion title="Test with Sample Data">
    Before launching a campaign, test your agent with sample variable values to
    ensure proper formatting.
  </Accordion>

  <Accordion title="Document Your Variables">
    Keep a list of all variables and their purposes for team reference.
  </Accordion>
</AccordionGroup>

## Variable Validation

The platform validates:

* Variable names match between agent and CSV
* Required variables have values
* Data types are appropriate

<Tip>Test your CSV with a small batch before full campaign launch</Tip>

## Troubleshooting

<AccordionGroup>
  <Accordion title="Variable Not Replacing">
    * Check variable name spelling in agent configuration
    * Verify CSV column name matches exactly
    * Ensure curly braces syntax: `{variable_name}`
  </Accordion>

  <Accordion title="Empty Variable Values">
    * Check CSV data for that contact - Verify column is not empty - Set default
      value in agent configuration as fallback
  </Accordion>

  <Accordion title="CSV Column Mismatch">
    * CSV column names must match variable names exactly
    * Case-sensitive: `appointment_date` ≠ `Appointment_Date`
    * No extra spaces in column names
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="CSV Format Guide" icon="file-csv" href="/campaigns/csv-format">
    Learn CSV formatting with variables
  </Card>

  <Card title="Create Campaign" icon="rocket" href="/campaigns/creating-campaigns">
    Launch a campaign with custom variables
  </Card>
</CardGroup>
