Prerequisites
Before installing the SDK, make sure you have:1
Node.js 16 or higher
The SDK requires Node.js version 16 or higher. Check your version:
2
WhatsApp Business Account
A verified WhatsApp Business account with API access through Meta Business.
3
Meta Developer Account
Access to Meta for Developers to create an app and get API credentials.
Package Installation
Install the SDK using your preferred package manager:- npm
- yarn
- pnpm
- bun
TypeScript Support
The SDK is built with TypeScript and includes complete type definitions out of the box. No additional@types packages are needed.
TypeScript 4.5+ is recommended for the best experience with the SDK’s advanced type features.
Getting API Credentials
To use the WhatsApp Business API, you need to obtain credentials from Meta:1. Create a Meta Developer Account
- Go to Meta for Developers
- Create an account or log in with your existing Facebook account
- Complete the developer verification process
2. Create a New App
- Navigate to My Apps in the developer console
- Click Create App
- Choose Business as the app type
- Fill in your app details and create the app
3. Add WhatsApp Product
- In your app dashboard, click Add Product
- Find WhatsApp and click Set up
- Choose WhatsApp Business API
4. Get Your Credentials
After setting up WhatsApp, you’ll need these credentials:Access Token
Access Token
Found in the WhatsApp > Getting Started section of your app dashboard.
This token authenticates your requests to the WhatsApp API.
Phone Number ID
Phone Number ID
Found in the WhatsApp > API Setup section.
This identifies your WhatsApp Business phone number.
Webhook Verify Token
Webhook Verify Token
You create this token when setting up webhooks.
Used to verify webhook endpoints during setup.
Business Account ID
Business Account ID
Found in the WhatsApp > API Setup section.
Optional, but useful for advanced business features.
Environment Variables
Set up your environment variables to securely store your credentials:Never commit your actual credentials to version control. Always use environment variables and add
.env to your .gitignore file.Basic Initialization
Create your first WhatsApp client instance:Verification Steps
After installation, verify everything is working correctly:1. Test API Connection
2. Send a Test Message
Uncomment the
sendTestMessage() call only after you’ve added your test phone number to the WhatsApp Business account’s recipients list.Common Installation Issues
Module not found errors
Module not found errors
Make sure you’re using the correct import syntax for your environment:
- ES6 modules:
import { WhatsAppClient } from 'whatsapp-client-sdk' - CommonJS:
const { WhatsAppClient } = require('whatsapp-client-sdk')
TypeScript compilation errors
TypeScript compilation errors
Ensure your
tsconfig.json includes:Environment variable not loaded
Environment variable not loaded
For Node.js projects, install and configure Then in your main file:
dotenv:API connection fails
API connection fails
Check that:
- Your access token is valid and not expired
- Your phone number ID is correct
- You have proper internet connectivity
- Your Meta Developer account is in good standing
Next Steps
Quick Start Guide
Send your first message in under 5 minutes
Configuration Options
Explore advanced configuration options
Message Types
Learn about all supported message types
Webhook Setup
Set up webhooks to receive messages
Need Help?
Join our community
Get help from the community or reach out for support