Notifications not working

I have been trying unsuccessfully to create a notification using the newer wix-notifications.v2 API (which replaces the fickle wix-crm-backend notification API). The backend fires with the console log showing body, channels and options parameters passed correctly, but no notification is sent to Admin or ContactId and the console shows this error.

message: Not Found
details:
applicationError:
description: Not Found
code: NOT_FOUND
data: {}

Front End code


import { sendNotification } from "backend/SendNotification.web";

...

async function CreateNotification(bookedBy, ccode){ 
  const body = bookedBy + " has booked class/course " + ccode;
  const channels = ["Browser", "Dashboard", "Mobile"];
  const options = {
    action: "BOOKING",
    title: "Course Booked",
    toContacts: {
      contactIds: ["33ed90a3-4732-4200-a403-7e4f3e730cb3"],
    },
      targetDashboardPage: "Home"
  };

  console.log("Notification to send: " + body, channels, options);
  sendNotification(body, channels, options)
  .then((result) => {
    console.log("New Notification sent successfully: ", result);
  })
  .catch((error) => {
    console.log("New Notification failed: ", error);
  });
}

Back end code (web.js file)

import { notifications } from "wix-notifications.v2";
import { webMethod, Permissions } from "wix-web-module";
import { elevate } from "wix-auth"; 

const elevatedNotify = elevate(notifications.notify);

export const sendNotification = webMethod(
  Permissions.Anyone,
  async (body, channels, options) => {
    try {
      console.log("BACKEND: Notification to send: " + body, channels, options);
      const result = await elevatedNotify(body, channels, options);
      return result;
    } catch (error) {
      console.log(error);
    }
  },
);

Have yet to see anyone claiming they’ve managed to get the Notifications.V2 API to work. Any ideas on what is causing the error here, or a different approach?

1 Like

I am also facing this exact problem.

Update. Wix Velo Developer Preview support has acknowledged that “there’s an issue with the Notifications API” and they are looking into. Hopefully they’ll release a patch soon.