waha-openclaw-channel 1.2.2 → 1.2.3

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/package.json +55 -55
  2. package/src/inbound.ts +11 -1
package/package.json CHANGED
@@ -1,55 +1,55 @@
1
- {
2
- "name": "waha-openclaw-channel",
3
- "version": "1.2.2",
4
- "description": "OpenClaw WAHA (WhatsApp HTTP API) channel plugin",
5
- "type": "module",
6
- "main": "./index.ts",
7
- "files": [
8
- "index.ts",
9
- "src/",
10
- "docs/",
11
- "config-example.json",
12
- "README.md"
13
- ],
14
- "repository": {
15
- "type": "git",
16
- "url": "https://github.com/omernesh/openclaw-waha-plugin.git"
17
- },
18
- "keywords": [
19
- "openclaw",
20
- "waha",
21
- "whatsapp",
22
- "channel",
23
- "plugin"
24
- ],
25
- "author": "Omer Nesher",
26
- "license": "MIT",
27
- "openclaw": {
28
- "extensions": [
29
- "./index.ts"
30
- ],
31
- "channel": {
32
- "id": "waha",
33
- "label": "WAHA",
34
- "selectionLabel": "WAHA (WhatsApp HTTP API)",
35
- "docsPath": "/channels/whatsapp",
36
- "docsLabel": "whatsapp",
37
- "blurb": "Self-hosted WhatsApp via WAHA webhooks + REST API bridge.",
38
- "order": 70,
39
- "aliases": [
40
- "whatsapp-waha",
41
- "waha-whatsapp"
42
- ],
43
- "quickstartAllowFrom": true
44
- },
45
- "install": {
46
- "npmSpec": "waha-openclaw-channel",
47
- "localPath": "skills/waha-openclaw-channel",
48
- "defaultChoice": "local"
49
- }
50
- },
51
- "dependencies": {
52
- "better-sqlite3": "^11.10.0",
53
- "zod": "^4.3.6"
54
- }
55
- }
1
+ {
2
+ "name": "waha-openclaw-channel",
3
+ "version": "1.2.3",
4
+ "description": "OpenClaw WAHA (WhatsApp HTTP API) channel plugin",
5
+ "type": "module",
6
+ "main": "./index.ts",
7
+ "files": [
8
+ "index.ts",
9
+ "src/",
10
+ "docs/",
11
+ "config-example.json",
12
+ "README.md"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/omernesh/openclaw-waha-plugin.git"
17
+ },
18
+ "keywords": [
19
+ "openclaw",
20
+ "waha",
21
+ "whatsapp",
22
+ "channel",
23
+ "plugin"
24
+ ],
25
+ "author": "Omer Nesher",
26
+ "license": "MIT",
27
+ "openclaw": {
28
+ "extensions": [
29
+ "./index.ts"
30
+ ],
31
+ "channel": {
32
+ "id": "waha",
33
+ "label": "WAHA",
34
+ "selectionLabel": "WAHA (WhatsApp HTTP API)",
35
+ "docsPath": "/channels/whatsapp",
36
+ "docsLabel": "whatsapp",
37
+ "blurb": "Self-hosted WhatsApp via WAHA webhooks + REST API bridge.",
38
+ "order": 70,
39
+ "aliases": [
40
+ "whatsapp-waha",
41
+ "waha-whatsapp"
42
+ ],
43
+ "quickstartAllowFrom": true
44
+ },
45
+ "install": {
46
+ "npmSpec": "waha-openclaw-channel",
47
+ "localPath": "skills/waha-openclaw-channel",
48
+ "defaultChoice": "local"
49
+ }
50
+ },
51
+ "dependencies": {
52
+ "better-sqlite3": "^11.10.0",
53
+ "zod": "^4.3.6"
54
+ }
55
+ }
package/src/inbound.ts CHANGED
@@ -111,8 +111,18 @@ export async function handleWahaInbound(params: {
111
111
  const _preCheckDropped = _preCheckIsGroup && _preCheckAllowedGroups && _preCheckAllowedGroups.length > 0 && !_preCheckAllowedGroups.includes(rawMessage.chatId);
112
112
 
113
113
  // Preprocess media (download + transcribe/analyze) before building rawBody
114
+ // Location, vCard, and document messages have hasMedia=false but still need preprocessing
114
115
  let message = rawMessage;
115
- if (rawPayload && rawMessage.hasMedia && !_preCheckDropped) {
116
+ const _rawData = (rawPayload as Record<string, unknown>)?._data as Record<string, unknown> | undefined;
117
+ const _rawMsg = _rawData?.message as Record<string, unknown> | undefined;
118
+ const needsPreprocessing = rawMessage.hasMedia
119
+ || Boolean(rawMessage.location)
120
+ || Boolean(_rawMsg?.locationMessage)
121
+ || Boolean(_rawMsg?.liveLocationMessage)
122
+ || Boolean(_rawMsg?.contactMessage)
123
+ || Boolean(_rawMsg?.contactsArrayMessage)
124
+ || Boolean(_rawMsg?.documentMessage);
125
+ if (rawPayload && needsPreprocessing && !_preCheckDropped) {
116
126
  try {
117
127
  const mediaConfig = account.config.mediaPreprocessing ?? { enabled: true };
118
128
  message = await preprocessInboundMessage({