Skip to content

WebhookSubscription

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

An external system’s event subscription.

public sealed record WebhookSubscription : IEquatable<WebhookSubscription>

objectWebhookSubscription

IEquatable<WebhookSubscription>

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

This record has no secret field. The signing secret does not sit in the database; only the name of the configuration key the value is read from (WebhookSubscription.SecretConfigurationKey) sits here, and the value is resolved at run time through IConfiguration.

public WebhookSubscription()

The consecutive-failure count. Once the threshold is exceeded, the subscription disables itself and is written to the audit trail.

public int ConsecutiveFailures { get; init; }

int

The creation time (UTC).

public required DateTimeOffset CreatedAt { get; init; }

DateTimeOffset

Whether the subscription is enabled.

public bool Enabled { get; init; }

bool

The subscribed event names. See WebhookEvents.

public required IReadOnlyList<string> Events { get; init; }

IReadOnlyList<string>

Extra headers added to every request.

public IReadOnlyDictionary<string, string> Headers { get; init; }

IReadOnlyDictionary<string, string>

An authentication header is not written here: the value would be stored in the database. Use WebhookSubscription.SecretConfigurationKey for signing instead.

The subscription identifier.

public required Guid Id { get; init; }

Guid

The name, unique within the tenant.

public required string Name { get; init; }

string

The name of the configuration key the signing secret is read from. Not the secret itself.

public string? SecretConfigurationKey { get; init; }

string?

Example: "AgentPrism:WebhookSecrets:order-service". The value lives in dotnet user-secrets or an environment variable. If empty, requests are not signed.

The tenant the subscription belongs to.

public required string TenantId { get; init; }

string

The last-updated time (UTC).

public required DateTimeOffset UpdatedAt { get; init; }

DateTimeOffset

The address events are sent to.

public required string Url { get; init; }

string

The address goes through an SSRF check: only https (or http for loopback), private network ranges are rejected, redirects are not followed.

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(WebhookSubscription? other)

other WebhookSubscription?

bool

public override int GetHashCode()

int

public override string ToString()

string

operator ==(WebhookSubscription?, WebhookSubscription?)

Section titled “ operator ==(WebhookSubscription?, WebhookSubscription?)”
public static bool operator ==(WebhookSubscription? left, WebhookSubscription? right)

left WebhookSubscription?

right WebhookSubscription?

bool

operator !=(WebhookSubscription?, WebhookSubscription?)

Section titled “ operator !=(WebhookSubscription?, WebhookSubscription?)”
public static bool operator !=(WebhookSubscription? left, WebhookSubscription? right)

left WebhookSubscription?

right WebhookSubscription?

bool