opscms-meta-plugin 0.4.2 → 0.5.0

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
@@ -776,6 +776,25 @@ var MetaConfig = {
776
776
  label: "\u{1F4AC} WhatsApp Business",
777
777
  description: "Official WhatsApp for this site. Choose the number in the connect flow after Facebook login. Alert messages are prepared for you, and Meta reviews them \u2014 you can leave the page while that happens. Leave this off to keep the OpenWA bridge.",
778
778
  fields: [
779
+ {
780
+ // Meta calls one address for the whole app, so this is the same for every site; shown here so nobody has to look it up.
781
+ name: "webhookUrl",
782
+ type: "text",
783
+ virtual: true,
784
+ label: "Webhook address",
785
+ admin: {
786
+ readOnly: true,
787
+ description: "Meta reports template approvals and other WhatsApp changes to this address. Paste it as the Callback URL of the Meta app (WhatsApp Business Account topic) once for the whole platform; every connected site is covered. Nothing else has to be created."
788
+ },
789
+ hooks: {
790
+ afterRead: [
791
+ () => {
792
+ const server = (process.env.PAYLOAD_PUBLIC_SERVER_URL ?? "").replace(/\/+$/, "");
793
+ return server ? `${server}/api/meta-webhook` : "";
794
+ }
795
+ ]
796
+ }
797
+ },
779
798
  {
780
799
  name: "whatsappEnabled",
781
800
  type: "checkbox",
package/dist/index.mjs CHANGED
@@ -740,6 +740,25 @@ var MetaConfig = {
740
740
  label: "\u{1F4AC} WhatsApp Business",
741
741
  description: "Official WhatsApp for this site. Choose the number in the connect flow after Facebook login. Alert messages are prepared for you, and Meta reviews them \u2014 you can leave the page while that happens. Leave this off to keep the OpenWA bridge.",
742
742
  fields: [
743
+ {
744
+ // Meta calls one address for the whole app, so this is the same for every site; shown here so nobody has to look it up.
745
+ name: "webhookUrl",
746
+ type: "text",
747
+ virtual: true,
748
+ label: "Webhook address",
749
+ admin: {
750
+ readOnly: true,
751
+ description: "Meta reports template approvals and other WhatsApp changes to this address. Paste it as the Callback URL of the Meta app (WhatsApp Business Account topic) once for the whole platform; every connected site is covered. Nothing else has to be created."
752
+ },
753
+ hooks: {
754
+ afterRead: [
755
+ () => {
756
+ const server = (process.env.PAYLOAD_PUBLIC_SERVER_URL ?? "").replace(/\/+$/, "");
757
+ return server ? `${server}/api/meta-webhook` : "";
758
+ }
759
+ ]
760
+ }
761
+ },
743
762
  {
744
763
  name: "whatsappEnabled",
745
764
  type: "checkbox",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opscms-meta-plugin",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "description": "Payload CMS plugin for connecting multi-tenant sites to Meta's network (Facebook Pixel + Conversions API, Facebook/Instagram Commerce Catalog, WhatsApp Business Cloud API). Modular per-channel, per-site — nothing hardcoded to one product line.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",