@rkitwork/whatsapp-ramukjar-cloud-sdk 1.0.1 → 1.0.2
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.
- package/README.md +0 -61
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,70 +49,9 @@ await whatsapp.sendMessage('RECIPIENT_NUMBER', textMessage('Hello World!'));
|
|
|
49
49
|
|
|
50
50
|
---
|
|
51
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
52
|
|
|
69
53
|
---
|
|
70
54
|
|
|
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
55
|
---
|
|
117
56
|
|
|
118
57
|
## Support / Donations
|