WebHooks
#
WorkingTo integrate kelvin events with your own application, you need to have public and private keys which are required for signing and verifying data. These keys can be generated from the kelvin portal. You need to be an administrator or a super user in order to create these keys. (For more information on Roles check out this [link]). You can find the keys in Integrations section of myaccount on kelvin portal.
#
Creating a Web Hook.- Login to the kelvin portal.
- Click on the profile icon for a drop down to show up.
- Select
Company Profile
from the dropdown. - Click on the Integrations Tab in the
Company Profile
section - Now Click on Create Integration button, once clicked a dialog box would show up.
- Give a application id to your webhook.
- Now select webhook from the integration type dropdown which contains "API Key" and "Web Hook" as options.
- Now select the version of the webhook, it should be v2.0.
- Also, give the Application URL (if any) of your application to which data should be sent.
- Now click on Save and a CSV file is downloaded with public, private keys. These keys can be used for verifying the request source..
#
Data Format.For version v1.0, request body is sent in JSON format. Following is the typical data format.
Device Ping Request Body Format:
Device Ping Request Body Example:
If you select v2.0 for the webhooks then the request body is in the following format.
The timestamp and signature are to be sent in headers, as shown below.
Device Ping Request Body Format:
Device Ping Request Body Example:
#
Verfiying the request source.Once the webhooks public and private keys are successfully generated, request body will be posted
to the endpoint URL that is saved. From your end, once the request is received, it can be checked
for the authentic source using the public key generated in the ‘Create Integration step’.
Kelvin uses Elliptic Curve Digital Signature Algorithm for digitally signing the payload.
Specifically, we use the starkbank-ecdsa library. You can use the same library (has implementations
in Go, Java) to verify the data source. You can find the libraries at https://github.com/starkbank
Request verification example can be found at https://www.npmjs.com/package/starkbank-ecdsa