Generic Webhook Support

 

GENESIS64, through its WebAPI provider, supports generic webhook support within the IcoWebhook.dll plugin for the IcoWebAPIService. Supported HTTP methods are GET and POST.

 

For OAuth Authorization Code flow, you can use /fwxapi/webhook/oidc/<any string identifying the origin>.

e.g. /fwxapi/webhook/oidc/test

 

For Basic authentication, you have to first configure the origin in IcoWebhook.json (set EnableBasicAuthentication to true):

 

{

  "IcoWebhook": {

    "Basic": {

      "EnableBasicAuthentication": true,

      "Origins": [

        {

          "Origin": "test",

          "ClientId": "Test",

          "ClientSecretVariableName": "Ico_Test_Password",

          "FwxUserName": "Test",

          "FwxPasswordVariableName": "Ico_Test_Password"

        }

      ]

    }

  }

}

 

ClientId describes the user name in the incoming request.

 

ClientSecretVariableName is an environment variable name that contains the client secret; in this case, the "password" expected in the request.

 

FwxUserName/FwxPasswordVariableName then describes the user to be used when triggering the alarm in ICONICS Platform Services. For security reasons, one should use different credentials for the incoming request and for FrameWorX communication..

 

Then, the request can use the following URL: /fwxapi/webhook/basic/<any string identifying the origin>.

e.g. /fwxapi/webhook/basic/test.

 

Incoming requests are going to be converted to alarms in the svrsim:message alarm source. You can see the messages in AlarmWorX Viewer.

 

To handle the requests using BridgeWorX, create a new template and use the JSON Content Reader with an expression x={{triggerVariable:Message}}. The JSON contains all information about the request including the origin, method, query parameters, and the body content. To parse the body content, you can connect another JSON reader to the previous one and set it's expression as follows: x={{PrevActivityOutput:Row[6].Col[1]}}. Then you can connect other activities for writing parsed values to points, etc.

 

See Also:

Web API

AlarmWorX Viewer

About Bridging

Bridging - Template - JSON_Content_Reader