Show / Hide Table of Contents

Interface IWebhookAgent

Interface for the Webhook Agent Webhook definitions - webhooks signal other systems about events inside NetServer

Online Restricted: This agent is not available in Online by default. Access must be requested specifically when app is registered.
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[Agent("Webhook Agent", "Interface for the Webhook Agent. Webhook definitions - webhooks signal other systems about events inside NetServer")]
public interface IWebhookAgent : IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;

using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
   using (WebhookAgent agent = new WebhookAgent())
   {
      // call methods on agent here...
   }
}

Methods

CreateDefaultWebhookAsync(CancellationToken)

Loading default values into a new Webhook.

Online Restricted: The Webhook agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
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

Online Restricted: The Webhook agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task DeleteWebhookAsync(int webhookId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int webhookId

The identity of the Webhook

CancellationToken cancellationToken
Returns
Type Description
Task

This method has no return value

GetAllWebhooksAsync(string, string, WebhookState, CancellationToken)

Returns all webhooks, according to filter criteria

Online Restricted: The Webhook agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
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
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.

Online Restricted: The Webhook agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
Task<string> GetLastErrorAsync(int webhookId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int webhookId

Webhook to get error message for.

CancellationToken cancellationToken
Returns
Type Description
Task<string>

Error message, or empty string if no errors received

GetWebhookAsync(int, CancellationToken)

Gets a Webhook object.

Online Restricted: The Webhook agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
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>

A single Webhook

SaveWebhookAsync(Webhook, CancellationToken)

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

Online Restricted: The Webhook agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
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.

Online Restricted: The Webhook agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
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
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.

Online Restricted: The Webhook agent is not available in Online by default. Access must be requested specifically when app is registered.
Declaration
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
Returns
Type Description
Task<WebhookResult>

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

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