@laburen/openclaw-plugin-whatsapp-api 0.2.0 → 0.2.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/index.js +4 -11
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,17 +1,8 @@
1
1
  import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
2
- import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk/account-id";
3
2
  import { mkdir, readFile, writeFile } from "node:fs/promises";
4
3
  import path from "node:path";
5
4
  import { tmpdir } from "node:os";
6
5
  //#region src/core/accounts.ts
7
- /**
8
- * SPDX-License-Identifier: MIT
9
- *
10
- * Account resolution for the WhatsApp API channel.
11
- *
12
- * Reads `channels.whatsapp-api` (and per-account entries) from Clawdbot config
13
- * and returns fully resolved defaults for webhooks, Graph API, and media.
14
- */
15
6
  const CHANNEL_ID$1 = "whatsapp-api";
16
7
  const DEFAULT_WEBHOOK_PATH = "/webhook/whatsapp-api";
17
8
  const DEFAULT_API_VERSION = "v22.0";
@@ -22,6 +13,7 @@ const DEFAULT_DEDUPE_TTL_MS = 5 * 6e4;
22
13
  const DEFAULT_MAX_BODY_BYTES = 512 * 1024;
23
14
  const DEFAULT_MEDIA_MAX_BYTES = 20 * 1024 * 1024;
24
15
  const DEFAULT_MEDIA_REQUEST_TIMEOUT_MS = 15e3;
16
+ const DEFAULT_ACCOUNT_ID$1 = "default";
25
17
  function getChannelConfig(cfg) {
26
18
  return (cfg.channels ?? {})[CHANNEL_ID$1] ?? {};
27
19
  }
@@ -45,7 +37,7 @@ function listAccountIds(cfg) {
45
37
  const ids = /* @__PURE__ */ new Set();
46
38
  const accounts = channelCfg.accounts ?? {};
47
39
  if (Object.keys(accounts).length > 0) for (const id of Object.keys(accounts)) ids.add(id);
48
- else ids.add(DEFAULT_ACCOUNT_ID);
40
+ else ids.add(DEFAULT_ACCOUNT_ID$1);
49
41
  return [...ids];
50
42
  }
51
43
  /**
@@ -60,7 +52,7 @@ function listAccountIds(cfg) {
60
52
  */
61
53
  function resolveAccount(cfg, accountId) {
62
54
  const channelCfg = getChannelConfig(cfg);
63
- const id = accountId ?? DEFAULT_ACCOUNT_ID;
55
+ const id = accountId ?? DEFAULT_ACCOUNT_ID$1;
64
56
  const accountCfg = (channelCfg.accounts ?? {})[id] ?? {};
65
57
  return {
66
58
  accountId: id,
@@ -1089,6 +1081,7 @@ async function handleWhatsAppApiWebhook(params) {
1089
1081
  //#region src/channel/plugin.ts
1090
1082
  const CHANNEL_ID = "whatsapp-api";
1091
1083
  const log$1 = waLogger("channel");
1084
+ const DEFAULT_ACCOUNT_ID = "default";
1092
1085
  /**
1093
1086
  * Resolves when `signal` aborts, or never if `signal` is undefined.
1094
1087
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laburen/openclaw-plugin-whatsapp-api",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "WhatsApp API channel plugin for OpenClaw",
6
6
  "main": "index.js",