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

# AI Agent Scripts: Configure Your Scalysis Calling Agent

> Scripts define how your AI agent behaves on every call. Learn how to find your scriptId, pass required variables, and prepare for production use.

Scripts are the core configuration behind every AI-powered call in Scalysis. Each script defines how your AI agent introduces itself, what it says, how it handles objections, and what outcome labels it assigns after a conversation ends. Before you trigger a single call or launch a campaign, you need a script — and understanding how scripts work will save you from common integration errors.

## Finding Your Script ID

Every script is identified by a numeric `scriptId` (for example, `2207`). You assign this ID when triggering a call or creating a campaign so that Scalysis knows which AI agent configuration to use.

To locate your `scriptId`:

1. Log in to your Scalysis dashboard at [app.scalysis.com](https://app.scalysis.com).
2. Navigate to **Agents → Scripts** in the left sidebar.
3. Find the script you want to use. The `scriptId` is displayed alongside the script name in the list.

Copy this number — you will pass it as the `scriptId` field in your API requests.

## Script Variables

Some scripts are designed to be reusable across multiple brands or campaigns. To support this, scripts can declare **required variables** that must be supplied at call time. The most common example is `brand_name`, which lets a single script speak on behalf of different brands without duplicating the entire configuration.

If you trigger a call without providing all required variables, the API will respond with an error:

```json theme={null}
{
  "success": false,
  "message": "Missing required script variables: brand_name"
}
```

### Passing Variables in the Trigger Payload

Include a `scriptVariables` object in your call trigger request to satisfy any required fields:

```json theme={null}
{
  "scriptId": 2207,
  "phone": "+911234567890",
  "orderNumber": "ORD-9001",
  "scriptVariables": {
    "brand_name": "Acme Store"
  }
}
```

The keys inside `scriptVariables` must match exactly the variable names declared in your script configuration. Check the script detail page in the dashboard if you are unsure which variables are required.

<Tip>
  Test your script from the Scalysis dashboard before wiring it into a production integration. The dashboard lets you place a live test call so you can verify the agent's tone, phrasing, and variable substitution before any real customers are dialled.
</Tip>
