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

# Custom Integrations and Actions

> Description of your new file.

Custom integrations allow you to connect **any external API** to your Gnani Agents — perfect for unique workflows and advanced automation that go beyond built-in integrations.

***

## **1. Why Use Custom Integrations?**

With a custom integration, you can:

* Connect your agent to any API endpoint you control or have access to.
* Extend agent capabilities to trigger workflows in other systems.
* Handle use cases not covered by predefined integrations.

***

## **2. Set Up a Custom Integration**

1. **Open Integration Settings**
   * Go to **Add Custom Integration** in your Gnani Agents dashboard.
2. **Enter Basic Details**
   * **Integration Name**: Use letters, numbers, or underscores only.
   * **Description**: Briefly explain the integration’s purpose.
3. **Choose API Call Method & URL**
   * Select the **Method** (e.g., `GET`, `POST`, `PUT`, `DELETE`).
   * Enter the **API URL** where the request should be sent.
4. **Add Authentication (If Needed)**
   * If your API requires authentication, enter the **Key** and **Value**.
   * Example: `Key: Authorization   Value: Bearer <your-token> `
5. **Save Integration**
   * Click **Integrate** to complete the setup.

***

## **3. Create a Custom API Action**

1. **Navigate to Actions**
   * Go to **Manage Agents → Select Agent → Action Tab**.
2. **Create Action**
   * Click **+** to open the **Create Action** card.
3. **Fill in Details**
   * **Name:** Use only letters, numbers, or underscores.
   * **Description:** Describe when the action should trigger.
     * Example: *"Send lead details to the CRM when the user shares contact info."*
4. **Select Integration**
   * Choose your custom integration from the dropdown.
   * **Method & URL** will be pre-filled from the integration setup.
5. **Enable Request Components**
   * Based on your API method, you can **turn on/off**:
     * **Headers**: For sending additional information about your API request, such as authentication or metadata.
       * Example:`Key: Authorization   Value: Bearer <your-token> `
     * **Params**: For adding filters or modifying the request. You can add multiple key-value pairs.
       * Example:`Key: age   Value: 30 `will filter by age
     * **Body**: Data to send in the request (usually JSON).
       * Example:
         ```yaml theme={null}
         {
            "user_text": "{{user_text}}",
            "sender_id": "{{sender_id}}"
         }
         ```
       *
6. **Set Timout**
   * Define the maximum wait time (in seconds) before the request times out.
   * If the server doesn’t respond in time, the request fails with a timeout error.
7. **Choose Trigger**
   * **Post-Call:** Executes after the conversation ends.
     * If **Post-Call** is selected, you can:
       * Add **Variables** (sent to the API).
   * **On-Call:** Executes during the conversation.
     * If **On-Call** is selected, you can:
       * Write a message in the **Speak During Action** section.
       * Add **Before API Call Variables** (sent to the API).
       * Add **After API Call Variables** (received from the API).

***

## **4. Test Your Custom API Action**

1. **Open Testing Mode**
   * Go to **Manage Agents → Select Agent → Test**.
2. **Start a Test Conversation**
   * Speak or chat with your agent.
3. **Trigger the Action**
   * Use the same instructions or keywords from your Action’s **Description** to activate it.
4. **Check API Logs**
   * In Gnani Agents, click **More Options (⋮)** on the Action card → **View Logs**.
   * Review request/response details and confirm the API executed correctly.
5. **Validate in External System**
   * If your API triggers a process (e.g., record creation), check the connected system to confirm results.

***

✅ **Your Custom API integration is now ready!** You can now expand your agent’s abilities to virtually any API-enabled service.
