@rkitwork/whatsapp-ramukjar-cloud-sdk 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +132 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,132 @@
1
+ # @rkitwork/whatsapp-ramukjar-cloud-sdk
2
+
3
+ A secure, type-safe WhatsApp Cloud API SDK for **sending and receiving messages**. Supports **NestJS** and **ExpressJS** frameworks out-of-the-box.
4
+
5
+ ---
6
+
7
+ ## Features
8
+
9
+ - Send **text, media, and template messages** via WhatsApp Cloud API
10
+ - Handle incoming WhatsApp **webhooks** (messages, status updates)
11
+ - Fully **TypeScript typed** and safe
12
+ - Works in **NestJS** or plain **ExpressJS**
13
+ - Easy to install and use with your npm account
14
+
15
+ ---
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install @rkitwork/whatsapp-ramukjar-cloud-sdk
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Quick Start
26
+
27
+ ### 1. Initialize WhatsAppService
28
+
29
+ ```ts
30
+ import { WhatsAppService } from '@rkitwork/whatsapp-ramukjar-cloud-sdk';
31
+
32
+ const token = 'YOUR_WHATSAPP_ACCESS_TOKEN';
33
+ const phoneNumberId = 'YOUR_PHONE_NUMBER_ID';
34
+
35
+ const whatsapp = new WhatsAppService(token, phoneNumberId);
36
+ ```
37
+
38
+ ---
39
+
40
+ ### 2. Send a Text Message
41
+
42
+ ```ts
43
+ import { textMessage } from '@rkitwork/whatsapp-ramukjar-cloud-sdk';
44
+
45
+ await whatsapp.sendMessage('RECIPIENT_NUMBER', textMessage('Hello World!'));
46
+ ```
47
+
48
+ > `textMessage` is a helper function that returns a proper WhatsApp Cloud API payload.
49
+
50
+ ---
51
+
52
+ ### 3. NestJS Webhook Controller (Optional)
53
+
54
+ ```ts
55
+ import { WebhookController } from '@rkitwork/whatsapp-ramukjar-cloud-sdk';
56
+ import { Module } from '@nestjs/common';
57
+
58
+ @Module({
59
+ controllers: [WebhookController],
60
+ })
61
+ export class AppModule {}
62
+ ```
63
+
64
+ #### Controller handles:
65
+
66
+ - `GET /webhook` → WhatsApp verification challenge
67
+ - `POST /webhook` → Incoming messages or events
68
+
69
+ ---
70
+
71
+ ### 4. ExpressJS Example (Optional)
72
+
73
+ ```ts
74
+ import express from 'express';
75
+ import bodyParser from 'body-parser';
76
+ import { WebhookController } from '@rkitwork/whatsapp-ramukjar-cloud-sdk';
77
+
78
+ const app = express();
79
+ app.use(bodyParser.json());
80
+
81
+ app.get('/webhook', (req, res) => {
82
+ const challenge = req.query['hub.challenge'];
83
+ res.send(challenge);
84
+ });
85
+
86
+ app.post('/webhook', (req, res) => {
87
+ console.log('Incoming webhook:', req.body);
88
+ res.sendStatus(200);
89
+ });
90
+
91
+ app.listen(3000, () => console.log('Server running on http://localhost:3000'));
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Types & Payloads
97
+
98
+ - `textMessage(content: string)` → Returns WhatsApp text message payload
99
+ - `imageMessage(url: string, caption?: string)` → Returns image message payload
100
+ - `templateMessage(name: string, language: string, variables?: any[])` → Template message payload
101
+ - All payloads are fully typed in `payloads.ts`
102
+
103
+ ---
104
+
105
+ ## Contributing
106
+
107
+ 1. Fork the repository
108
+ 2. `npm install` dependencies
109
+ 3. Make changes in `src/`
110
+ 4. Build the package:
111
+
112
+ ```bash
113
+ npm run build
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Support / Donations
119
+
120
+ If you find this SDK helpful and want to support my work, you can donate:
121
+
122
+ - **Buy Me a Coffee:** [https://www.buymeacoffee.com/rkitwork](https://www.buymeacoffee.com/rkitwork)
123
+
124
+ Your support helps me maintain and improve this SDK and create more open-source tools for developers. Thank you! ❤️
125
+
126
+ ---
127
+
128
+ ## License
129
+
130
+ MIT © rkitwork
131
+
132
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rkitwork/whatsapp-ramukjar-cloud-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A secure WhatsApp Cloud API SDK for NestJS and Express",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",