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

# Trigger Hooks

> Advanced automation system for triggering custom actions based on AI Sync events and conditions

# ⚡ Trigger Hooks

Trigger Hooks provide a powerful automation framework that executes custom actions when specific events occur in your AI Sync system. Unlike webhooks that send data to external endpoints, trigger hooks perform internal actions and workflows within your AI Sync environment.

## 🔄 Trigger Hook Workflow

<Steps>
  <Step title="Event Detection">
    System monitors for specified events (calls, agent actions, campaigns)
  </Step>

  <Step title="Condition Evaluation">
    Trigger conditions are evaluated against event data and context
  </Step>

  <Step title="Hook Execution">
    Qualifying events trigger the configured hook actions
  </Step>

  <Step title="Action Processing">
    Multiple actions can be executed sequentially or in parallel
  </Step>

  <Step title="Result Logging">
    Execution results and outcomes are logged for monitoring
  </Step>
</Steps>

## 📊 Trigger Hook vs Webhooks Comparison

<AccordionGroup>
  <Accordion title="🔗 Webhooks vs ⚡ Trigger Hooks">
    | Feature         | Webhooks                       | Trigger Hooks                          |
    | --------------- | ------------------------------ | -------------------------------------- |
    | **Purpose**     | Send data to external systems  | Execute internal actions               |
    | **Direction**   | Outbound HTTP requests         | Internal processing                    |
    | **Response**    | Depends on external endpoint   | Immediate internal execution           |
    | **Actions**     | Limited to HTTP calls          | Multiple action types available        |
    | **Latency**     | Network dependent              | Minimal internal latency               |
    | **Reliability** | External system dependent      | Internal system controlled             |
    | **Use Cases**   | CRM integration, notifications | Automation, data processing, workflows |
  </Accordion>
</AccordionGroup>

## 📋 Trigger Hook Management

Navigate to **Setup > Trigger Hooks** to manage your automation configurations.

<img src="https://mintcdn.com/rizler/6APbSrNTGGvRxRjC/images/setup/trigger-webhook/overview.png?fit=max&auto=format&n=6APbSrNTGGvRxRjC&q=85&s=724e04556702bf64aaf696dc803f0029" alt="Trigger Hook Management" width="1918" height="946" data-path="images/setup/trigger-webhook/overview.png" />

### 📑 Trigger Hook Table Overview

| Column         | Description                 | Example                                     |
| -------------- | --------------------------- | ------------------------------------------- |
| **#**          | Sequential hook ID          | `1`, `2`, `3`                               |
| **Title**      | Hook name/identifier        | `Lead Qualification`, `Follow-up Scheduler` |
| **Updated At** | Last modification timestamp | `09-09-2025 10:27 AM`                       |
| **Created At** | Hook creation timestamp     | `09-09-2025 10:23 AM`                       |
| **Action**     | Management options          | Edit, Delete, Duplicate, Test               |

### ⚡ Quick Actions

<CardGroup cols={3}>
  <Card title="Add New Hook" icon="plus">
    Create new trigger hooks for your automation needs
  </Card>

  <Card title="Edit Configuration" icon="pencil">
    Modify existing hook settings and conditions
  </Card>
</CardGroup>

## 🎛️ Trigger Hook Configuration

### 🆕 Creating a New Trigger Hook

<Steps>
  <Step title="Access Trigger Hooks">
    Navigate to Setup > Trigger Hooks and click "Add"
  </Step>

  <Step title="Basic Information">
    * **Title**: Descriptive name for the trigger hook
    * **Description**: Optional detailed description of the hook's purpose
    * **Status**: Enable/disable the hook
  </Step>

  <Step title="Trigger Configuration">
    * **Trigger When**: Select the event type that activates the hook
    * **Conditions**: Set up conditional logic for when the hook should execute
    * **Filters**: Apply additional filters based on data attributes
  </Step>

  <Step title="Action Configuration">
    * **Hook URL**: Internal or external endpoint to call
    * **Hook Method**: HTTP method (GET, POST, PUT, DELETE)
    * **Type**: Define the hook type and processing method
    * **Role**: Specify user role requirements for execution
  </Step>

  <Step title="Test and Activate">
    Test the trigger hook with sample data and activate for live events
  </Step>
</Steps>

<img src="https://mintcdn.com/rizler/PobD5hApuzSs5pw6/images/setup/trigger-webhook/add-new.png?fit=max&auto=format&n=PobD5hApuzSs5pw6&q=85&s=00e4442e942ce639d6b50126d162ba49" alt="Add Trigger Hook" width="1595" height="743" data-path="images/setup/trigger-webhook/add-new.png" />

### 🏷️ Field Definitions

