cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Questions about Notifications

Constantine
17-Peridot

Questions about Notifications

Hello,

 

It would be great to get some feedback on the following:

  1. Are there any plans for the major rework or deprecation of this framework?
  2. How to create Notification triggers from Javascript services? I tried the pair "CreateNotificationContent / CreateNotificationDefinition", but it doesn't seem to create a trigger. What's the difference between NotificationContent and Trigger?
  3. How to access and/or update NotificationDefinition objects from Javascript service? The entity collection "NotificationDefinitions" doesn't seem to be exposed in scripting context.
  4. We have 5000 things, each one with approximately 10 alerts (each firing once per week on average), and we'll need to configure notifications on them programmatically (users can choose which notifications from which devices they want to receive), potentially resuling in 50K NotificationDefinition objects, each one with a single trigger defined. Does it make sense performance-wise, or this framework is not designed to be used this way or handle that many objects?
  5. Are there any queries and/or batch operations on notifications? E.g. can I find all notifications which trigger on a specific thing? Can I delete all of them at once?

Thanks for any suggestions!

 

Regards,
Constantine

ACCEPTED SOLUTION

Accepted Solutions

Dear Constantine,

 

In order to create a Notification with a custom Trigger programmatically, the following services need to be called one after the other :

    1. CreateNotificationDefinition : from resource “EntityServices” > Creates a new notification using parameters Name, Description and Tags
    2. CreateNotificationContent : from resource “EntityServices” > Creates a new notification content using parameters Name, Handler name and ID, Description and Tags
    3. SetContent : from resource “NotificationContents” > Adds a subject and body to the Notification Content using input parameter infotable {subject, body}
    4. AddApplicableContent : from resource “NotificationDefinitions” > Associates NotificationContent to Notification using parameter Name (from NotificationContent)
    5. AddApplicableEvent : from resource “NotificationDefinitions” > Associates Event to Notification using Parameters entityType, entityName, eventName, propertyName, alertName (for example : Thing, Pump, Alert, Pressure, HighPressure)
    6. AddUserAsRecipientToEvent : from resource “NotificationDefinitions” > Creates trigger from NotificationContent and Event and associates it to the Notification

> This sequence will provide you with a working Notification that, for example, sends an email every time a specific alert is triggered.

 

Please note that calling above mentioned services 3, 4, 5 and 6 in a custom javascript service will lead to error "ReferenceError: "NotificationDefinitions" is not defined" or "ReferenceError: "NotificationContents" is not defined". This has been reported to R&D and is planned to be fixed in ThingWorx 9.0

In the current state of things these services can be used through REST calls or,  in the case of NotificationDefinitions, directly under the Generic Services of Notification Entities as well as in mashups.

 

Hope this helps,

Charlotte

View solution in original post

2 REPLIES 2

Hi,

 

I know you found this info already, but I will share here in case someone else is interested in.

1. Until now, there are no plans to deprecate the notifications facility. 

2. I didn't find any service that is creating Triggers for notifications.

 

Best regards,

Raluca Edu

Dear Constantine,

 

In order to create a Notification with a custom Trigger programmatically, the following services need to be called one after the other :

    1. CreateNotificationDefinition : from resource “EntityServices” > Creates a new notification using parameters Name, Description and Tags
    2. CreateNotificationContent : from resource “EntityServices” > Creates a new notification content using parameters Name, Handler name and ID, Description and Tags
    3. SetContent : from resource “NotificationContents” > Adds a subject and body to the Notification Content using input parameter infotable {subject, body}
    4. AddApplicableContent : from resource “NotificationDefinitions” > Associates NotificationContent to Notification using parameter Name (from NotificationContent)
    5. AddApplicableEvent : from resource “NotificationDefinitions” > Associates Event to Notification using Parameters entityType, entityName, eventName, propertyName, alertName (for example : Thing, Pump, Alert, Pressure, HighPressure)
    6. AddUserAsRecipientToEvent : from resource “NotificationDefinitions” > Creates trigger from NotificationContent and Event and associates it to the Notification

> This sequence will provide you with a working Notification that, for example, sends an email every time a specific alert is triggered.

 

Please note that calling above mentioned services 3, 4, 5 and 6 in a custom javascript service will lead to error "ReferenceError: "NotificationDefinitions" is not defined" or "ReferenceError: "NotificationContents" is not defined". This has been reported to R&D and is planned to be fixed in ThingWorx 9.0

In the current state of things these services can be used through REST calls or,  in the case of NotificationDefinitions, directly under the Generic Services of Notification Entities as well as in mashups.

 

Hope this helps,

Charlotte

Announcements


Top Tags