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

# Conditional Triggers

> Control when post-call WhatsApp messages send

## Overview

Conditional triggers let you control exactly **when** post-call WhatsApp messages send. Instead of sending after every call, messages only send when all conditions match.

<Note>
  Conditional triggers only apply to **post-call** WhatsApp functions. In-call functions use AI-triggered descriptions instead.
</Note>

<img src="https://mintcdn.com/callkaroai/n3GQgJELQTnqC5vq/images/whatsapp/condition-mapping.png?fit=max&auto=format&n=n3GQgJELQTnqC5vq&q=85&s=3da65f405b89331c00cbbd40f33ca616" alt="Condition Mapping" width="2880" height="1626" data-path="images/whatsapp/condition-mapping.png" />

## How It Works

**Logic:** All conditions must match (AND logic)

```
Call Ends → Check Call Type → Check Conditions → If ALL Match: Send Message
```

## Call Type Filter

Filter messages by call connection status:

### Options

**All (Default)**

* Send for all calls
* Connected and not connected

**Connected**

* Only send when call was answered
* `call_duration > 0`
* Customer spoke with AI

**Not Connected**

* Only send for missed/failed calls
* `call_duration = 0`
* Voicemail, busy, no answer

### Use Cases

**Connected Only:**

* Appointment confirmations (only if booked)
* Survey links (only for completed calls)
* Thank you messages (only after conversation)

**Not Connected:**

* Missed call follow-up
* "We tried to reach you" messages
* Callback request confirmations

## Variable Conditions

Add conditions based on call data. Messages only send when values match exactly.

### Condition Sources

**1. Call Metadata**
Customer data from your system.

**Example Conditions:**

* `lead_source` equals `"website"`
* `customer_type` equals `"premium"`
* `region` equals `"west"`

**2. Post-Call Variables**
AI-extracted data from conversation.

**Example Conditions:**

* `appointment_booked` equals `true`
* `interested` equals `true`
* `confirmation` equals `true`
  -`objection_type` equals `"price"`

### Adding Conditions

<Steps>
  <Step title="Click Add Variable">
    In the "When should this function be called?" section
  </Step>

  <Step title="Select Source">
    Choose Call Metadata or Post-Call Variables
  </Step>

  <Step title="Select Field">
    Choose which field to check
  </Step>

  <Step title="Enter Value">
    Enter the value to match (equals comparison)
  </Step>

  <Step title="Add More">
    Repeat to add multiple conditions (all must match)
  </Step>
</Steps>

## Condition Examples

### Example 1: Appointment Confirmation

**Send only when:**

* Call Type: **Connected**
* Post-Call Variable: `appointment_booked` equals `true`

**Result:**
Message sends only if:

1. Customer answered the call
2. AND appointment was actually booked

### Example 2: Not Interested Follow-Up

**Send only when:**

* Call Type: **Connected**
* Post-Call Variable: `interested` equals `false`
* Call Metadata: `lead_source` equals `"referral"`

**Result:**
Message sends only if:

1. Customer answered
2. AND showed no interest
3. AND came from referral program

### Example 3: Missed Call Message

**Send only when:**

* Call Type: **Not Connected**

**Result:**
Message sends for all missed/unanswered calls.

### Example 4: Premium Customer Survey

**Send only when:**

* Call Type: **Connected**
* Call Metadata: `customer_type` equals `"premium"`
* Post-Call Variable: `call_completed` equals `true`

**Result:**
Message sends only if:

1. Call was connected
2. AND customer is premium tier
3. AND call reached natural completion

## AND Logic

All conditions must match for message to send.

**Example:**

```
Condition 1: interested = true
Condition 2: appointment_booked = true
Condition 3: Call Type = Connected

Message sends ONLY when ALL THREE are true
```

**If any condition fails:**

```
interested = true ✅
appointment_booked = false ❌
Call Type = Connected ✅

Message WILL NOT send (one failed)
```

## Boolean Variables

For true/false post-call variables:

**Options:**

* `true`
* `false`

**Example:**

* `interested` equals `true` - Send only when interested
* `callback_requested` equals `true` - Send only when callback wanted

## Use Cases

### Confirmation Messages

**When to send:**

* Connected calls only
* When action was completed

**Conditions:**

```
Call Type: Connected
appointment_booked: true
```

### Follow-Up Surveys

**When to send:**

* Connected calls only
* Call was completed successfully

**Conditions:**

```
Call Type: Connected
call_completed: true
```

### Callback Requests

**When to send:**

* Connected or not connected
* Customer requested callback

**Conditions:**

```
Call Type: All
callback_requested: true
```

### Sales Follow-Up

**When to send:**

* Connected calls
* Customer showed interest
* No immediate purchase

**Conditions:**

```
Call Type: Connected
interested: true
purchased: false
```

## Best Practices

* **Start simple** - Begin with call type + one variable
* **Test thoroughly** - Make test calls to verify conditions
* **Use connected filter** - Most messages should filter for connected calls
* **Verify variables exist** - Ensure post-call variables are configured
* **Monitor delivery** - Check if messages send as expected
* **Add escape conditions** - Don't send if already sent elsewhere

<Tip>
  Create different functions for different scenarios rather than one complex function with many conditions.
</Tip>

## Multiple Functions

You can create multiple post-call WhatsApp functions, each with different conditions:

**Example Setup:**

**Function 1:** `appointment_confirmation`

* Connected + `appointment_booked = true`

**Function 2:** `interested_follow_up`

* Connected + `interested = true` + `appointment_booked = false`

**Function 3:** `not_interested_feedback`

* Connected + `interested = false`

**Function 4:** `missed_call_message`

* Not Connected

Each sends independently based on its own conditions.
