Webhooks administration from Backoffice#15050
Conversation
| /// <summary> | ||
| /// Webhooks icon | ||
| /// </summary> | ||
| public const string Webhooks = "icon-directions-alt"; |
There was a problem hiding this comment.
Would it be better to keep this in singular form @Zeegaan ?
So Webhook like we have User, Folder, Template... although Packages are plural. Maybe we should have a Package constant instead and eventually obsolete the Packages constant.
There was a problem hiding this comment.
Yep, sounds correct to me! 😁
There was a problem hiding this comment.
@Zeegaan does it require VS2022 17.8.0 preview to run v13/dev branch?
I tried to enable .NET 8 preview
https://anthonygiretti.com/2023/06/10/net-8-why-net-8-preview-doesnt-show-up-in-visual-studio-2022/
but it seems to return these warnings.
Targeting .NET 8.0 or higher in Visual Studio 2022 17.7 is not supported.
so not sure if the static assets are built correct as I get this error on startup:
The view '~/umbraco/UmbracoWebsite/Maintenance.cshtml' was not found.
There was a problem hiding this comment.
Not using VS personally (Rider 😍) But yes presumably you'd have to use a preview of VS, when using the dotnet 8 rc-2 🤔
There was a problem hiding this comment.
https://dotnetthoughts.net/working-with-dotnet8-projects-in-vs2022/
Yes, I think it requires the latest VS2022 preview to run for now:
dotnet/core#8790
There was a problem hiding this comment.
I just edited in VS 2022, but ran via command line next to it:
dotnet build
dotnet run
|
I'm checking this out in v13 release candidate and it's probably my favorite feature of v13 so far! Question, are there any plans to create any more default webhooks? We use Umbraco as a headless CMS. One possible change is the slug of a page. In that case we tell our frontend to forget the previous url and rebuild the page for the new url. When dealing with nested content, we suddenly have to subscribe to:
That is a lot of boilerplate to handle that specific scenario. Now I assume that the idea here is that we could simply create our own webhooks and trigger those via these notifications, and already this is probably a big upgrade for us. But it begs the question if there's any plan from the core team to expand on the default set, to cover such a use case? |
|
@karlmacklin Great to hear! 💪 Yes the idea is that you could create webhooks for anything you need 💪 |
Notes
WebhookEventBase, which holds the logic for handling notifications and orchestrating the eventual firing & logging of the given webhook.IWebhookFiringServicewhich handles the logic for sending the webrequest to the given webhook url (and retry logic)IWebhookServiceto handle the CRUD of the webhooks.ViewModels, notDisplayWhat to expect of a webhook request
Umb-Webhook-Event {eventName}so you can know which event triggered the request.Implemented features
More background on choices
How to test
We should cover multiple use cases here.
We always need a DocumentType created, so in the cases, I will assume you have already made a content type named "Root" with "allow as root" set to true.
I have also put some code in the appendix that might be useful, such as a TestController.
Creating a webhook with 1 or more events
https://localhost:44331/umbraco/api/test/GetAllProductsTestController, in theGetAllProductsmethodThis should be tested with all different events.
We should also test adding custom headers, and asserting they get sent with the request (and are subsequently logged)
Creating a webhook, with one or more document types selected
https://localhost:44331/umbraco/api/test/GetAllProductsTestController, in theGetAllProductsmethodCreating your own webhook event
https://localhost:44331/umbraco/api/test/GetAllProductsMyEventevent that is your custom eventTestController, in theGetAllProductsmethodAppendix
TestController
TestWebhookEvent
TestComposer