Class WebhookEventBase<TNotification>
Abstract base class for webhook events that handles notification processing and webhook firing.
Inheritance
Namespace: Umbraco.Cms.Core.Webhooks
Assembly: Umbraco.Core.dll
Syntax
public abstract class WebhookEventBase<TNotification> : IWebhookEvent, INotificationAsyncHandler<TNotification>, INotificationHandler where TNotification : INotification
Type Parameters
| Name | Description |
|---|---|
| TNotification | The type of notification this webhook event handles. |
Constructors
View SourceWebhookEventBase(IWebhookFiringService, IWebhookService, IOptionsMonitor<WebhookSettings>, IServerRoleAccessor)
Initializes a new instance of the WebhookEventBase<TNotification> class.
Declaration
protected WebhookEventBase(IWebhookFiringService webhookFiringService, IWebhookService webhookService, IOptionsMonitor<WebhookSettings> webhookSettings, IServerRoleAccessor serverRoleAccessor)
Parameters
| Type | Name | Description |
|---|---|---|
| IWebhookFiringService | webhookFiringService | The service responsible for firing webhooks. |
| IWebhookService | webhookService | The service for managing webhook configurations. |
| IOptionsMonitor<WebhookSettings> | webhookSettings | The webhook settings configuration. |
| IServerRoleAccessor | serverRoleAccessor | The server role accessor to determine the current server role. |
Properties
View SourceAlias
Gets the unique alias used to identify this webhook event.
Declaration
public abstract string Alias { get; }
Property Value
| Type | Description |
|---|---|
| string |
EventName
Gets the friendly display name of the webhook event.
Declaration
public string EventName { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
EventType
Gets the type/category of the webhook event.
Declaration
public string EventType { get; }
Property Value
| Type | Description |
|---|---|
| string |
WebhookFiringService
Gets the webhook firing service used to send webhook requests.
Declaration
protected IWebhookFiringService WebhookFiringService { get; }
Property Value
| Type | Description |
|---|---|
| IWebhookFiringService |
WebhookService
Gets the webhook service used to retrieve webhook configurations.
Declaration
protected IWebhookService WebhookService { get; }
Property Value
| Type | Description |
|---|---|
| IWebhookService |
WebhookSettings
Gets the current webhook settings configuration.
Declaration
protected WebhookSettings WebhookSettings { get; }
Property Value
| Type | Description |
|---|---|
| WebhookSettings |
Methods
View SourceConvertNotificationToRequestPayload(TNotification)
Use this method if you wish to change the shape of the object to be serialised for the JSON webhook payload. For example excluding sensitive data
Declaration
public virtual object? ConvertNotificationToRequestPayload(TNotification notification)
Parameters
| Type | Name | Description |
|---|---|---|
| TNotification | notification |
Returns
| Type | Description |
|---|---|
| object |
HandleAsync(TNotification, CancellationToken)
Handles a notification.
Declaration
public Task HandleAsync(TNotification notification, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| TNotification | notification | The notification. |
| CancellationToken | cancellationToken | The cancellation token. |
Returns
| Type | Description |
|---|---|
| Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
ProcessWebhooks(TNotification, IEnumerable<IWebhook>, CancellationToken)
Process the webhooks for the given notification.
Declaration
public virtual Task ProcessWebhooks(TNotification notification, IEnumerable<IWebhook> webhooks, CancellationToken cancellationToken)
Parameters
| Type | Name | Description |
|---|---|---|
| TNotification | notification | |
| IEnumerable<IWebhook> | webhooks | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
ShouldFireWebhookForNotification(TNotification)
should webhooks fire for this notification.
Declaration
public virtual bool ShouldFireWebhookForNotification(TNotification notificationObject)
Parameters
| Type | Name | Description |
|---|---|---|
| TNotification | notificationObject |
Returns
| Type | Description |
|---|---|
| bool | true if webhooks should be fired. |