Skip to main content

Overview

WhatsApp Configuration allows your AI agent to automatically send WhatsApp templates or campaigns to customers either during the call (in-call) or after the call ends (post-call). This enables automated follow-ups, OTP delivery, booking confirmations, and more.
You must connect to a WhatsApp provider before configuring WhatsApp functions.

Prerequisites

Before setting up WhatsApp configuration:
  1. Connect WhatsApp Provider - Go to Integrations and connect one of:
    • WhatsApp (Facebook)
    • Heltar
    • AiSensy (Basic or Pro plan)
  2. Create Templates - Set up approved WhatsApp message templates in your provider dashboard
  3. Define Variables - If using post-call functions, configure post-call variables to extract data from conversations

Function Types

Purpose: Send WhatsApp messages while the conversation is activeUse Cases:
  • Send OTP for verification
  • Share booking links
  • Deliver payment URLs
  • Send documents/catalogs
Trigger: AI decides when to send based on your descriptionExample:
When: User confirms their phone number
Action: Send OTP via WhatsApp

Configuration

1

Navigate to WhatsApp Configuration

In your agent configuration, find the WhatsApp Configuration section
If you see “Please connect to any WhatsApp provider first”, go to Integrations page and connect a provider.
2

Click Add Function

Click the ”+ Add” button
3

Select Function Type

Choose when to send:
  • During the Call (in-call) - While conversation is active
  • After the Call (post-call) - When call ends
4

Name Your Function

Enter a unique name using lowercase snake_caseExample: send_otp, booking_confirmation, followup_message
5

Select Provider

If you have multiple WhatsApp providers, choose which one to use
6

Choose Template or Campaign

For WhatsApp/Heltar: Select from your approved templatesFor AiSensy Basic: Enter campaign name and add variables manuallyFor AiSensy Pro: Select from your campaigns
7

Map Variables

Map template placeholders to data sources:
  • Call Metadata - From prompt variables
  • Post-Call Variables - AI-extracted data (post-call only)
8

Define Trigger

For In-Call: Describe when AI should send the messageFor Post-Call: Set conditions based on variables
9

Save

Click “Save” to activate the function

Provider-Specific Configuration

Templates: Uses officially approved WhatsApp Business API templatesSetup:
  1. Select template from dropdown
  2. View template preview
  3. Map variables to data sources
Note: Only APPROVED templates appear in the list
Templates: Uses Heltar platform templatesSetup:
  1. Select template from dropdown
  2. View template preview
  3. Map variables to data sources
Advantage: Faster template approval process
Campaigns: Manual campaign configurationSetup:
  1. Enter campaign name
  2. Manually add variables ({{1}}, {{2}}, etc.)
  3. Map each variable to data source
Use When: You have basic AiSensy plan
Campaigns: Full campaign managementSetup:
  1. Select campaign from dropdown
  2. View template preview
  3. Auto-detected variables appear
  4. Map variables to data sources
Advantage: Rich campaign features and analytics

Variable Mapping

Map template placeholders to dynamic values:

Data Sources

Purpose: Data from prompt variables or call setupAvailable Fields:
  • Custom metadata fields
  • Any {{variable}} in your system prompt
Example:
Template: "Hello {{1}}, your order {{2}} is confirmed"
Mapping:
{{1}} → Call Metadata → customer_name
{{2}} → Call Metadata → order_id

In-Call Functions

Send messages during active conversations.

When to Use

Scenario: User needs verification codeConfiguration:
Function Name: send_otp
Template: "Your OTP is {{1}}. Valid for 5 minutes."
Variables: {{1}} → Call Metadata → otp_code
When to Call: After user confirms their phone number and requests OTP

Trigger Description Best Practices

Good Examples:
"Send OTP after user confirms their mobile number and requests verification code"

"Share booking link when customer asks for it or shows interest in scheduling"

"Send payment URL after order is confirmed and user agrees to pay online"
Avoid:
"Send OTP" (too vague)
"When needed" (not specific)

Post-Call Functions

Send messages after the call ends based on conditions.

Conditional Execution

Post-call functions use conditions to determine when to send: Simple Condition:
Source: Post-Call Variables
Variable: appointment_booked
Value: true
Multiple Conditions (AND logic):
Condition 1: appointment_booked = true
Condition 2: customer_type = new_customer
Result: Send only if BOTH are true

Use Cases

Scenario: Customer booked an appointmentConfiguration:
Function Name: appointment_confirmation
Template: "Hi {{1}}! Your appointment is confirmed for {{2}} at {{3}}. 
           Location: {{4}}. See you soon!"
Variables:
  {{1}} → Call Metadata → customer_name
  {{2}} → Post-Call Variables → appointment_date
  {{3}} → Post-Call Variables → appointment_time  
  {{4}} → Call Metadata → clinic_address

Conditions:
  - appointment_booked = true
Scenario: Customer placed an orderConfiguration:
Function Name: order_summary
Template: "Thank you {{1}}! Your order #{{2}} for ₹{{3}} is confirmed. 
           Delivery by {{4}}. Track: {{5}}"
Variables:
  {{1}} → Call Metadata → customer_name
  {{2}} → Post-Call Variables → order_id
  {{3}} → Post-Call Variables → order_amount
  {{4}} → Post-Call Variables → delivery_date
  {{5}} → Call Metadata → tracking_url

Conditions:
  - order_placed = true
Scenario: Customer interested but didn’t convertConfiguration:
Function Name: followup_interested
Template: "Hi {{1}}! Thanks for your interest in {{2}}. 
           Here's more info: {{3}}. Reply if you have questions!"
