OnSight Webhooks
OnSight webhooks send device telemetry to an external HTTP endpoint. They are intended for integrations that need to process OnSight sensor readings, device observations, or text data without polling the OnSight API. Production endpoints should use HTTPS.
Each webhook belongs to either a device or a zone. OnSight collects messages independently for each webhook and sends them as a JSON array in an HTTP POST request.
Webhook Scope
Device Webhooks
A device webhook receives telemetry for one configured device, regardless of which zone reports the device.
Use a device webhook when the receiving system needs a dedicated stream for a specific asset or device.
Zone Webhooks
A zone webhook receives telemetry reported in the configured zone. Messages from different devices are accumulated into the same webhook batch when they are reported in that zone.
Use a zone webhook when the receiving system processes activity for a site, room, work area, or other operational zone.
A message can be delivered to both a device webhook and a zone webhook. Each webhook is an independent subscription with its own endpoint, credentials, batching settings, and delivery state.
Creating a Webhook
Administrators can create webhooks from the Webhooks section of a device or zone in the OnSight Admin application.
Configure the following fields:
| Field | Description |
|---|---|
| Name | A descriptive name used to identify the integration in OnSight. |
| URL | The endpoint that receives webhook requests. Production integrations should use HTTPS. |
| Authentication method | No authentication, API key, or JWT bearer authentication. |
| Batch interval | Optional maximum time, in seconds, that the oldest queued message waits before a batch is sent. |
| Maximum messages | Optional maximum number of messages in one request. |
| Maximum size | Optional maximum uncompressed JSON request-body size in KB. |
Batch settings are independent. Leave a setting blank when that limit is not required.
Supported ranges are:
- batch interval: 1 to 86,400 seconds
- maximum messages: 1 to 10,000
- maximum size: 1 to 10,240 KB
When OnSight Sends a Batch
OnSight starts the batch interval when the first message enters an empty webhook queue. It sends the batch when the first of these conditions occurs:
- the batch interval expires
- the maximum message count is reached
- the maximum JSON body size is reached
When no interval is configured, queued messages are eligible for immediate delivery. The webhook service checks due batches approximately once per second.
OnSight splits a batch before it would exceed a configured message-count or size limit. Messages that do not fit remain queued for the next request. If one message is larger than the configured size limit, OnSight sends that message by itself so it is not permanently blocked.
The size limit is calculated from the UTF-8 encoded, uncompressed JSON array, including its brackets and separators. HTTP compression does not change this calculation.
HTTP Request
OnSight sends each batch as an HTTP POST request.
Standard request properties include:
Content-Type: application/json
Accept: */*
Cache-Control: no-cache
User-Agent: OnSight Core
The request body is always a JSON array, including when it contains only one message.
[
{
"deviceId": "a24da7d6-e706-4d5c-bf7c-358f25e3267f",
"gatewayDeviceId": "d591c42f-7d3c-4c0a-902b-29cc70d851f9",
"companyId": "f0876383-7335-4214-acb1-dcab890fcfd8",
"reportedTime": "2026-08-21T02:15:31.482+00:00",
"processedTime": "2026-08-21T02:15:31.701+00:00",
"sensorDatas": [
{
"type": "Temperature",
"values": [
{
"type": "Temperature",
"value": 21.7,
"calibrationLow": null,
"calibrationRange": null,
"referenceLow": null,
"referenceRange": null,
"tags": null
}
],
"gatewayId": null
}
],
"zoneId": "7b72321a-e30a-4684-9a91-4081245f70df",
"textData": null
}
]
A request may contain messages from more than one device when it is sent by a zone webhook.
Payload Reference
Each object in the array represents one processed device message.
| Property | Type | Description |
|---|---|---|
deviceId |
UUID | The OnSight device that produced the telemetry. |
gatewayDeviceId |
UUID | The OnSight device record associated with the reporting gateway. |
companyId |
UUID | The company that owns the device. |
reportedTime |
ISO 8601 timestamp | The time reported by the device or gateway. |
processedTime |
ISO 8601 timestamp | The time OnSight processed the message. |
sensorDatas |
Array | Resolved sensor groups contained in the message. |
zoneId |
UUID or null | The zone through which the message was reported. |
textData |
String or null | Optional text supplied with the device message. |
Each sensorDatas entry contains:
| Property | Type | Description |
|---|---|---|
type |
String | The sensor type, such as Temperature, Humidity, Battery, Gps, or Button1. |
values |
Array | One or more values produced by that sensor. |
gatewayId |
UUID or null | The gateway associated with a gateway-level sensor value, when applicable. |
Each sensor value contains a string type, numeric value, and optional calibration, reference, and tag metadata. Enum values are serialized as their names rather than numeric enum values.
Fields with no value may be present as null. Receivers should tolerate additional fields so OnSight can extend message metadata without breaking the integration.
Authentication
No Authentication
OnSight sends the request without an integration-specific authorization header.
API Key
OnSight sends the configured key in the x-api-key header:
x-api-key: configured-api-key
The receiving endpoint is responsible for validating the key and returning an appropriate HTTP status.
JWT Bearer Authentication
For JWT authentication, configure a login URL, username, and password. OnSight requests a token by sending this JSON object to the login URL:
{
"username": "integration-user",
"password": "integration-password"
}
The login endpoint must return a successful response containing a JWT in a top-level token property:
{
"token": "eyJhbGciOi..."
}
OnSight caches the token and requests a replacement before it expires. Webhook requests carry the token as a bearer credential:
Authorization: Bearer eyJhbGciOi...
Delivery and Retries
Any HTTP status from 200 through 299 acknowledges the entire batch. OnSight then removes those messages from the webhook queue.
If the endpoint returns a non-success status, times out, or cannot be reached, OnSight restores the complete batch to the front of the queue and schedules another attempt. Message order is retained within each webhook queue.
Webhook delivery is at least once. A receiver can successfully process a request while OnSight fails before recording the acknowledgement, causing the batch to be delivered again. Receiving systems must therefore make processing idempotent and tolerate duplicate messages.
A practical deduplication key can combine stable message properties such as deviceId, gatewayDeviceId, reportedTime, and the sensor values. Receivers should only return a success status after the complete request has been accepted for durable processing.
Receiver Requirements
A webhook receiver should:
- accept HTTP
POSTrequests with anapplication/jsonarray body - accept arrays containing one or many messages
- process messages from multiple devices when subscribed at zone scope
- return a
2xxstatus only after durably accepting the entire batch - return a non-
2xxstatus when the entire batch should be retried - process requests idempotently because duplicate delivery is possible
- allow for request bodies up to the webhook's configured maximum size
- respond within 100 seconds
- preserve sufficient logs to correlate failures by device, gateway, zone, and timestamp
Do not rely on requests arriving one message at a time. Do not rely on batches always reaching their configured maximum; low-volume batches are sent when their interval expires.
Configuration Changes
Webhook configuration is cached briefly by the delivery service. Changes to URLs, credentials, scope, or batching settings may take up to approximately 60 seconds to apply to messages already being processed.
Changing a webhook does not merge its queue with another webhook. Each webhook record remains an independent delivery stream.
Troubleshooting
No requests arrive
Check that:
- the webhook is configured on the intended device or zone
- the device is actively reporting telemetry
- zone messages contain the expected zone assignment
- the endpoint URL is reachable from OnSight
- firewalls and allowlists permit outbound OnSight traffic
- the batch interval has elapsed
Requests arrive later than expected
Check the configured batch interval. A low-volume webhook normally waits until the interval expires. Delivery can also be delayed while an unavailable endpoint is being retried.
Requests are split into several arrays
The maximum message count or maximum size was reached. OnSight sends the messages that fit and immediately schedules the remainder as another batch.
The same message appears more than once
Duplicate delivery is possible under the at-least-once delivery model. Verify that the receiver uses an idempotent processing or deduplication strategy.
Authentication fails
For API keys, confirm that the receiver reads the x-api-key header. For JWT authentication, confirm that the login URL accepts the documented username/password body, returns a valid JWT in token, and that the webhook endpoint accepts the resulting bearer token.
OnSight repeatedly retries a request
Review the endpoint's response status and logs. A non-2xx response rejects the complete batch. Ensure the receiver can accept the configured body size and finishes processing within the request timeout.