@peopl-health/nexus 6.3.3 → 6.3.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.
@@ -430,7 +430,7 @@ class NexusMessaging {
430
430
  if (messageData.body) messageData.body = decodeUnicodeEscapes(messageData.body);
431
431
  if (messageData.variables) messageData.variables = decodeUnicodeEscapesDeep(messageData.variables);
432
432
 
433
- if (messageData.fileUrl && this._providerStores) await prepareMessageMedia(messageData);
433
+ if (messageData.fileUrl && !messageData.media?.key && this._providerStores) await prepareMessageMedia(messageData);
434
434
 
435
435
  const storesTemplateMedia = Boolean(messageData.contentSid && !messageData.fileUrl && !messageData.parentMessageId && this.provider.renderTemplateContent);
436
436
  if (messageData.contentSid && (!messageData.body || storesTemplateMedia)) {
@@ -53,6 +53,7 @@ async function releaseOne(message, now) {
53
53
  return false;
54
54
  }
55
55
 
56
+ const { media } = message;
56
57
  const body = await resolveRecoveryBody(message);
57
58
  if (hasUnresolvedPhi(body)) {
58
59
  logger.error('[HeldMessage] Body still carries a PHI placeholder, refusing to release', logCtx);
@@ -72,6 +73,7 @@ async function releaseOne(message, now) {
72
73
  code: message.numero,
73
74
  ...contactOf(message),
74
75
  body,
76
+ ...(media?.key && { media, fileUrl: `https://${media.bucketName}.s3.amazonaws.com/${media.key}`, fileType: media.mediaType }),
75
77
  parentMessageId: message._id,
76
78
  kind: 'freeform',
77
79
  idempotencyKey: `window-release:${message._id}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "6.3.3",
3
+ "version": "6.3.4",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",