Overview

WhatsAppTransport enables real-time voice conversations between WhatsApp users and your Pipecat bot through the WhatsApp Business API. When users call your WhatsApp Business number, the transport handles webhook events, establishes WebRTC connections, and manages the voice call lifecycle. The transport integrates with Meta’s WhatsApp Cloud API to receive incoming calls, process WebRTC signaling, and maintain call state throughout the conversation.

Installation

To use WhatsAppTransport, install the required dependencies:
pip install "pipecat-ai[webrtc]"

Prerequisites

WhatsApp Business API Setup

Before using WhatsAppTransport, you need:
  1. WhatsApp Business API Account: Set up through Meta Developer Console
  2. Phone Number Configuration: Enable voice calling capability for your business number
  3. Webhook Configuration: Configure webhook endpoint to receive call events
  4. Access Tokens: Generate API access token and phone number ID
For development, Meta provides free test phone numbers valid for 90 days. Production use requires business verification.

Required Environment Variables

  • WHATSAPP_TOKEN: WhatsApp Business API access token
  • WHATSAPP_PHONE_NUMBER_ID: Your business phone number ID
  • WHATSAPP_WEBHOOK_VERIFICATION_TOKEN: Token for webhook verification

Key Features

  • Incoming Call Handling: Automatically accepts WhatsApp voice calls
  • WebRTC Integration: Establishes peer-to-peer audio connections
  • Webhook Processing: Handles Meta’s webhook events for call lifecycle
  • Call Management: Supports call acceptance, rejection, and termination
  • Real-time Audio: Bidirectional audio streaming for natural conversations

Usage

WhatsAppTransport requires a webhook server to handle incoming calls and a bot implementation to process the conversations. The transport works with SmallWebRTCTransport under the hood for WebRTC connectivity. See the complete example for a full implementation including:
  • FastAPI webhook server
  • WhatsApp client configuration
  • Bot integration with Pipecat pipeline
  • Environment setup and deployment