@daolmedo/openclaw-twilio-whatsapp 1.1.2 → 1.1.4

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/dist/index.js CHANGED
@@ -177,7 +177,6 @@ var twilioWhatsappPlugin = {
177
177
  // src/http-routes.ts
178
178
  import { dispatchInboundDirectDmWithRuntime } from "openclaw/plugin-sdk/direct-dm";
179
179
  import {
180
- fetchRemoteMedia,
181
180
  saveMediaBuffer
182
181
  } from "openclaw/plugin-sdk/media-runtime";
183
182
 
@@ -233,22 +232,23 @@ function twimlError(res, status, message) {
233
232
  async function downloadTwilioMedia(url, account) {
234
233
  try {
235
234
  const authHeader = "Basic " + Buffer.from(`${account.accountSid}:${account.authToken}`).toString("base64");
236
- const { buffer, contentType } = await fetchRemoteMedia({
237
- url,
238
- fetchImpl: (input, init) => fetch(input, {
239
- ...init,
240
- headers: {
241
- ...init?.headers,
242
- Authorization: authHeader
243
- }
244
- }),
245
- maxBytes: MEDIA_MAX_BYTES,
246
- readIdleTimeoutMs: 3e4
235
+ const response = await fetch(url, {
236
+ headers: { Authorization: authHeader },
237
+ signal: AbortSignal.timeout(3e4)
247
238
  });
239
+ if (!response.ok) {
240
+ throw new Error(`HTTP ${response.status} fetching media`);
241
+ }
242
+ const contentType = response.headers.get("content-type") ?? "application/octet-stream";
243
+ const arrayBuffer = await response.arrayBuffer();
244
+ if (arrayBuffer.byteLength > MEDIA_MAX_BYTES) {
245
+ throw new Error(`Media too large: ${arrayBuffer.byteLength} bytes`);
246
+ }
247
+ const buffer = Buffer.from(arrayBuffer);
248
248
  const saved = await saveMediaBuffer(buffer, contentType, "inbound", MEDIA_MAX_BYTES);
249
249
  return {
250
250
  path: saved.path,
251
- contentType: saved.contentType ?? contentType ?? "application/octet-stream"
251
+ contentType: saved.contentType ?? contentType
252
252
  };
253
253
  } catch (err) {
254
254
  console.error("[twilio-whatsapp] Failed to download media:", url, err);
@@ -12,6 +12,7 @@
12
12
  "type": "object",
13
13
  "additionalProperties": false,
14
14
  "properties": {
15
+ "enabled": { "type": "boolean" },
15
16
  "dmPolicy": { "type": "string" },
16
17
  "allowFrom": {
17
18
  "type": "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daolmedo/openclaw-twilio-whatsapp",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Twilio WhatsApp channel plugin for OpenClaw (Cody ISV)",
5
5
  "type": "module",
6
6
  "exports": {