<AccordionGroup>
  <Accordion title="📝 Basic Fields">
    **Title**

    * Purpose: Human-readable identifier for the trigger hook
    * Format: Text string (max 255 characters)
    * Example: "Lead Qualification Hook", "Follow-up Scheduler"

    **Description**

    * Purpose: Detailed explanation of hook functionality
    * Format: Text area (optional)
    * Example: "Automatically qualifies leads based on call sentiment and duration"
  </Accordion>

  <Accordion title="⚡ Trigger Configuration">
    **Trigger When**

    * Purpose: Defines the event that activates the hook
    * Options:
      * `Power List Dial 1 Time` - After first dial attempt
      * `Power List Dial 2 Times` - After second dial attempt
      * `Power List Dial 3 Times` - After third dial attempt
      * `Call Ended` - When any call completes
      * `Call Answered` - When call is answered
      * `Agent Response` - When AI agent responds
      * `Lead Generated` - When new lead is created
      * `Appointment Scheduled` - When appointment is booked
      * `SMS Sent/Received` - SMS events
      * `Campaign Started/Ended` - Campaign lifecycle events

    **Conditions**

    * Purpose: Additional logic to filter when hook executes
    * Format: Conditional expressions
    * Examples:
      * `call_duration > 60` (calls longer than 1 minute)
      * `sentiment == "positive"` (positive sentiment only)
      * `lead_score >= 80` (high-quality leads only)
  </Accordion>

  <Accordion title="🔗 Hook Configuration">
    **Hook URL**

    * Purpose: Endpoint URL to send hook data
    * Format: Valid HTTP/HTTPS URL
    * Examples:
      * `https://api.yourcrm.com/webhook/leads`
      * `https://app.hookk.com/webhook`
      * `https://internal.ai-sync.com/process-lead`

    **Hook Method**

    * Purpose: HTTP method for the hook request
    * Options: `GET`, `POST`, `PUT`, `DELETE`, `PATCH`
    * Default: `POST`
    * Usage: POST for creating data, PUT for updates, GET for queries

    **Type**

    * Purpose: Categorizes the hook for processing and organization
    * Options:
      * `Lead Processing` - Lead qualification and routing
      * `CRM Integration` - Customer relationship management
      * `Analytics` - Data analysis and reporting
      * `Notification` - Alerts and notifications
      * `Workflow` - Business process automation
      * `Other` - Custom or miscellaneous hooks
  </Accordion>

  <Accordion title="👤 Role & Security">
    **Role**

    * Purpose: Defines which user roles can trigger this hook
    * Options:
      * `Agent` - AI agents can trigger the hook
      * `Admin` - Administrator users only
      * `Manager` - Manager level and above
      * `User` - Any authenticated user
      * `System` - System-level automated triggers
    * Security: Ensures proper access control for sensitive operations
  </Accordion>
</AccordionGroup>

### 📝 Edit Trigger Hook

<img src="https://mintcdn.com/rizler/PobD5hApuzSs5pw6/images/setup/trigger-webhook/edit.png?fit=max&auto=format&n=PobD5hApuzSs5pw6&q=85&s=567380aa44c41cc1cc0716058b8d791d" alt="Edit Trigger Hook" width="1577" height="722" data-path="images/setup/trigger-webhook/edit.png" />

When editing existing trigger hooks, you can modify all configuration parameters while maintaining execution history and performance metrics.

## 🎪 Available Trigger Events

<CardGroup cols={2}>
  <Card title="Call Events" icon="phone">
    **Triggers**:

    * `Call Started/Ended/Answered`
    * `Power List Dial Attempts`
    * `Call Transferred`

    **Use Cases**:

    * Real-time monitoring
    * Progressive lead nurturing
    * CRM updates

    **Data**: Call status, duration, participant info, recordings
  </Card>

  <Card title="Agent Events" icon="robot">
    **Triggers**:

    * `Agent Response Generated`
    * `Escalation Required`
    * `Performance Threshold`

    **Use Cases**:

    * Quality monitoring
    * Performance optimization
    * Training triggers

    **Data**: Agent metrics, response content, conversation context
  </Card>

  <Card title="Lead Events" icon="user-plus">
    **Triggers**:

    * `Lead Generated/Qualified`
    * `Status/Score Changed`

    **Use Cases**:

    * CRM synchronization
    * Lead routing
    * Sales notifications

    **Data**: Demographics, qualification scores, interaction history
  </Card>

  <Card title="Campaign Events" icon="bullhorn">
    **Triggers**:

    * `Campaign Started/Completed`
    * `Milestone Reached`
    * `Performance Alert`

    **Use Cases**:

    * Performance monitoring
    * Budget management
    * Result processing

    **Data**: Campaign metrics, progress, ROI statistics
  </Card>

  <Card title="Appointment Events" icon="calendar">
    **Triggers**:

    * `Scheduled/Confirmed/Cancelled`
    * `Rescheduled`

    **Use Cases**:

    * Calendar integration
    * Reminder automation
    * No-show prevention

    **Data**: Appointment details, participant info, availability
  </Card>

  <Card title="Follow-up Events" icon="clock-rotate-left">
    **Triggers**:

    * `Follow-up Due`
    * `Task Created`
    * `Deadline Approaching`

    **Use Cases**:

    * Task automation
    * Deadline management
    * Customer retention

    **Data**: Task details, assigned members, due dates
  </Card>
</CardGroup>
