Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V13: Webhook all the things #15161

Conversation

warrenbuckley
Copy link
Contributor

@warrenbuckley warrenbuckley commented Nov 7, 2023

Prerequisites

  • I have added steps to test this contribution in the description below

If there's an existing issue for this PR then this fixes

Description

This adds in more WebHooks into the CMS as the are plenty of Notifications/Events raised by Umbraco that people may want to be notified by as a webhook posted externally to a third party system.

This PR adds in a lot of WebHook Event Types but they are not automatically added by default and would require you to update the Webhook Collection in a composer like so, where an implementor can pick and choose what collection of WebHooks they want to add.

// Pick and choose from the collection of Webhooks
builder.WebhookEvents()
            .AddContentWebhooks()
            .AddDataTypeWebhooks()
            .AddDictionaryWebhooks()
            .AddDomainWebhooks()
            .AddLanguageWebhooks()
            .AddMediaWebhooks()
            .AddMemberWebhooks()
            .AddMemberTypeWebhooks()
            .AddPackageWebhooks()
            .AddPublicAccessWebhooks()
            .AddRelationWebhooks()
            .AddScriptWebhooks()
            .AddStylesheetWebhooks()
            .AddTemplateWebhooks()
            .AddUserWebhooks();
            
// Or go nuts and add them all
builder.WebhookEvents()
            .AddAllAvailableWebhooks();

Test Notes

  • Enable a webhook from the long list and ensure the correct information is sent
  • Use a site such as https://webhook.site to test the payloads

Updated

Content

  • ContentCopied
  • ContentDeletedBlueprint
  • ContentDeletedVerions
  • ContentDeleted
  • ContentEmptiedRecycleBin
  • ContentMovedToRecycleBin
  • ContentMoved
  • ContentPublished
  • ContentRolledBack
  • ContentSavedBluePrint
  • ContentSaved
  • ContentSorted
  • ContentUnpublished

DataType

  • DataTypeDeleted
  • DataTypeMoved
  • DataTypeSaved

Dictionary

  • DictionaryItemDeleted
  • DictionaryItemSaved

Domain

  • DomainDeleted
  • DomainSaved

Language

  • LanguageDeleted
  • LanguageSaved

Media

  • MediaDeleted
  • MediaEmptiedRecycleBin
  • MediaMovedToRecycleBin
  • MediaMoved
  • MediaSaved

MediaType

  • MediaTypeChanged
  • MediaTypeDeleted
  • MediaTypeMoved
  • MediaTypeSaved

Member

  • MemberDeleted
  • MemberSaved
  • MemberGroupDeleted
  • MemberGroupSaved
  • AssignedMemberRoles
  • RemovedMemberRoles
  • ExportedMember

Member Type

  • MemberTypeSaved
  • MemberTypeDeleted
  • MemberTypeChanged
  • MemberTypeMoved

Package

  • ImportedPackage

Public Access

  • PublicAccessEntryDeleted
  • PublicAccessEntrySaved

Relation

  • RelationDeleted
  • RelationSaved
  • RelationTypeDeleted
  • RelationTypeSaved

Script

  • ScriptDeleted
  • ScriptSaved

Stylesheet

  • StylesheetDeleted
  • StylesheetSaved

Template

  • PartialViewDeleted
  • PartialViewSaved
  • TemplateDeleted
  • TemplateSaved

User

  • UserDeleted
  • UserSaved
  • UserLocked
  • UserUnlocked
  • UserLoginFailed
  • UserLoginSuccess
  • UserLogoutSuccess
  • UserGroupDeleted
  • UserGroupSaved
  • UserPasswordChanged
  • UserPasswordReset
  • UseForgottonPasswordRequested
  • UserForgottonPasswordChanged
  • UserLoginRequiresVerification
  • UserTwoFactorRequested
  • AssignedUserGroupPermissions

@mikecp
Copy link
Contributor

mikecp commented Nov 7, 2023

Hey @warrenbuckley , I just wanted to make sure you were aware of this PR currently being worked on because I think it's touching/modifying the same parts as you: #15157

@warrenbuckley
Copy link
Contributor Author

@mikecp OK gonna pause & catch up on that thread over there...

Note: Renames the existing Save & Delete to be Saved and Deleted to be inline with rest of WebHooks
…ook-all-the-things

# Conflicts:
#	src/Umbraco.Core/Constants-WebhookEvents.cs
#	src/Umbraco.Core/Webhooks/Events/Media/MediaDeletedWebhookEvent.cs
#	src/Umbraco.Core/Webhooks/Events/Media/MediaSavedWebhookEvent.cs
#	tests/Umbraco.Tests.Integration/Umbraco.Core/Services/WebhookServiceTests.cs
Just so I can move from main computer to laptop to carry on some hacking for now :)
@warrenbuckley
Copy link
Contributor Author

warrenbuckley commented Nov 10, 2023

@Zeegaan before I wrap this up and do anymore, is it likely this PR will be accepted?
I know I should have checked first 🙈

@Zeegaan
Copy link
Member

Zeegaan commented Nov 13, 2023

Depends on how well you can argue your use case to @bergmania I think 🙈

@warrenbuckley
Copy link
Contributor Author

@bergmania let me know what you think matey 😄

@bergmania
Copy link
Member

@warrenbuckley, I like the idea, just go for it 💪 🏃

@warrenbuckley
Copy link
Contributor Author

@Zeegaan surely worth me doing a separate PR for that once this is merged

@warrenbuckley
Copy link
Contributor Author

Is there anything I can do to help you and the Core Collabs team with the review/testing process @mikecp or are you wanting the HQ gang such as @Zeegaan to pick this up and review it.

Just checking I am not stuck in limbo land between the two groups 😄

@warrenbuckley
Copy link
Contributor Author

UX improvement

Updated PR for the EventPicker Infinite Editor so that the events are ordered by the friendly eventName property and implemented filtering in the same way the icon picker does.

Recording.2023-11-28.114918.mp4

@bjarnef
Copy link
Contributor

bjarnef commented Nov 28, 2023

Maybe we could just have a dropdown to filter the category, e.g. Content, Media, (Member), DataType, etc. which filter the event by name (or prefix) and IIRC a selection will filter other event types from the list anyway.

  • All
  • Content
  • Media
  • etc.

@warrenbuckley
Copy link
Contributor Author

@bjarnef yes perhaps we could, but for now I followed another UX pattern that was already in the backoffice.
Hopefully this gets looked at soon and then if you wanted to you could iterate/improve the UX of this.

@nul800sebastiaan nul800sebastiaan merged commit d088ed8 into umbraco:v13/dev Nov 30, 2023
4 of 7 checks passed
@nul800sebastiaan
Copy link
Member

I've added a few commits for consistency but I think this is great for now! I'd love a hint from @ronaldbarendse on how to move to an extension method, but we have a bit of time before the next RC comes out (I've noted down to follow up on it). Other than that it all seems to work great and we're happy to have this ship in v13! 🎉

Thanks very much @warrenbuckley for all the work on this, really cool stuff!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants