Class Webhook
Webhook definitions. Webhooks broadcast events from NetServer to remote servers.
Carrier object for Webhook. Services for the Webhook Carrier is available from the Webhook Agent.Inherited Members
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[DataContract(Namespace = "http://www.superoffice.net/ws/crm/NetServer/12.2.0.0")]
public class Webhook
Examples
Get Webhook 123 using the agent:
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
var agent = new WebhookAgent();
var webhook = agent.GetWebhook( 123 );
}
Constructors
Webhook()
Default constructor
Declaration
public Webhook()
See Also
Properties
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.
Declaration
[DataMember]
public virtual int ConsecutiveErrors { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
See Also
Description
Human-readable description of what this webhook does.
Declaration
[DataMember]
public virtual string Description { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
See Also
ErrorAssociates
Associates to notify when this webhook is disabled.
Declaration
[DataMember]
public virtual MDOListItem[] ErrorAssociates { get; set; }
Property Value
| Type | Description |
|---|---|
| MDOListItem[] |
See Also
ErrorEmails
Email addresses to notify when this webhook is disabled.
Declaration
[DataMember]
public virtual string[] ErrorEmails { get; set; }
Property Value
| Type | Description |
|---|---|
| string[] |
See Also
ErrorsEmail
Obsolete, use ErrorEmails instead
Declaration
[DataMember]
public virtual string ErrorsEmail { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
See Also
Events
Array of event names that trigger this webhook: ['contact.created', 'sale.changed']
Declaration
[DataMember]
public virtual string[] Events { get; set; }
Property Value
| Type | Description |
|---|---|
| string[] |
See Also
Headers
Custom HTTP Headers to add to webhook requests.
Declaration
[DataMember]
public virtual StringDictionary Headers { get; set; }
Property Value
| Type | Description |
|---|---|
| StringDictionary |
See Also
LastError
Most recent error message received from target. HTTP Headers + body. To help with debugging webhooks.
Declaration
[DataMember]
public virtual string LastError { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
See Also
Name
Name to identify this webhook. Does not have to be unique.
Declaration
[DataMember]
public virtual string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
See Also
NotifyVia
How to notify recipients when this webhook changes state. 1=Email, 2=InApp.
Declaration
[DataMember]
public virtual WebhookNotifyVia NotifyVia { get; set; }
Property Value
| Type | Description |
|---|---|
| WebhookNotifyVia |
See Also
NotifyWhen
When to notify recipients. Bitflag: 1=FirstFailure, 2=Disabling.
Declaration
[DataMember]
public virtual WebhookNotifyWhen NotifyWhen { get; set; }
Property Value
| Type | Description |
|---|---|
| WebhookNotifyWhen |
See Also
Properties
Custom values to inject into JSON body of webhook call.
Declaration
[DataMember]
public virtual StringObjectDictionary Properties { get; set; }
Property Value
| Type | Description |
|---|---|
| StringObjectDictionary |
See Also
Registered
Registered when in UTC.
Declaration
[DataMember]
public virtual DateTime Registered { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTime |
See Also
RegisteredAssociate
The user that created the webhook.
Declaration
[DataMember]
public virtual Associate RegisteredAssociate { get; set; }
Property Value
| Type | Description |
|---|---|
| Associate |
See Also
Secret
Shared secret key used for generating SHA256 HMAC signature, so that receiver can verify that call came from this server
Declaration
[DataMember]
public virtual string Secret { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
See Also
State
Webhook status - should we post events to the URL? 1=Active, 2=Stopped or 3=TooManyErrors
Declaration
[DataMember]
public virtual WebhookState State { get; set; }
Property Value
| Type | Description |
|---|---|
| WebhookState |
See Also
TargetUrl
Destination to POST event info to. URL for webhooks. Id for CRM scripts
Declaration
[DataMember]
public virtual string TargetUrl { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
See Also
TotalCalls
Number of times webhook has been invoked since registered. For statistical purposes.
Declaration
[DataMember]
public virtual int TotalCalls { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
See Also
TotalErrors
Number of times webhook has returned error since registered. For statistical purposes.
Declaration
[DataMember]
public virtual int TotalErrors { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
See Also
Type
Name of plugin that handles this webhook. 'webhook' for HTTP POST notifications, 'crmscript' for script invocations.
Declaration
[DataMember]
public virtual string Type { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
See Also
Updated
Last updated when in UTC.
Declaration
[DataMember]
public virtual DateTime Updated { get; set; }
Property Value
| Type | Description |
|---|---|
| DateTime |
See Also
UpdatedAssociate
The user that last updated the webhook.
Declaration
[DataMember]
public virtual Associate UpdatedAssociate { get; set; }
Property Value
| Type | Description |
|---|---|
| Associate |
See Also
WebhookId
Primary Key. Unique id for this webhook.
Declaration
[DataMember]
public virtual int WebhookId { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
See Also
Methods
ToString()
Returns the carrier contents as a formatted string.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | The carrier contents. |
Overrides
See Also
ToString(string)
Returns the carrier contents as a formatted string, useful for debugging. Each line in the output is prefixed with the input value.
Declaration
public string ToString(string prefix)
Parameters
| Type | Name | Description |
|---|---|---|
| string | prefix | The line prefix (typically used for indenting) |
Returns
| Type | Description |
|---|---|
| string | The carrier contents. |