Show / Hide Table of Contents

Class NSWebhook

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

Syntax

Constructors

NSWebhook()

Initializes a new instance of the NSWebhook class.

Declaration
NSWebhook

Methods

GetEvents()

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

Declaration
String[] GetEvents()
Returns
Type Description
String[]

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

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

GetHeaders()

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

Declaration
Map GetHeaders()
Returns
Type Description
Map

Custom HTTP Headers to add to webhook requests.

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

GetName()

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

Declaration
String GetName()
Returns
Type Description
String

Name to identify this webhook. Does not have to be unique.

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

GetProperties()

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

Declaration
StringObjectDictionary GetProperties()
Returns
Type Description
StringObjectDictionary

Custom values to inject into JSON body of webhook call.

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

GetRegistered()

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

Declaration
DateTime GetRegistered()
Returns
Type Description
DateTime

Registered when.

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

GetRegisteredAssociate()

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

Declaration
NSAssociate GetRegisteredAssociate()
Returns
Type Description
NSAssociate

The user that created the webhook.

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

GetSecret()

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

Declaration
String 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.

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

GetState()

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

Declaration
Integer GetState()
Returns
Type Description
Integer

Webhook status, should we post events to the URL? See WebhookState.

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

GetTargetUrl()

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

Declaration
String GetTargetUrl()
Returns
Type Description
String

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

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

GetType()

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

Declaration
String GetType()
Returns
Type Description
String

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

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

GetUpdated()

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

Declaration
DateTime GetUpdated()
Returns
Type Description
DateTime

Last updated when.

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

GetUpdatedAssociate()

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

Declaration
NSAssociate GetUpdatedAssociate()
Returns
Type Description
NSAssociate

The user that last updated the webhook.

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

GetWebhookId()

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

Declaration
Integer GetWebhookId()
Returns
Type Description
Integer

Primary Key. Unique id for this webhook.

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

SetEvents(String[])

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

Declaration
Void SetEvents(String[] events)
Parameters
Type Name Description
String[] events

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

Returns
Type Description
Void
Examples
NSWebhook thing;
String[] events;
thing.SetEvents(events);

SetHeaders(Map)

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

Declaration
Void SetHeaders(Map headers)
Parameters
Type Name Description
Map headers

Custom HTTP Headers to add to webhook requests.

Returns
Type Description
Void
Examples
NSWebhook thing;
Map headers;
thing.SetHeaders(headers);

SetName(String)

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

Declaration
Void SetName(String name)
Parameters
Type Name Description
String name

Name to identify this webhook. Does not have to be unique.

Returns
Type Description
Void
Examples
NSWebhook thing;
String name;
thing.SetName(name);

SetProperties(StringObjectDictionary)

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

Declaration
Void SetProperties(StringObjectDictionary properties)
Parameters
Type Name Description
StringObjectDictionary properties

Custom values to inject into JSON body of webhook call.

Returns
Type Description
Void
Examples
NSWebhook thing;
StringObjectDictionary properties;
properties.insertInteger("foobar", 42);
thing.SetProperties(properties);

SetRegistered(DateTime)

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

Declaration
Void SetRegistered(DateTime registered)
Parameters
Type Name Description
DateTime registered

Registered when.

Returns
Type Description
Void
Examples
NSWebhook thing;
DateTime registered;
thing.SetRegistered(registered);

SetRegisteredAssociate(NSAssociate)

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

Declaration
Void SetRegisteredAssociate(NSAssociate registeredAssociate)
Parameters
Type Name Description
NSAssociate registeredAssociate

The user that created the webhook.

Returns
Type Description
Void
Examples
NSWebhook thing;
NSAssociate registeredAssociate;
thing.SetRegisteredAssociate(registeredAssociate);

SetSecret(String)

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

Declaration
Void SetSecret(String 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
Examples
NSWebhook thing;
String secret;
thing.SetSecret(secret);

SetState(Integer)

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

Declaration
Void SetState(Integer state)
Parameters
Type Name Description
Integer state

Webhook status. Should we post events to the URL? See WebhookState.

Returns
Type Description
Void
Examples
NSWebhook thing;
Integer state;
thing.SetState(state);

SetTargetUrl(String)

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

Declaration
Void SetTargetUrl(String targetUrl)
Parameters
Type Name Description
String targetUrl

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

Returns
Type Description
Void
Examples
NSWebhook thing;
String targetUrl;
thing.SetTargetUrl(targetUrl);

SetType(String)

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

Declaration
Void SetType(String 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
Examples
NSWebhook thing;
String type;
thing.SetType(type);

SetUpdated(DateTime)

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

Declaration
Void SetUpdated(DateTime updated)
Parameters
Type Name Description
DateTime updated

Last updated when.

Returns
Type Description
Void
Examples
NSWebhook thing;
DateTime updated;
thing.SetUpdated(updated);

SetUpdatedAssociate(NSAssociate)

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

Declaration
Void SetUpdatedAssociate(NSAssociate updatedAssociate)
Parameters
Type Name Description
NSAssociate updatedAssociate

The user that last updated the webhook.

Returns
Type Description
Void
Examples
NSWebhook thing;
NSAssociate updatedAssociate;
thing.SetUpdatedAssociate(updatedAssociate);

SetWebhookId(Integer)

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

Declaration
Void SetWebhookId(Integer webhookId)
Parameters
Type Name Description
Integer webhookId

Primary Key. Unique ID for this webhook.

Returns
Type Description
Void
Examples
NSWebhook thing;
Integer webhookId;
thing.SetWebhookId(webhookId);
In This Article
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top