> ## 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.

# Post-Call WhatsApp

> Send WhatsApp messages after calls end

## Overview

Post-call WhatsApp functions send messages **after** AI calls end. You control exactly when messages send using conditions.

**Common Use Cases:**

* Appointment confirmations
* Booking details
* Follow-up surveys
* Next steps documentation
* Thank you messages

## How It Works

```
[Call Ends] → [Conditions Checked] → [If Match: WhatsApp Message Sent]
```

Messages only send when all your conditions match (AND logic).

## Configuration

<img src="https://mintcdn.com/callkaroai/n3GQgJELQTnqC5vq/images/whatsapp/post-call.png?fit=max&auto=format&n=n3GQgJELQTnqC5vq&q=85&s=295639f4ee9c036a3f72a9aa50e968e7" alt="Post-Call WhatsApp" width="2880" height="1622" data-path="images/whatsapp/post-call.png" />

<Steps>
  <Step title="Navigate to WhatsApp Tab">
    Go to your agent → WhatsApp configuration
  </Step>

  <Step title="Click Add">
    Click the Add button to create a new function
  </Step>

  <Step title="Select Type">
    Choose "After the Call (post-call)"
  </Step>

  <Step title="Enter Function Name">
    Use snake\_case (e.g., `appointment_confirmation`)
  </Step>

  <Step title="Select Provider">
    Choose WhatsApp provider (Facebook, Heltar, or AI Sensy)
  </Step>

  <Step title="Select Template">
    Choose your WhatsApp message template
  </Step>

  <Step title="Map Variables">
    Connect template placeholders to call data
  </Step>

  <Step title="Set Conditions">
    Define when to send the message
  </Step>

  <Step title="Save">
    Save the function
  </Step>
</Steps>

## Variable Sources

Post-call functions can use three variable sources:

### 1. Call Metadata

Customer information from your system.

**Example:**

* `customer_name`
* `customer_email`
* `lead_id`

### 2. Post-Call Variables

AI-extracted data from the call conversation.

**Example:**

* `appointment_date` - Date customer selected
* `appointment_time` - Time customer selected
* `interested` - Whether customer showed interest
* `confirmation` - Whether customer confirmed

### 3. Static Values

Fixed text that doesn't change.

**Example:**

* Company name
* Support contact
* Website URL

<Card title="Variable Mapping Guide" icon="code-branch" href="/agents/whatsapp/variable-mapping">
  Detailed guide on mapping template variables
</Card>

## Conditional Sending

Control when post-call messages send using conditions.

### Call Type Filter

**Options:**

* **All** - Send for all calls (default)
* **Connected** - Only send for connected calls (duration > 0)
* **Not Connected** - Only send for missed/failed calls

### Variable Conditions

Add conditions based on:

* **Call Metadata** - Customer data fields
* **Post-Call Variables** - AI-extracted information

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

**Example Conditions:**

* Call Type: **Connected**
* Post-Call Variable: `appointment_booked` equals `true`
* Call Metadata: `lead_source` equals `"website"`

<Card title="Conditional Triggers" icon="filter" href="/agents/whatsapp/conditional-triggers">
  Complete guide on conditional message sending
</Card>

## Example: Appointment Confirmation

**Function Name:** `appointment_confirmation`

**Template:** (WhatsApp template with 3 variables)

```
Hi {{1}}, your appointment is confirmed for {{2}} at {{3}}.

We'll see you then!
Reply CANCEL to cancel.
```

**Variable Mapping:**

* `{{1}}` → Call Metadata: `customer_name`
* `{{2}}` → Post-Call Variables: `appointment_date`
* `{{3}}` → Post-Call Variables: `appointment_time`

**Conditions:**

* Call Type: **Connected** (only for successful calls)
* Post-Call Variable: `appointment_booked` equals `true`

**Result:**
Message only sends when:

1. Call was connected (customer answered)
2. AND appointment was actually booked

## Example: Follow-Up Survey

**Function Name:** `satisfaction_survey`

**Template:**

```
Thanks for speaking with us, {{1}}!

Please rate your experience: [Survey Link]
```

**Variable Mapping:**

* `{{1}}` → Call Metadata: `customer_name`

**Conditions:**

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

## Provider-Specific Notes

### WhatsApp (Facebook)

* Templates must be **approved** by Meta
* Create in Meta Business Manager
* Only APPROVED templates available

### Heltar

* Templates from Heltar dashboard
* No Meta approval needed

### AI Sensy

**Basic Plan:**

* Enter campaign name manually
* Add variables as needed

**Pro Plan:**

* Select from existing campaigns
* Variables from campaign template

## Best Practices

* **Add conditions** - Don't send to everyone, be selective
* **Connected calls** - Usually filter for connected calls only
* **Verify data** - Ensure post-call variables exist before using
* **Clear templates** - Make messages actionable
* **Add opt-out** - Include unsubscribe option for marketing messages
* **Test conditions** - Verify messages send when expected

<Tip>
  Start with simple conditions (connected calls + one variable), then add more as needed.
</Tip>

## Multiple Messages

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

**Example Setup:**

1. **Booking Confirmation** - Only when `appointment_booked = true`
2. **Not Interested Follow-Up** - Only when `interested = false`
3. **Callback Request** - Only when `callback_requested = true`

Each function sends independently based on its own conditions.
