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.WhatsApp API Reference
API methods for Pipecat’s WhatsApp Cloud API integration
WhatsApp Client Reference
Pipecat’s Client for handling webhooks and WebRTC connections
Example Implementation
Complete WhatsApp voice bot example
WhatsApp Business API Docs
Meta’s official WhatsApp calling documentation
Installation
To use WhatsAppTransport, install the required dependencies:Prerequisites
WhatsApp Business API Setup
Before using WhatsAppTransport, you need:- WhatsApp Business API Account: Set up through Meta Developer Console
- Phone Number Configuration: Enable voice calling capability for your business number
- Webhook Configuration: Configure webhook endpoint to receive call events
- 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 tokenWHATSAPP_PHONE_NUMBER_ID
: Your business phone number IDWHATSAPP_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 withSmallWebRTCTransport
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