> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SuperOffice.WebApi.Data.Webhook

# <a id="SuperOffice_WebApi_Data_Webhook" /> Class Webhook

Namespace: [SuperOffice.WebApi.Data](SuperOffice.WebApi.Data.md)\
Assembly: SuperOffice.WebApi.dll

Carrier object for Webhook.
Webhook definitions. Webhooks broadcast events from NetServer to remote servers.

```csharp theme={null}
public class Webhook
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ←
[Webhook](SuperOffice.WebApi.Data.Webhook.md)

#### Inherited Members

[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring),
[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)),
[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)),
[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals),
[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode),
[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype),
[object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)

## Examples

Get Webhook 123 using the WebApi client:
<pre><code class="lang-csharp">var configuration = new WebApiConfiguration(url);
var agent = new WebhookAgent(configuration);
var webhook = agent.GetWebhook( 123 );</code></pre>

## Constructors

### <a id="SuperOffice_WebApi_Data_Webhook__ctor" /> Webhook()

Default constructor - defaults any enum props to 0.

```csharp theme={null}
public Webhook()
```

## Properties

### <a id="SuperOffice_WebApi_Data_Webhook_ConsecutiveErrors" /> ConsecutiveErrors

Number of consecutive errors. Reset to 0 when an non-error is received. If too many errors, webhook.state is changed to TooManyErrors(3) to deactivate webhook.

```csharp theme={null}
public virtual int ConsecutiveErrors { get; set; }
```

#### Property Value

[int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="SuperOffice_WebApi_Data_Webhook_Description" /> Description

Human-readable description of what this webhook does.

```csharp theme={null}
public virtual string Description { get; set; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="SuperOffice_WebApi_Data_Webhook_ErrorAssociates" /> ErrorAssociates

Associates to notify when this webhook is disabled.

```csharp theme={null}
public virtual MDOListItem[] ErrorAssociates { get; set; }
```

#### Property Value

[MDOListItem](SuperOffice.WebApi.Data.MDOListItem.md)\[]

### <a id="SuperOffice_WebApi_Data_Webhook_ErrorEmails" /> ErrorEmails

Email addresses to notify when this webhook is disabled.

```csharp theme={null}
public virtual string[] ErrorEmails { get; set; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)\[]

### <a id="SuperOffice_WebApi_Data_Webhook_ErrorsEmail" /> ErrorsEmail

Obsolete, use ErrorEmails instead

```csharp theme={null}
public virtual string ErrorsEmail { get; set; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="SuperOffice_WebApi_Data_Webhook_Events" /> Events

Array of event names that trigger this webhook: \['contact.created', 'sale.changed']

```csharp theme={null}
public virtual string[] Events { get; set; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)\[]

### <a id="SuperOffice_WebApi_Data_Webhook_Headers" /> Headers

Custom HTTP Headers to add to webhook requests.

```csharp theme={null}
public virtual StringDictionary Headers { get; set; }
```

#### Property Value

[StringDictionary](SuperOffice.WebApi.Data.StringDictionary.md)

### <a id="SuperOffice_WebApi_Data_Webhook_LastError" /> LastError

Most recent error message received from target. HTTP Headers + body. To help with debugging webhooks.

```csharp theme={null}
public virtual string LastError { get; set; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="SuperOffice_WebApi_Data_Webhook_Name" /> Name

Name to identify this webhook. Does not have to be unique.

```csharp theme={null}
public virtual string Name { get; set; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="SuperOffice_WebApi_Data_Webhook_NotifyVia" /> NotifyVia

How to notify recipients when this webhook changes state. 1=Email, 2=InApp.
NULL if unknown enum value.

```csharp theme={null}
[JsonIgnore]
public WebhookNotifyVia? NotifyVia { get; set; }
```

#### Property Value

[WebhookNotifyVia](SuperOffice.WebApi.Data.WebhookNotifyVia.md)?

#### See Also

[Webhook](SuperOffice.WebApi.Data.Webhook.md).[NotifyVia\_String](SuperOffice.WebApi.Data.Webhook.md#SuperOffice_WebApi_Data_Webhook_NotifyVia_String)

### <a id="SuperOffice_WebApi_Data_Webhook_NotifyVia_String" /> NotifyVia\_String

How to notify recipients when this webhook changes state. 1=Email, 2=InApp.
Raw string enum value.

```csharp theme={null}
[JsonProperty("NotifyVia")]
public string NotifyVia_String { get; set; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

#### See Also

[Webhook](SuperOffice.WebApi.Data.Webhook.md).[NotifyVia](SuperOffice.WebApi.Data.Webhook.md#SuperOffice_WebApi_Data_Webhook_NotifyVia)

### <a id="SuperOffice_WebApi_Data_Webhook_NotifyWhen" /> NotifyWhen

When to notify recipients. Bitflag: 1=FirstFailure, 2=Disabling.
NULL if unknown enum value.

```csharp theme={null}
[JsonIgnore]
public WebhookNotifyWhen? NotifyWhen { get; set; }
```

#### Property Value

[WebhookNotifyWhen](SuperOffice.WebApi.Data.WebhookNotifyWhen.md)?

#### See Also

[Webhook](SuperOffice.WebApi.Data.Webhook.md).[NotifyWhen\_String](SuperOffice.WebApi.Data.Webhook.md#SuperOffice_WebApi_Data_Webhook_NotifyWhen_String)

### <a id="SuperOffice_WebApi_Data_Webhook_NotifyWhen_String" /> NotifyWhen\_String

When to notify recipients. Bitflag: 1=FirstFailure, 2=Disabling.
Raw string enum value.

```csharp theme={null}
[JsonProperty("NotifyWhen")]
public string NotifyWhen_String { get; set; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

#### See Also

[Webhook](SuperOffice.WebApi.Data.Webhook.md).[NotifyWhen](SuperOffice.WebApi.Data.Webhook.md#SuperOffice_WebApi_Data_Webhook_NotifyWhen)

### <a id="SuperOffice_WebApi_Data_Webhook_Properties" /> Properties

Custom values to inject into JSON body of webhook call.

```csharp theme={null}
public virtual StringObjectDictionary Properties { get; set; }
```

#### Property Value

[StringObjectDictionary](SuperOffice.WebApi.Data.StringObjectDictionary.md)

### <a id="SuperOffice_WebApi_Data_Webhook_Registered" /> Registered

Registered when

```csharp theme={null}
public virtual DateTime Registered { get; set; }
```

#### Property Value

[DateTime](https://learn.microsoft.com/dotnet/api/system.datetime)

### <a id="SuperOffice_WebApi_Data_Webhook_RegisteredAssociate" /> RegisteredAssociate

The user that created the webhook.

```csharp theme={null}
public virtual Associate RegisteredAssociate { get; set; }
```

#### Property Value

[Associate](SuperOffice.WebApi.Data.Associate.md)

### <a id="SuperOffice_WebApi_Data_Webhook_Secret" /> Secret

Shared secret key used for generating SHA256 HMAC signature, so that receiver can verify that call came from this server

```csharp theme={null}
public virtual string Secret { get; set; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="SuperOffice_WebApi_Data_Webhook_State" /> State

Webhook status - should we post events to the URL? 1=Active, 2=Stopped or 3=TooManyErrors
NULL if unknown enum value.

```csharp theme={null}
[JsonIgnore]
public WebhookState? State { get; set; }
```

#### Property Value

[WebhookState](SuperOffice.WebApi.Data.WebhookState.md)?

#### See Also

[Webhook](SuperOffice.WebApi.Data.Webhook.md).[State\_String](SuperOffice.WebApi.Data.Webhook.md#SuperOffice_WebApi_Data_Webhook_State_String)

### <a id="SuperOffice_WebApi_Data_Webhook_State_String" /> State\_String

Webhook status - should we post events to the URL? 1=Active, 2=Stopped or 3=TooManyErrors
Raw string enum value.

```csharp theme={null}
[JsonProperty("State")]
public string State_String { get; set; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

#### See Also

[Webhook](SuperOffice.WebApi.Data.Webhook.md).[State](SuperOffice.WebApi.Data.Webhook.md#SuperOffice_WebApi_Data_Webhook_State)

### <a id="SuperOffice_WebApi_Data_Webhook_TargetUrl" /> TargetUrl

Destination to POST event info to. URL for webhooks. Id for CRM scripts

```csharp theme={null}
public virtual string TargetUrl { get; set; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="SuperOffice_WebApi_Data_Webhook_TotalCalls" /> TotalCalls

Number of times webhook has been invoked since registered. For statistical purposes.

```csharp theme={null}
public virtual int TotalCalls { get; set; }
```

#### Property Value

[int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="SuperOffice_WebApi_Data_Webhook_TotalErrors" /> TotalErrors

Number of times webhook has returned error since registered. For statistical purposes.

```csharp theme={null}
public virtual int TotalErrors { get; set; }
```

#### Property Value

[int](https://learn.microsoft.com/dotnet/api/system.int32)

### <a id="SuperOffice_WebApi_Data_Webhook_Type" /> Type

Name of plugin that handles this webhook. 'webhook' for HTTP POST notifications, 'crmscript' for script invocations.

```csharp theme={null}
public virtual string Type { get; set; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### <a id="SuperOffice_WebApi_Data_Webhook_Updated" /> Updated

Last updated when

```csharp theme={null}
public virtual DateTime Updated { get; set; }
```

#### Property Value

[DateTime](https://learn.microsoft.com/dotnet/api/system.datetime)

### <a id="SuperOffice_WebApi_Data_Webhook_UpdatedAssociate" /> UpdatedAssociate

The user that last updated the webhook.

```csharp theme={null}
public virtual Associate UpdatedAssociate { get; set; }
```

#### Property Value

[Associate](SuperOffice.WebApi.Data.Associate.md)

### <a id="SuperOffice_WebApi_Data_Webhook_WebhookId" /> WebhookId

Primary Key. Unique id for this webhook.

```csharp theme={null}
public virtual int WebhookId { get; set; }
```

#### Property Value

[int](https://learn.microsoft.com/dotnet/api/system.int32)

## See Also

[WebhookAgent](SuperOffice.WebApi.Agents.WebhookAgent.md)


## Related topics

- [SuperOffice.WebApi.Data.Webhook TestWebhookRequest](/en/api/reference/webapi/SuperOffice.WebApi.Data.Webhook_TestWebhookRequest.md)
- [SuperOffice.WebApi.Data.Webhook GetAllWebhooksRequest](/en/api/reference/webapi/SuperOffice.WebApi.Data.Webhook_GetAllWebhooksRequest.md)
- [SuperOffice.WebApi.Data.WebhookResult](/en/api/reference/webapi/SuperOffice.WebApi.Data.WebhookResult.md)
- [SuperOffice.WebApi.Data.WebhookState](/en/api/reference/webapi/SuperOffice.WebApi.Data.WebhookState.md)
- [SuperOffice.WebApi.Data.WebhookNotifyVia](/en/api/reference/webapi/SuperOffice.WebApi.Data.WebhookNotifyVia.md)
- [SuperOffice.WebApi.Data.WebhookNotifyWhen](/en/api/reference/webapi/SuperOffice.WebApi.Data.WebhookNotifyWhen.md)
