v6 API Content Service doesn't trigger Umbraco notifications?
Hello,
I am using the v6 content service to create new nodes from a front end application via a WebApi controller. Everything is good except that the content service doesn't appear to trigger the Umbraco notifications setup in the UI to execute.
So questions are:
Can it?
Should it?
Is it possible to manually trigger the notifications programmatically in C#?
Which notifications are we talking about? When you say "Umbraco notifications setup in the UI to execute" I'm not sure if you mean the speech bubles in the backoffice or something else?
I mean if you right click on a node and select "Notifications" you can setup email alerts for various events so you are alerted when those events occur.
No, those types of notifications will only occur when using the backoffice or the legacy API (well the parts of the legacy API which would call 'umbraco.BusinessLogic.Actions.Action.RunActionHandlers' - New Doc, Publish, Delete, etc.). This probably hasn't been noted as a breaking change in v6 on the tracker, but it should have been as everything that has to do with the legacy Actions/ActionHandlers is considered legacy and not something that we can support (directly) in the new API (it wouldn't make sense).
But it should be fairly simple to call the notification stuff from your own code, so you can have notifications sent when ever something specific occurs.
What you do is to call: umbraco.cms.businesslogic.workflow.Notification.GetNotifications(CMSNode Node, User user, IAction Action) ... found in the cms.dll Or you call: umbraco.BusinessLogic.Actions.Action.RunActionHandlers(Document d, IAction action) ... the main caveat of course being that you'll need to pass it a legacy Document object.
I think these approaches would have worked, however I have no HttpContext (WebApi async task), so the sendNotifications method is throwing a exception as it requires the HttpContext which is quite probably one of the reasons the Content Service can't trigger notifications in the first place!
v6 API Content Service doesn't trigger Umbraco notifications?
Hello,
I am using the v6 content service to create new nodes from a front end application via a WebApi controller. Everything is good except that the content service doesn't appear to trigger the Umbraco notifications setup in the UI to execute. So questions are:
Thanks,
Jeavon
Which notifications are we talking about? When you say "Umbraco notifications setup in the UI to execute" I'm not sure if you mean the speech bubles in the backoffice or something else?
- Morten
Hi Morten,
I mean if you right click on a node and select "Notifications" you can setup email alerts for various events so you are alerted when those events occur.
Jeavon
No, those types of notifications will only occur when using the backoffice or the legacy API (well the parts of the legacy API which would call 'umbraco.BusinessLogic.Actions.Action.RunActionHandlers' - New Doc, Publish, Delete, etc.). This probably hasn't been noted as a breaking change in v6 on the tracker, but it should have been as everything that has to do with the legacy Actions/ActionHandlers is considered legacy and not something that we can support (directly) in the new API (it wouldn't make sense).
But it should be fairly simple to call the notification stuff from your own code, so you can have notifications sent when ever something specific occurs.
What you do is to call: umbraco.cms.businesslogic.workflow.Notification.GetNotifications(CMSNode Node, User user, IAction Action) ... found in the cms.dll
Or you call: umbraco.BusinessLogic.Actions.Action.RunActionHandlers(Document d, IAction action) ... the main caveat of course being that you'll need to pass it a legacy Document object.
Example:
umbraco.BusinessLogic.Actions.Action.RunActionHandlers(legacyDoc, ActionDelete.Instance);
for something that is being deleted.
Hope this helps,
Morten
Hi Morten,
I think these approaches would have worked, however I have no HttpContext (WebApi async task), so the sendNotifications method is throwing a exception as it requires the HttpContext which is quite probably one of the reasons the Content Service can't trigger notifications in the first place!
I will think of something else :-)
Thanks,
Jeavon
The ContentService alone will never trigger the ActionHandlers which run the notifications.
/ Morten
is working on a reply...