Class NSWebhook

nWebhook definitions. Webhooks broadcast events from NetServer to remote servers.

Constructors

NSWebhook()

Initializes a new instance of the NSWebhook class.

Declaration

NSWebhook

Methods

GetEvents()

Declaration

String[] GetEvents()

Examples

NSWebhook thing;
String[] events = thing.GetEvents();

Returns

Type Description
String[] Array of event names that trigger this webhook ['contact.created', 'sale.changed']

GetHeaders()

Declaration

Map GetHeaders()

Examples

NSWebhook thing;
Map headers = thing.GetHeaders();

Returns

Type Description
Map Custom HTTP Headers to add to webhook requests.

GetName()

Declaration

String GetName()

Examples

NSWebhook thing;
String name = thing.GetName();

Returns

Type Description
String Name to identify this webhook. Does not have to be unique.

GetProperties()

Declaration

StringObjectDictionary GetProperties()

Examples

NSWebhook thing;
StringObjectDictionary properties = thing.GetProperties();

Returns

Type Description
StringObjectDictionary Custom values to inject into JSON body of webhook call.

GetRegistered()

Declaration

DateTime GetRegistered()

Examples

NSWebhook thing;
DateTime registered = thing.GetRegistered();

Returns

Type Description
DateTime Registered when.

GetRegisteredAssociate()

Declaration

NSAssociate GetRegisteredAssociate()

Examples

NSWebhook thing;
NSAssociate registeredAssociate = thing.GetRegisteredAssociate();

Returns

Type Description
NSAssociate The user that created the webhook.

GetSecret()

Declaration

String GetSecret()

Examples

NSWebhook thing;
String secret = thing.GetSecret();

Returns

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

GetState()

Declaration

Integer GetState()

Examples

NSWebhook thing;
Integer state = thing.GetState();

Returns

Type Description
Integer Webhook status, should we post events to the URL? See <xref href="CRMScript.NetServer.WebhookState" data-throw-if-not-resolved="false"></xref>.

GetTargetUrl()

Declaration

String GetTargetUrl()

Examples

NSWebhook thing;
String targetUrl = thing.GetTargetUrl();

Returns

Type Description
String Destination to POST event info to. URL for webhooks. ID for CRM scripts.

GetType()

Declaration

String GetType()

Examples

NSWebhook thing;
String type = thing.GetType();

Returns

Type Description
String Name of plugin that handles this webhook. 'webhook' for webhooks, which are handled by the system plugin.

GetUpdated()

Declaration

DateTime GetUpdated()

Examples

NSWebhook thing;
DateTime updated = thing.GetUpdated();

Returns

Type Description
DateTime Last updated when.

GetUpdatedAssociate()

Declaration

NSAssociate GetUpdatedAssociate()

Examples

NSWebhook thing;
NSAssociate updatedAssociate = thing.GetUpdatedAssociate();

Returns

Type Description
NSAssociate The user that last updated the webhook.

GetWebhookId()

Declaration

Integer GetWebhookId()

Examples

NSWebhook thing;
Integer webhookId = thing.GetWebhookId();

Returns

Type Description
Integer Primary Key. Unique id for this webhook.

SetEvents(String[])

Declaration

Void SetEvents(String[] events)

Examples

NSWebhook thing;
String[] events;
thing.SetEvents(events);

Parameters

Type Name Description
String[] events Array of event names that trigger this webhook ['contact.created', 'sale.changed']

Returns

Type Description
Void

SetHeaders(Map)

Declaration

Void SetHeaders(Map headers)

Examples

NSWebhook thing;
Map headers;
thing.SetHeaders(headers);

Parameters

Type Name Description
Map headers Custom HTTP Headers to add to webhook requests.

Returns

Type Description
Void

SetName(String)

Declaration

Void SetName(String name)

Examples

NSWebhook thing;
String name;
thing.SetName(name);

Parameters

Type Name Description
String name Name to identify this webhook. Does not have to be unique.

Returns

Type Description
Void

SetProperties(StringObjectDictionary)

Declaration

Void SetProperties(StringObjectDictionary properties)

Examples

NSWebhook thing;
StringObjectDictionary properties;
properties.insertInteger("foobar", 42);
thing.SetProperties(properties);

Parameters

Type Name Description
StringObjectDictionary properties Custom values to inject into JSON body of webhook call.

Returns

Type Description
Void

SetRegistered(DateTime)

Declaration

Void SetRegistered(DateTime registered)

Examples

NSWebhook thing;
DateTime registered;
thing.SetRegistered(registered);

Parameters

Type Name Description
DateTime registered Registered when.

Returns

Type Description
Void

SetRegisteredAssociate(NSAssociate)

Declaration

Void SetRegisteredAssociate(NSAssociate registeredAssociate)

Examples

NSWebhook thing;
NSAssociate registeredAssociate;
thing.SetRegisteredAssociate(registeredAssociate);

Parameters

Type Name Description
NSAssociate registeredAssociate The user that created the webhook.

Returns

Type Description
Void

SetSecret(String)

Declaration

Void SetSecret(String secret)

Examples

NSWebhook thing;
String secret;
thing.SetSecret(secret);

Parameters

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

Returns

Type Description
Void

SetState(Integer)

Declaration

Void SetState(Integer state)

Examples

NSWebhook thing;
Integer state;
thing.SetState(state);

Parameters

Type Name Description
Integer state Webhook status. Should we post events to the URL? See <xref href="CRMScript.NetServer.WebhookState" data-throw-if-not-resolved="false"></xref>.

Returns

Type Description
Void

SetTargetUrl(String)

Declaration

Void SetTargetUrl(String targetUrl)

Examples

NSWebhook thing;
String targetUrl;
thing.SetTargetUrl(targetUrl);

Parameters

Type Name Description
String targetUrl Destination to POST event info to. URL for webhooks. ID for CRM scripts.

Returns

Type Description
Void

SetType(String)

Declaration

Void SetType(String type)

Examples

NSWebhook thing;
String type;
thing.SetType(type);

Parameters

Type Name Description
String type Name of plugin that handles this webhook. 'webhook' for webhooks, which are handled by the system plugin.

Returns

Type Description
Void

SetUpdated(DateTime)

Declaration

Void SetUpdated(DateTime updated)

Examples

NSWebhook thing;
DateTime updated;
thing.SetUpdated(updated);

Parameters

Type Name Description
DateTime updated Last updated when.

Returns

Type Description
Void

SetUpdatedAssociate(NSAssociate)

Declaration

Void SetUpdatedAssociate(NSAssociate updatedAssociate)

Examples

NSWebhook thing;
NSAssociate updatedAssociate;
thing.SetUpdatedAssociate(updatedAssociate);

Parameters

Type Name Description
NSAssociate updatedAssociate The user that last updated the webhook.

Returns

Type Description
Void

SetWebhookId(Integer)

Declaration

Void SetWebhookId(Integer webhookId)

Examples

NSWebhook thing;
Integer webhookId;
thing.SetWebhookId(webhookId);

Parameters

Type Name Description
Integer webhookId Primary Key. Unique ID for this webhook.

Returns

Type Description
Void