Help with notification

Hello, I’m not a programmer and I’m new to scriptable. I’ve been trying to use notifications on my script but I can’t retrieve pending notifications.
I was able to create a few notifications using the script but I have no idea how to use “allPending()” or “allDelivered()”.
Can you give me an example on how to use them? Unfortunately the documentation didn’t help me.

You can use the functions like this:

// get all pending notifications
const allPendingNotifications = await Notifications.allPending();
// filter them to only include your notifications
const myPendingNotifications = allPendingNotifications.filter((notification) => {
  // change the next line to filter for your criteria
  return notification.name === "Test Notification";
});

It works the same with Notifications.allDelivered().

2 Likes