nastech-whatsapp-bridge 1.0.0 → 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 +63 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# nastech-whatsapp-bridge
|
|
2
|
+
|
|
3
|
+
> Standalone Node.js WhatsApp bridge for [NasTech Agent](https://github.com/nastech-ai/NasTech-Agent) — connects to WhatsApp via [Baileys](https://github.com/WhiskeySockets/Baileys) and exposes a local HTTP API that the Python gateway adapter polls and posts to.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/nastech-whatsapp-bridge)
|
|
6
|
+
[](../../LICENSE)
|
|
7
|
+
|
|
8
|
+
## How it works
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
WhatsApp ←──── Baileys (WebSocket) ────→ bridge.js ←──── Python gateway
|
|
12
|
+
HTTP :3000 (polls /messages,
|
|
13
|
+
posts /send)
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The bridge runs as a sidecar process. NasTech Agent's Python gateway adapter (`gateway/platforms/whatsapp.py`) starts it automatically when you run `nastech whatsapp`.
|
|
17
|
+
|
|
18
|
+
## HTTP API
|
|
19
|
+
|
|
20
|
+
| Method | Path | Description |
|
|
21
|
+
|--------|------|-------------|
|
|
22
|
+
| `GET` | `/messages` | Long-poll for new incoming messages |
|
|
23
|
+
| `POST` | `/send` | Send a text message `{ chatId, message, replyTo? }` |
|
|
24
|
+
| `POST` | `/edit` | Edit a sent message `{ chatId, messageId, message }` |
|
|
25
|
+
| `POST` | `/send-media` | Send media `{ chatId, filePath, mediaType?, caption?, fileName? }` |
|
|
26
|
+
| `POST` | `/typing` | Send typing indicator `{ chatId }` |
|
|
27
|
+
| `GET` | `/chat/:id` | Get chat metadata |
|
|
28
|
+
| `GET` | `/health` | Health check |
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
### Via NasTech (recommended)
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
nastech whatsapp
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
NasTech starts the bridge automatically and manages the session.
|
|
39
|
+
|
|
40
|
+
### Standalone
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install
|
|
44
|
+
node bridge.js --port 3000 --session ~/.nastech/whatsapp/session
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
On first run, scan the QR code printed in the terminal with your WhatsApp mobile app.
|
|
48
|
+
|
|
49
|
+
## Options
|
|
50
|
+
|
|
51
|
+
| Flag | Default | Description |
|
|
52
|
+
|------|---------|-------------|
|
|
53
|
+
| `--port` | `3000` | HTTP port to listen on |
|
|
54
|
+
| `--session` | `~/.nastech/whatsapp/session` | Path to store the Baileys session |
|
|
55
|
+
|
|
56
|
+
## Requirements
|
|
57
|
+
|
|
58
|
+
- Node.js ≥ 18
|
|
59
|
+
- An active WhatsApp account (personal or business)
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT — [NasTech](https://nastechai.com)
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nastech-whatsapp-bridge",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "WhatsApp bridge for NasTech Agent using Baileys",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "node bridge.js"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@whiskeysockets/baileys": "
|
|
10
|
+
"@whiskeysockets/baileys": "^7.0.0-rc13",
|
|
11
11
|
"express": "^4.22.2",
|
|
12
12
|
"qrcode-terminal": "^0.12.0",
|
|
13
13
|
"pino": "^9.0.0"
|
|
14
14
|
},
|
|
15
15
|
"overrides": {
|
|
16
|
-
"protobufjs": "^
|
|
16
|
+
"protobufjs": "^8.6.4"
|
|
17
17
|
},
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public",
|