Skip to main content

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:

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

  1. Go to Meta for Developers
  2. Create an account or log in with your existing Facebook account
  3. Complete the developer verification process

2. Create a New App

  1. Navigate to My Apps in the developer console
  2. Click Create App
  3. Choose Business as the app type
  4. Fill in your app details and create the app

3. Add WhatsApp Product

  1. In your app dashboard, click Add Product
  2. Find WhatsApp and click Set up
  3. Choose WhatsApp Business API

4. Get Your Credentials

After setting up WhatsApp, you’ll need these credentials:
Found in the WhatsApp > Getting Started section of your app dashboard. This token authenticates your requests to the WhatsApp API.
Found in the WhatsApp > API Setup section. This identifies your WhatsApp Business phone number.
You create this token when setting up webhooks. Used to verify webhook endpoints during setup.
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

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')
Ensure your tsconfig.json includes:
For Node.js projects, install and configure dotenv:
Then in your main file:
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