## Overview

Actions let you define and reuse API/webhook calls to external systems. Think of them as building blocks for your assistant’s advanced capabilities. If your Scenario needs to interact with other tools or systems, you’ll use an **API Call Step** powered by an Action.

**Using Templates?** Pre-built [Scenario templates](https://docs.replify.ai/assistant-setup/scenarios-overview#templates) automatically create and configure Actions for popular integrations like Cal.com. When you use a template, the necessary Actions are already set up and ready to use, though you can still edit them to customize the configuration.

## When to Use Actions

Use an Action when your assistant needs to:

- Trigger a webhook to another app
- Retrieve data from a third-party API
- Update your CRM or lead database
- Schedule, reschedule, or cancel appointments

## Creating a New Action

When you add an **API Call** step to a Scenario, you’ll be prompted to either:

- Select an existing Action, or
- Create a new one

### Action Configuration Fields

| Field              | Description                                                                                                                                   |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| **Name**           | Internal name for the action (e.g. `SendToCRM`, `CheckMembership`); used in the Scenario to trigger this action.                            |
| **API Endpoint**   | The external URL you’re calling (e.g. `https://api.yourtool.com/v1/leads`). Supports path parameters using curly braces like `/members/{id}` or `/campaigns/{campaignId}/contacts` |
| **Description**    | Optional helper text for teammates                                                                                                          |
| **Method**         | HTTP method: `GET`, `POST`, `PUT`, or `DELETE`                                                                                                |
| **Auth Header**    | Optional authentication header depending on auth type (e.g. x-api-key)                                                                       |
| **API Key**        | API key to authenticate; must be a long-lived API key                                                                                       |
| **Headers**        | Key-value pairs for authentication or content-type (e.g. `Authorization: Bearer {{org.apiToken}}`)                                          |
| **Parameters**     | Define path parameters, query parameters, and request body parameters. See [Parameters](https://docs.replify.ai/assistant-setup/advanced-actions#parameters) section below. |
| **Error Message**  | What should the AI Assistant say if the API call fails                                                                                      |

### Parameters

Parameters define the data your Action sends to the external API. How parameters are used depends on the HTTP method and parameter type:

#### Path Parameters

Path parameters (e.g., `{memberId}`, `{campaignId}`) are replaced directly in the URL path. If your API endpoint includes path parameters like `/campaigns/{campaignId}/contacts` or `/members/{id}`, they are automatically detected and added to the Parameters section. Configure each path parameter with a description that helps the AI Assistant understand what value to use. **Example:**

- **API Endpoint:** `https://api.example.com/campaigns/{campaignId}/contacts`
- A parameter named `campaignId` will automatically appear in the Parameters section
- Add a description like “The unique ID of the campaign”

#### Other Parameters

For **GET and DELETE requests**, parameters (other than path parameters) are included in the query string (e.g., `?startDate=2024-01-01&endDate=2024-01-31`). For **POST and PUT requests**, parameters (other than path parameters) are included in the request body as JSON. Define each parameter with a clear description so the AI Assistant knows what data to collect and send.

#### How Parameters Work

The AI Assistant dynamically determines values for all parameters based on:

- Information already collected in the conversation
- User responses to questions in your Scenario
- Data returned from previous Actions

The Action will not execute until all required parameter values are available. If a value is missing, the AI Assistant will ask the user for it or collect it from a previous step.

You can also pass in custom Assistant attributes. Define these at the Scenario level and then you can add the value for each Assistant.

## Editing or Deleting Actions

Actions can be edited from the **Actions Library** or from within a Scenario step.

- **Edits** are reflected in all Scenarios that use that Action
- **Deletion** is permanent and will break any Scenario using it

When you [clone a Scenario](https://docs.replify.ai/assistant-setup/build-a-scenario#managing-scenarios), all Actions used by that Scenario are automatically cloned along with it. This ensures your cloned Scenario works independently without affecting the original Scenario or its Actions.
