Skip to content

froggy1014/meta-cloud-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

395 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

meta-cloud-api

meta-cloud-api

WhatsApp TypeScript SDK — type-safe, modular, and production-ready.

The complete SDK for the official WhatsApp Business Platform Cloud API.

npm version npm downloads GitHub license TypeScript

Docs · Playground · Getting Started

Quick Start

pnpm add meta-cloud-api
import WhatsApp from 'meta-cloud-api';

const wa = new WhatsApp({
    accessToken: process.env.CLOUD_API_ACCESS_TOKEN,
    phoneNumberId: process.env.WA_PHONE_NUMBER_ID,
});

// Send a text message
await wa.messages.text({ to: '1234567890', body: 'Hello from TypeScript!' });

// Send a template message
await wa.messages.template({
    to: '1234567890',
    name: 'hello_world',
    language: { code: 'en_US' },
});

// Send an image
await wa.messages.image({ to: '1234567890', link: 'https://example.com/image.png' });

Why meta-cloud-api?

meta-cloud-api
Type Safety Full TypeScript strict mode — every request and response is typed
17 API Modules Messages, Media, Templates, Flows, Groups, Calling, Payments, and more
Webhook Adapters Built-in support for Express.js and Next.js (App Router & Pages Router)
Modular Tree-shakeable imports, use only what you need
Production Ready Error handling, typed error classes, rate limit support
Official API Built on the official WhatsApp Business Platform Cloud API

API Coverage

wa.messages              // Text, image, video, document, audio, sticker, location, contact, template, interactive, reaction
wa.media                 // Upload, get, delete media
wa.templates             // Create, list, delete message templates
wa.flows                 // WhatsApp Flows management
wa.groups                // Group management
wa.calling               // Voice calling
wa.payments              // Payment processing (India)
wa.businessProfile       // Business profile management
wa.phoneNumbers          // Phone number management
wa.commerce              // Commerce settings
wa.marketingMessages     // Marketing message management
wa.qrCode               // QR code generation
wa.registration          // Phone registration
wa.twoStepVerification   // 2FA management
wa.encryption            // End-to-end encryption
wa.blockUsers            // Block/unblock users
wa.waba                  // WhatsApp Business Account management

Webhooks

import { createExpressWebhookHandler } from 'meta-cloud-api/webhooks';

app.post('/webhook', createExpressWebhookHandler({
    verifyToken: process.env.WEBHOOK_VERIFY_TOKEN,
    onMessage: (message) => {
        console.log('Received:', message);
    },
}));

Requirements

  • Node.js 18 LTS or later
  • TypeScript 4.5+ (for TypeScript projects)

Resources

Examples

Example Description
express-simple Basic Express.js integration
express-production Production-ready with conversation flows, DB, and queues
nextjs-app-router Next.js App Router integration
nextjs-pages-router Next.js Pages Router integration

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

MIT License - see the LICENSE file for details.