Show / Hide Table of Contents

Class WebhookAgent

Proxy class for the Webhook Agent Used when communicating remote using WebServices. Avoid using directly. Use the AgentFactory to create the proxy instead.

Online Restricted: This agent is not available in Online by default. Access must be requested specifically when app is registered.
Inheritance
object
WebhookAgent
Implements
IWebhookAgent
IAgent
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.Implementation.dll
Syntax
public class WebhookAgent : IWebhookAgent, IAgent

Constructors

WebhookAgent(IWebhookImplementation, ISoRequestItemsAccessor)

Proxy class for the Webhook Agent Used when communicating remote using WebServices. Avoid using directly. Use the AgentFactory to create the proxy instead.

Online Restricted: This agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
public WebhookAgent(IWebhookImplementation webhookImplementation, ISoRequestItemsAccessor accessor)
Parameters
Type Name Description
IWebhookImplementation webhookImplementation
ISoRequestItemsAccessor accessor

WebhookAgent(IWebhookImplementation, ISoRequestItemsAccessor, IDebugUser, IServiceCallsRepository)

Proxy class for the Webhook Agent Used when communicating remote using WebServices. Avoid using directly. Use the AgentFactory to create the proxy instead.

Online Restricted: This agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
public WebhookAgent(IWebhookImplementation webhookImplementation, ISoRequestItemsAccessor accessor, IDebugUser debugUser, IServiceCallsRepository serviceCallsRepository)
Parameters
Type Name Description
IWebhookImplementation webhookImplementation
ISoRequestItemsAccessor accessor
IDebugUser debugUser
IServiceCallsRepository serviceCallsRepository

Methods

CreateDefaultWebhookAsync(CancellationToken)

Loading default values into a new Webhook. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance

Declaration
public Task<Webhook> CreateDefaultWebhookAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<Webhook>

New Webhook with default values

DeleteWebhookAsync(int, CancellationToken)

Deletes the Webhook

Declaration
public Task DeleteWebhookAsync(int webhookId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int webhookId

The identity of the Webhook

CancellationToken cancellationToken
Returns
Type Description
Task

GetAllWebhooksAsync(string, string, WebhookState, CancellationToken)

Returns all webhooks, according to filter criteria

Declaration
public Task<Webhook[]> GetAllWebhooksAsync(string nameFilter, string eventFilter, WebhookState statusFilter, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string nameFilter

Only return hooks with this name. Default NULL = no filter

string eventFilter

Only return hooks responding to this event name. Default NULL = no filter

WebhookState statusFilter

Only return hooks with this status. Default Unknown = no filter, returns all.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<Webhook[]>

Array of all webhooks, filtered according to given criteria.

GetLastErrorAsync(int, CancellationToken)

Return the most recent error message received when calling this webhook.

Declaration
public Task<string> GetLastErrorAsync(int webhookId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int webhookId

Webhook to get error message for.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<string>

Error message, or empty string if no errors received

GetWebhookAsync(int, CancellationToken)

Gets a Webhook object.

Declaration
public Task<Webhook> GetWebhookAsync(int webhookId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int webhookId

The identifier of the Webhook object

CancellationToken cancellationToken
Returns
Type Description
Task<Webhook>

Webhook

SaveWebhookAsync(Webhook, CancellationToken)

Updates the existing Webhook or creates a new Webhook if the id parameter is empty

Declaration
public Task<Webhook> SaveWebhookAsync(Webhook webhook, CancellationToken cancellationToken = default)
Parameters
Type Name Description
Webhook webhook

The Webhook that is saved.

CancellationToken cancellationToken
Returns
Type Description
Task<Webhook>

New or updated Webhook

SignalEventAsync(string, int, StringObjectDictionary, CancellationToken)

Signal webhooks that an event has occurred. All webhooks listening for the event will be notified.

Declaration
public Task SignalEventAsync(string eventName, int primaryKey, StringObjectDictionary data, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string eventName

Name of event to fire. 'entity.verb' For example: 'window.closed', 'button.clicked'.

int primaryKey

(Optional) Id of entity that is firing event. Can be 0 if not used.

StringObjectDictionary data

Event data. Not all the data values may be posted to the webhook, depending in webhook type: { 'windowName': 'foo', 'widgets': 123 }

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task

This method has no return value

TestWebhookAsync(Webhook, CancellationToken)

Pings a webhook with a 'test' event, returns SUCCESS(true) or FAILURE(false) + the response from the webhook target.

Declaration
public Task<WebhookResult> TestWebhookAsync(Webhook webhook, CancellationToken cancellationToken = default)
Parameters
Type Name Description
Webhook webhook

Webhook definition to ping. Must contain a valid TargetUrl.

CancellationToken cancellationToken

This operation cannot be cancelled; the cancellationToken parameter is ignored

Returns
Type Description
Task<WebhookResult>

Result of calling webhook. Sucess=true/false + Error message

Implements

IWebhookAgent
IAgent
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top