Interface ISystemWebhookPlugin
Webhook plugin - there is only one of these per system (as determined by the plugin priority). The plugin handles broadcasting the HTTP hooks to subscribing systems, and saving and storing the plugin info. Plugins must be marked with the CustomWebhookPluginAttribute to be found by the class factory.
Inherited Members
Namespace: SuperOffice.CRM.Webhooks
Assembly: SoDataBase.dll
Syntax
public interface ISystemWebhookPlugin : ICustomWebhookPlugin, IPlugin
Methods
DeleteWebhook(Int32)
Remove a given webhook from storage.
Declaration
void DeleteWebhook(int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id |
GetAllWebhooks(String, String, String, Nullable<WebhookState>)
Return all the stored webhooks.
Declaration
IEnumerable<Webhook> GetAllWebhooks(string name = null, string eventName = null, string appToken = null, Nullable<WebhookState> state = null)
Parameters
Type | Name | Description |
---|---|---|
String | name | Optional name of webhook to filter on. |
String | eventName | Optional name of event to filter list of webhooks on. Default NULL for no filter. |
String | appToken | Optional appToken name to filter on. |
Nullable<WebhookState> | state | Optional state to filter list of webhooks on. |
Returns
Type | Description |
---|---|
IEnumerable<Webhook> | List of webhooks (that are listening to eventName) |
GetLastError(Int32)
Return most recent error message received from webhook target.
Declaration
string GetLastError(int webhookId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | webhookId | webhook definition id |
Returns
Type | Description |
---|---|
String | String containing most recent error message received from webhook target. |
GetWebhook(Int32)
Get a single webhook by id
Declaration
Webhook GetWebhook(int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id | primary key for webhook |
Returns
Type | Description |
---|---|
Webhook | The given webhook, or NULL if no found |
SaveWebhook(Webhook)
Store/Create a webhook.
Declaration
Webhook SaveWebhook(Webhook webhook)
Parameters
Type | Name | Description |
---|---|---|
Webhook | webhook | webhook to store. Create new hook if id=0 |
Returns
Type | Description |
---|---|
Webhook | Updated webhook, with primary key set. |
TestWebhook(Webhook)
Test invoke a webhook with a PING event to see if it works.
Declaration
WebhookResponse TestWebhook(Webhook webhook)
Parameters
Type | Name | Description |
---|---|---|
Webhook | webhook | webhook definition |
Returns
Type | Description |
---|---|
WebhookResponse | True if the webhook invocation worked, False if we did not get 200 OK. NULL is treated as failure. |