Variables:
  {{1}} → Call Metadata → customer_name
  {{2}} → Post-Call Variables → product_name
  {{3}} → Call Metadata → product_brochure_url

Conditions:
  - interested = true
  - purchased = false
Scenario: Call completed successfullyConfiguration:
Function Name: request_feedback
Template: "Hi {{1}}! We hope we could help you today. 
           Please rate your experience: {{2}}"
Variables:
  {{1}} → Call Metadata → customer_name
  {{2}} → Call Metadata → feedback_url

Conditions:
  - call_duration > 30 (seconds)
  - issue_resolved = true

Best Practices

Ensure all templates are approved by WhatsApp before using them in production.Why: Unapproved templates will fail to sendCheck: Template status in your provider dashboard
Every placeholder in your template must be mapped to a data source.System validates:
  • All variables have a source
  • All variables have a selected field
Unmapped variables will prevent saving
Before going live:
  1. Use Test Call feature
  2. Trigger the WhatsApp function
  3. Check that correct values are extracted
  4. Verify message is sent with right data
WhatsApp templates have character limits and formatting rules.Tips:
  • Keep messages under 1024 characters
  • Use clear, simple language
  • Include only essential information
Function names should clearly describe their purpose.Good: send_otp, booking_confirmation, order_summaryBad: func1, wa_msg, test
For post-call functions, make conditions as specific as needed.Example:
Too broad: Send to everyone
Better: Send only if appointment_booked = true
Best: Send if appointment_booked = true AND call_duration > 60

Examples by Industry

E-commerce

Order Confirmation (Post-Call):
Template: "Hi {{1}}! Order #{{2}} confirmed. Amount: ₹{{3}}. 
           Delivery: {{4}}. Track: {{5}}"
Variables:
  {{1}} → customer_name
  {{2}} → order_id  
  {{3}} → order_amount
  {{4}} → delivery_date
  {{5}} → tracking_link
Conditions: order_placed = true

Healthcare

Appointment Reminder (Post-Call):
Template: "Hello {{1}}, your appointment with Dr. {{2}} is on {{3}} at {{4}}. 
           Location: {{5}}. Call us if you need to reschedule."
Variables:
  {{1}} → patient_name
  {{2}} → doctor_name
  {{3}} → appointment_date
  {{4}} → appointment_time
  {{5}} → clinic_address
Conditions: appointment_booked = true

Real Estate

Property Details (In-Call):
Template: "Hi {{1}}! Here are details for {{2}}: {{3}}. 
           Schedule a viewing: {{4}}"
Variables:
  {{1}} → customer_name
  {{2}} → property_name
  {{3}} → property_details_url
  {{4}} → booking_link
When: Customer asks for property details or viewing link

Financial Services

Loan Application Status (Post-Call):
Template: "Dear {{1}}, your loan application {{2}} is {{3}}. 
           Next steps: {{4}}. Questions? Reply here."
Variables:
  {{1}} → applicant_name
  {{2}} → application_id
  {{3}} → application_status
  {{4}} → next_steps
Conditions: application_submitted = true

Troubleshooting

For In-Call:
  • Description too vague
  • AI doesn’t recognize trigger
Solutions:
  • Make description more specific
  • Test with explicit phrases
  • Add more trigger keywords
For Post-Call:
  • Conditions not met
  • Variables not extracted
Solutions:
  • Check condition values
  • Verify variables were extracted in call log
  • Review post-call analysis
Possible Causes:
  • Template not approved
  • Provider integration disconnected
  • Invalid customer phone number
  • Variables not mapped correctly
Solutions:
  1. Check template status in provider dashboard
  2. Verify provider connection in Integrations
  3. Ensure phone number is valid WhatsApp number
  4. Review variable mappings
Issue: Message sends but with incorrect valuesCauses:
  • Wrong variable mapping
  • Variable not extracted correctly
  • Field name typo
Solutions:
  1. Review variable mappings
  2. Check post-call analysis for extracted values
  3. Verify field names match exactly
Common Issues:
  • Function name already exists
  • Invalid name format (use snake_case)
  • Unmapped variables
  • Missing required fields
Solutions:
  1. Use unique name
  2. Follow snake_case format (e.g., send_otp)
  3. Map all template variables
  4. Fill all required fields
For Basic Plan:
  • Ensure campaign name is correct
  • Add all variables manually
  • Map each variable
For Pro Plan:
  • Select campaign from dropdown
  • Campaign must be active
  • Template must have correct variables
Check: AiSensy dashboard for campaign status

Advanced Tips

Dynamic Content

Use call metadata to personalize messages:
Template: "Hi {{1}}! Based on your interest in {{2}}, 
           we recommend {{3}}. Details: {{4}}"

Variables:
  {{1}} → customer_name (from metadata)
  {{2}} → discussed_product (from post-call)
  {{3}} → recommended_product (from metadata - set via API)
  {{4}} → product_url (from metadata)

Multi-Language Support

Create separate functions for each language:
Function 1: booking_confirmation_en
Template: "Your appointment is on {{1}} at {{2}}"

Function 2: booking_confirmation_hi  
Template: "आपकी अपॉइंटमेंट {{1}} को {{2}} बजे है"

Conditions: Both check appointment_booked = true

Conditional Follow-Ups

Chain post-call functions with different conditions:
Immediate Confirmation:
Conditions: order_placed = true
Template: "Order confirmed! Details below..."

Follow-Up (24h later):
Conditions: order_placed = false AND interested = true
Template: "Still interested? Here's a special offer..."

Getting Help

Test Your Functions

Use Test Call to verify WhatsApp functions send correctly with proper data

Contact Support

Our team can help optimize your WhatsApp automation strategy