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

# Context Variables

> Personalize conversations with dynamic data

## What Are Context Variables?

Context variables let you personalize each call with dynamic information. Instead of generic conversations, your agent can address callers by name, reference their account details, or mention specific products they've purchased.

## How It Works

When you trigger a call (via campaign or API), you pass context data that the agent uses during the conversation.

**Example**: Instead of saying "Hello, how can I help you?", the agent says "Hello John, I'm calling about your order #12345."

## Using Context Variables

### In the Workflow Editor

Reference variables using double curly braces:

```
Hello {{ customer_name }}, this is {{ agent_name }} from {{ company_name }}.
I'm calling about your recent {{ product_name }} purchase.
```

### Available Variables

Common variables you can use:

| Variable                 | Description          | Example        |
| ------------------------ | -------------------- | -------------- |
| `{{ customer_name }}`    | Caller's name        | "John Smith"   |
| `{{ company_name }}`     | Your company name    | "Acme Corp"    |
| `{{ agent_name }}`       | Agent's persona name | "Sarah"        |
| `{{ appointment_date }}` | Scheduled date       | "January 15th" |
| `{{ order_number }}`     | Order reference      | "#12345"       |

### Custom Variables

You can define any custom variable. Just use it in your workflow and provide the value when triggering calls.

**Example workflow text**:

```
Hi {{ first_name }}, I noticed you left items in your cart,
including {{ cart_item }}. Would you like to complete your purchase?
```

**Data you provide**:

```json theme={null}
{
  "first_name": "Marie",
  "cart_item": "the blue running shoes"
}
```

## Passing Variables

### Via Campaigns

When uploading a CSV for campaigns, each column becomes a variable:

```csv theme={null}
phone_number,first_name,appointment_date,doctor_name
+33612345678,Jean,15 janvier,Dr. Martin
+33698765432,Marie,16 janvier,Dr. Dupont
```

These become `{{ first_name }}`, `{{ appointment_date }}`, and `{{ doctor_name }}` in your workflow.

### Via API

<Note>
  Vous pouvez déclencher des appels et passer des variables de contexte via l'API. L'accès est disponible sur demande — contactez notre équipe pour obtenir vos identifiants.
</Note>

## Best Practices

<CardGroup cols={2}>
  <Card title="Provide Fallbacks" icon="shield">
    Handle missing data gracefully with fallback syntax
  </Card>

  <Card title="Keep It Natural" icon="comment">
    Don't overload conversations with too many variables
  </Card>

  <Card title="Test Variations" icon="flask">
    Test with different data to ensure natural flow
  </Card>

  <Card title="Verify Data Quality" icon="check">
    Ensure your data source has clean, accurate information
  </Card>
</CardGroup>

## Common Use Cases

### Appointment Reminders

```
Hi {{ patient_name }}, this is a reminder about your appointment
with {{ doctor_name }} on {{ appointment_date }} at {{ appointment_time }}.
```

### Order Follow-ups

```
Hello {{ customer_name }}, your order {{ order_number }} was delivered on
{{ delivery_date }}. Are you satisfied with your {{ product_name }}?
```

### Lead Qualification

```
Hi {{ lead_name }}, I'm following up on your interest in {{ product_name }}.
You mentioned you're looking for {{ use_case }}. Is that still the case?
```

## Next Steps

* [Run a campaign with personalized calls](/features/campaigns)
* [Learn workflow best practices](/workflows/best-practices)
