Class NSWebhookAgent

Webhook definitions* webhooks signal other systems about events inside NetServer.

Examples

NSWebhookAgent agent;
agent.callMethod(arg1, arg2);

Constructors

NSWebhookAgent()

Declaration

NSWebhookAgent

Examples

NSWebhookAgent agent;
agent.callMethod(arg1, arg2);

Methods

CreateDefaultWebhook()

Sets default values into a new NSWebhook.

Declaration

NSWebhook CreateDefaultWebhook()

Examples

NSWebhookAgent agent;
NSWebhook thing = agent.CreateDefaultWebhook();
thing = agent.SaveWebhook(thing);

Returns

Type Description
NSWebhook A new NSWebhook with default values.

DeleteWebhook(Integer)

Deletes the NSWebhook

Declaration

DeleteWebhook(Integer webhook)

Examples

NSWebhookAgent agent;
agent.DeleteWebhook(123);

Parameters

Type Name Description
Integer webhook

Returns

Type Description
Void

GetAllWebhooks(String,String,Integer)

Returns all webhooks, according to filter criteria

Declaration

NSWebhook[] GetAllWebhooks(String nameFilter, String eventFilter, Integer statusFilter)

Examples

NSWebhookAgent agent;
String nameFilter;
String eventFilter;
Integer statusFilter;
NSWebhook[] res = agent.GetAllWebhooks(nameFilter, eventFilter, statusFilter);

Parameters

Type Name Description
String nameFilter
String eventFilter
Integer statusFilter See <xref href="CRMScript.NetServer.WebhookState" data-throw-if-not-resolved="false"></xref>.

Returns

Type Description
NSWebhook[]

GetLastError(Integer)

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

Declaration

String GetLastError(Integer webhookId)

Examples

NSWebhookAgent agent;
Integer webhookId;
String res = agent.GetLastError(webhookId);

Parameters

Type Name Description
Integer webhookId

Returns

Type Description
String

GetWebhook(Integer)

Gets an NSWebhook object.

Declaration

NSWebhook GetWebhook(Integer webhookId)

Examples

NSWebhookAgent agent;
NSWebhook thing = agent.GetWebhook(123);

Parameters

Type Name Description
Integer webhookId

Returns

Type Description
NSWebhook

SaveWebhook(NSWebhook)

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

Declaration

NSWebhook SaveWebhook(NSWebhook webhook)

Examples

NSWebhook  agent;
NSWebhook thing = agent.CreateDefaultWebhook();
thing = agent.SaveWebhook(thing);

Parameters

Type Name Description
NSWebhook webhook The NSWebhook to save.

Returns

Type Description
NSWebhook

SignalEvent(String,Integer,StringObjectDictionary)

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

Declaration

Void SignalEvent(String eventName, Integer primaryKey, StringObjectDictionary data)

Examples

NSWebhookAgent agent;
String eventName;
Integer primaryKey;
StringObjectDictionary data;
agent.SignalEvent(eventName, primaryKey, data);

Parameters

Type Name Description
String eventName
Integer primaryKey
StringObjectDictionary data

Returns

Type Description
Void

TestWebhook(NSWebhook)

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

Declaration

NSWebhookResult TestWebhook(NSWebhook webhook)

Examples

NSWebhookAgent agent;
NSWebhook webhook;
NSWebhookResult res = agent.TestWebhook(webhook);

Parameters

Type Name Description
NSWebhook webhook

Returns

Type Description
NSWebhookResult