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
CreateDefaultWebhook()
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
Online Restricted: The Webhook agent is not available in Online by default. Access must be requested specifically when app is registered.Declaration
Webhook CreateDefaultWebhook()
Returns
Type | Description |
---|---|
Webhook | New Webhook with default values |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WebhookAgent agent = new WebhookAgent())
{
// call methods on agent here...
}
}
DeleteWebhook(Int32)
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
void DeleteWebhook(int webhookId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | webhookId | The identity of the Webhook |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WebhookAgent agent = new WebhookAgent())
{
// call methods on agent here...
}
}
GetAllWebhooks(String, String, WebhookState)
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
Webhook[] GetAllWebhooks(string nameFilter, string eventFilter, WebhookState statusFilter)
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. |
Returns
Type | Description |
---|---|
Webhook[] | Array of all webhooks, filtered according to given criteria. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WebhookAgent agent = new WebhookAgent())
{
// call methods on agent here...
}
}
GetLastError(Int32)
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
string GetLastError(int webhookId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | webhookId | Webhook to get error message for. |
Returns
Type | Description |
---|---|
String | Error message, or empty string if no errors received |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WebhookAgent agent = new WebhookAgent())
{
// call methods on agent here...
}
}
GetWebhook(Int32)
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
Webhook GetWebhook(int webhookId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | webhookId | The identifier of the Webhook object |
Returns
Type | Description |
---|---|
Webhook | Webhook |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WebhookAgent agent = new WebhookAgent())
{
// call methods on agent here...
}
}
SaveWebhook(Webhook)
Updates the existing Webhook or creates a new Webhook if the id parameter is empty
Online Restricted: The Webhook agent is not available in Online by default. Access must be requested specifically when app is registered.Declaration
Webhook SaveWebhook(Webhook webhook)
Parameters
Type | Name | Description |
---|---|---|
Webhook | webhook | The Webhook that is saved. |
Returns
Type | Description |
---|---|
Webhook | New or updated Webhook |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WebhookAgent agent = new WebhookAgent())
{
// call methods on agent here...
}
}
SignalEvent(String, Int32, StringObjectDictionary)
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
void SignalEvent(string eventName, int primaryKey, StringObjectDictionary data)
Parameters
Type | Name | Description |
---|---|---|
String | eventName | Name of event to fire. 'entity.verb' For example: 'window.closed', 'button.clicked'. |
Int32 | 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 } |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WebhookAgent agent = new WebhookAgent())
{
// call methods on agent here...
}
}
TestWebhook(Webhook)
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
WebhookResult TestWebhook(Webhook webhook)
Parameters
Type | Name | Description |
---|---|---|
Webhook | webhook | Webhook definition to ping. Must contain a valid TargetUrl. |
Returns
Type | Description |
---|---|
WebhookResult | Result of calling webhook. Sucess=true/false + Error message |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (WebhookAgent agent = new WebhookAgent())
{
// call methods on agent here...
}
}