av6-core 1.7.7 → 1.7.8

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
@@ -3954,7 +3954,7 @@ var NotificationService = class {
3954
3954
  fileUrls
3955
3955
  });
3956
3956
  for (const it of bulk.items) {
3957
- await this.prisma.eventDeliveryItem.create({
3957
+ const deliveryItem = await this.prisma.eventDeliveryItem.create({
3958
3958
  data: {
3959
3959
  deliveryId,
3960
3960
  notificationType: "WHATSAPP" /* WHATSAPP */,
@@ -3967,6 +3967,15 @@ var NotificationService = class {
3967
3967
  error: it.ok ? null : it.error ?? "failed"
3968
3968
  }
3969
3969
  });
3970
+ if (it.ok && tpl.webHookUrl) {
3971
+ const res = await fetch(tpl.webHookUrl, {
3972
+ method: "POST",
3973
+ body: JSON.stringify({ id: deliveryItem.id })
3974
+ });
3975
+ if (!res.ok) {
3976
+ this.logger.error("[NotificationService] WhatsApp webhook failed", res.statusText);
3977
+ }
3978
+ }
3970
3979
  }
3971
3980
  }
3972
3981
  // --------------------------------------------------------------------------------------
package/dist/index.mjs CHANGED
@@ -3901,7 +3901,7 @@ var NotificationService = class {
3901
3901
  fileUrls
3902
3902
  });
3903
3903
  for (const it of bulk.items) {
3904
- await this.prisma.eventDeliveryItem.create({
3904
+ const deliveryItem = await this.prisma.eventDeliveryItem.create({
3905
3905
  data: {
3906
3906
  deliveryId,
3907
3907
  notificationType: "WHATSAPP" /* WHATSAPP */,
@@ -3914,6 +3914,15 @@ var NotificationService = class {
3914
3914
  error: it.ok ? null : it.error ?? "failed"
3915
3915
  }
3916
3916
  });
3917
+ if (it.ok && tpl.webHookUrl) {
3918
+ const res = await fetch(tpl.webHookUrl, {
3919
+ method: "POST",
3920
+ body: JSON.stringify({ id: deliveryItem.id })
3921
+ });
3922
+ if (!res.ok) {
3923
+ this.logger.error("[NotificationService] WhatsApp webhook failed", res.statusText);
3924
+ }
3925
+ }
3917
3926
  }
3918
3927
  }
3919
3928
  // --------------------------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "av6-core",
3
- "version": "1.7.7",
3
+ "version": "1.7.8",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",