Skip to content

Specify Webhooks for Individual Devices

By default, all measurements send POST data to all measurement webhooks you have defined in the Tenovi web app. However, you can set individual devices to only send data to specific webhooks using device properties. This involves

  1. Getting the measurement_webhook_id of the webhook you wish to send data to
  2. Set the device propery on an individual device to send data to only this webhook

Getting measurement_webhook_id

You can retrieve a list of all your webhooks by using our GET /webhooks/ endpoint:

Terminal window
/hwi/webhooks/

This will return an object for each of your webhooks you have defined. You will need the id of the webhook for the next step (setting up a device property to send data to only this webhook).

[
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"created": "2019-08-24T14:15:22Z",
"modified": "2019-08-24T14:15:22Z",
"endpoint": "http://example.com/measurements",
"auth_header": "string",
"auth_key": "string",
"event": "MEASUREMENT",
"post_as_array": true,
"enabled_by_default": true
}
]

Setting measurement_webhook_id Device Property

Using device properties, you can set key-value pairs attached to individual devices. A special device property is the measure_webhook_id which accepts the id you pulled in the previous step.

Creating this device property involves sending a POST request to this API endpoint which uses the hwi_device_id of the specific device.

Terminal window
/hwi/hwi-devices/{hwi_device_id}/properties/

Attaching a JSON object to the body of your request assigns this device to only send data to the specified webhook.

{
"key": "medasure_webhook_id",
"value": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
}