npm package: @rkitwork/whatsapp-ramukjar-cloud-sdk
Description: A secure WhatsApp Cloud API SDK for NestJS and Express
Author: rkitwork
Latest version: 1.2.2

# @rkitwork/whatsapp-ramukjar-cloud-sdk

A secure, type-safe WhatsApp Cloud API SDK for **sending and receiving messages**. Supports **NestJS** and **ExpressJS** frameworks out-of-the-box.

---

## Features

- Send **text, media, and template messages** via WhatsApp Cloud API
- Handle incoming WhatsApp **webhooks** (messages, status updates)
- Fully **TypeScript typed** and safe
- Works in **NestJS** or plain **ExpressJS**
- Easy to install and use with your npm account

---

## Installation

```bash
npm install @rkitwork/whatsapp-ramukjar-cloud-sdk
```

---

## Quick Start

### 1. Initialize WhatsAppService

```ts
import { WhatsAppClient } from '@rkitwork/whatsapp-ramukjar-cloud-sdk';

const client = new WhatsAppClient({
  token: process.env.WHATSAPP_TOKEN!,
  phoneNumberId: process.env.PHONE_ID!,
  apiVersion: 'v24.0',
});
```

---

### 2. Send a Text Message

```ts
import { WhatsApp } from '@rkitwork/whatsapp-ramukjar-cloud-sdk';

await client.sendMessage(
  '919XXXXXXXXX',
  WhatsApp.text('Hello from WhatsApp Cloud SDK 🚀')
);

```

### 🧩 NestJS Example

```ts
import { Injectable } from '@nestjs/common';
import { WhatsAppClient, WhatsApp } from '@rkitwork/whatsapp-ramukjar-cloud-sdk';

@Injectable()
export class AppService {
  private client = new WhatsAppClient({
    token: process.env.WHATSAPP_TOKEN!,
    phoneNumberId: process.env.PHONE_ID!,
    apiVersion: 'v24.0',
  });

  async sendText() {
    return this.client.sendMessage(
      '919XXXXXXXXX',
      WhatsApp.text('Hello from NestJS 🚀')
    );
  }
}

```
### 🌐 ExpressJS Example

```ts
import express from 'express';
import { WhatsAppClient, WhatsApp } from '@rkitwork/whatsapp-ramukjar-cloud-sdk';

const app = express();

const client = new WhatsAppClient({
  token: process.env.WHATSAPP_TOKEN!,
  phoneNumberId: process.env.PHONE_ID!,
});

app.get('/send', async (_, res) => {
  const response = await client.sendMessage(
    '919XXXXXXXXX',
    WhatsApp.text('Hello from Express 🚀')
  );
  res.json(response);
});

app.listen(3000, () => console.log('Server running on port 3000'));

```

### ✨ Features / Supported Message Types

| Method              | Parameters                                    | Description                                               |
| ------------------- | --------------------------------------------- | --------------------------------------------------------- |
| `WhatsApp.text`     | `body: string`                                | Sends a plain text message                                |
| `WhatsApp.image`    | `link: string`, `caption?: string`            | Sends an image with an optional caption                   |
| `WhatsApp.video`    | `link: string`, `caption?: string`            | Sends a video with an optional caption                    |
| `WhatsApp.audio`    | `link: string`                                | Sends an audio message                                    |
| `WhatsApp.document` | `link: string`, `filename?: string`           | Sends a document with an optional filename                |
| `WhatsApp.location` | `lat: number`, `lng: number`, `name?: string` | Sends a location with coordinates and optional place name |


---

> `text` is a helper function that returns a proper WhatsApp Cloud API payload.

---


---

---

## Support / Donations

If you find this SDK helpful and want to support my work, you can donate:

- **Buy Me a Coffee:** [https://www.buymeacoffee.com/rkitwork](https://www.buymeacoffee.com/rkitwork)

Your support helps me maintain and improve this SDK and create more open-source tools for developers. Thank you! ❤️

---

## License

MIT © rkitwork