Skip to main content

Webhook Integration

TrackLab's automation engine can react to system events in real time — measurements arriving from collectors, device parameters changing, weather thresholds being crossed, or external systems posting data via inbound webhooks. When an automation rule matches, it can execute actions such as sending notifications (including outbound webhook calls), setting device parameters, or transitioning lifecycle statuses.

This guide covers the two webhook-related surfaces:

  • Inbound webhook sources — endpoints you create so external systems can push data into TrackLab and trigger automation rules.
  • Outbound webhook notifications — HTTP calls TrackLab makes to your system when an automation rule fires a "send notification" action configured with a webhook channel.

Creating an inbound webhook source

Inbound webhook sources are scoped to a company and optionally to a specific farm. They allow external systems to post JSON payloads into TrackLab, which are then processed as automation events.

To create a source:

  1. Navigate to Automation > Webhooks.
  2. Click Add Webhook Source.
  3. Enter a name for the source.
  4. Optionally select a farm to scope incoming events to that farm.
  5. Click Save.

On creation, TrackLab generates:

  • An ingest endpoint URL — the URL your external system will POST to.
  • A shared secret (64 random characters) — used to authenticate requests.

The secret is shown only once at creation time. Copy it immediately and store it securely.

Ingest endpoint format

POST /api/v1/c/{companySlug}/automation/webhook-sources/{sourceUuid}/ingest

Rotating a secret

If a secret is compromised, rotate it:

  1. Find the webhook source in the list.
  2. Click the actions menu and select Rotate Secret.
  3. Confirm the action.

The old secret is invalidated immediately. Update your external system with the new secret right away — any requests using the old secret will be rejected.

Deleting a source

Deleting a webhook source disables its ingest endpoint permanently. Any automation rules that reference events from this source will no longer receive new events from it.

Event sources

TrackLab's automation engine processes events from several source types. Each source type represents a different category of data entering the system.

Source typeSlugDescription
MeasurementmeasurementA collector reports a new measurement value (e.g., angle, current, voltage).
ParameterparameterA device parameter value changes (e.g., configuration setting updated).
Weather observedweather-observedAn observed weather metric is recorded at a farm (e.g., current wind speed).
Weather forecastweather-forecastA forecasted weather metric is received for a farm.
Manual APImanual-apiAn event fired manually via the API or the automation testing UI.
Inbound webhookinbound-webhookAn external system posts data to a TrackLab webhook source endpoint.
Data silencedata-silenceA collector has not sent measurements within the configured threshold.

Trigger subject types

When creating an automation rule, you choose a trigger subject type that determines what kind of value the rule evaluates:

Trigger subjectSlugDescription
Measurement valuemeasurement-valueEvaluate against a numeric measurement from a collector.
Parameter valueparameter-valueEvaluate against a device parameter value.
Weather metricweather-metricEvaluate against a weather metric (observed or forecast).
Manual eventmanual-eventTrigger on a manually fired event.
Webhook eventwebhook-eventTrigger on an inbound webhook payload.

Condition operators

Conditions within a rule's trigger use operators to compare the actual value against a threshold. Conditions can be grouped with and / or logic.

Numeric operators

OperatorSlugDescription
Greater thangtActual value is above the threshold.
Greater than or equalgteActual value is at or above the threshold.
Less thanltActual value is below the threshold.
Less than or equallteActual value is at or below the threshold.
EqualeqActual value equals threshold (floating-point safe).
Not equalneqActual value does not equal threshold.
BetweenbetweenActual value falls within a min/max range (inclusive).

String operators

OperatorSlugDescription
EqualeqExact string match.
Not equalneqStrings are not identical.
ContainscontainsActual value contains the threshold substring.
RegexregexActual value matches the threshold regular expression.

Weather metrics

When the trigger subject is weather-metric, the following metrics are available:

MetricSlug
Wind speedwind-speed
Wind gustwind-gust
Temperaturetemperature
Humidityhumidity
Rainfallrainfall

Action types

When a rule's conditions match, one or more actions execute. The available action types are:

ActionSlugDescription
Send notificationsend-notificationDispatch a notification via a configured channel (email, push, or webhook).
Set parameterset-parameterWrite a new value to a device parameter on the target collector.
Set parameter (broadcast to NCU children)set-parameter-broadcast-ncu-childrenWrite a parameter value to all child devices of an NCU.
Transition lifecycle statustransition-lifecycle-statusMove a collector to a different lifecycle status.

Action targets

Actions can be scoped to different target levels:

TargetSlug
Collectorcollector
Device groupdevice-group
Farmfarm
NCUncu
NCU childrenncu-children

Failure modes

Each action can be configured with a failure mode:

ModeSlugBehavior
Continue on failurecontinue-on-failureIf this action fails, subsequent actions still execute.
Stop on failurestop-on-failureIf this action fails, remaining actions in the rule are skipped.

Authentication and security

Shared secret authentication

Both inbound webhook sources and test webhook endpoints use shared-secret authentication via the X-TrackLab-Webhook-Secret header.

When sending a request to a TrackLab ingest endpoint, include the secret as a header:

X-TrackLab-Webhook-Secret: <your-secret>

TrackLab hashes the provided secret with SHA-256 and compares it against the stored hash using a timing-safe comparison. If the secret is missing or invalid, the request is rejected with a 401 Unauthorized response.

Security recommendations

  • Store secrets securely. Use environment variables or a secrets manager — never hard-code them.
  • Rotate secrets periodically or immediately if you suspect compromise.
  • Use HTTPS. All TrackLab API endpoints require TLS.

Inbound webhook payload format

When an external system posts to an inbound webhook source, TrackLab wraps the payload and dispatches it as an automation event.

Request format

Send a JSON POST request to the ingest endpoint:

curl -X POST \
'https://app.tracklabsolar.com/api/v1/c/{companySlug}/automation/webhook-sources/{sourceUuid}/ingest' \
-H 'Content-Type: application/json' \
-H 'X-TrackLab-Webhook-Secret: <your-secret>' \
-d '{"sensorId": "WS-001", "windSpeed": 45.2, "unit": "km/h"}'

Stored event payload

The automation event stores the data in this structure:

{
"webhook_source": "My Weather Station",
"webhook_source_uuid": "a1b2c3d4-...",
"payload": {
"sensorId": "WS-001",
"windSpeed": 45.2,
"unit": "km/h"
}
}

The payload field contains exactly what your external system sent. The webhook_source and webhook_source_uuid fields are added automatically from the webhook source configuration.

Response

A successful ingest returns 202 Accepted:

{
"success": true,
"data": {
"eventDispatched": true
}
}

The event is dispatched to a background job for processing. Automation rules that match the event will execute asynchronously.

Rule configuration

An automation rule ties together a trigger, conditions, and actions. Key configuration options include:

FieldDescription
NameHuman-readable rule name.
Statusenabled, disabled, or paused.
Cooldown minutesMinimum time between consecutive executions of this rule. Prevents a noisy event from flooding actions.
Auto-clearWhether the rule automatically clears after a configurable period.
Clear after secondsHow long before the rule auto-clears (when auto-clear is enabled).
Evaluation period secondsTime window over which events are evaluated.
Evaluation count thresholdNumber of matching events required within the evaluation period before the rule fires.

Match suppression

When a rule matches, it can be suppressed:

StatusSlugMeaning
MatchedmatchedRule matched and actions executed.
Suppressed (cooldown)suppressed-cooldownRule matched but was within the cooldown period.
Suppressed (threshold)suppressed-thresholdRule matched but the evaluation count threshold was not met.
FailedfailedRule matching failed due to an error.

Testing

The automation testing tab provides tools to validate rules before they go live.

Fire test event

Dispatch a synthetic event into the automation engine to see which rules match and what actions would execute.

Dry-run match

Test a rule's condition logic against a sample value without actually executing any actions. This is useful for verifying that your condition operators and thresholds are configured correctly.

Preview template

Render a notification template with sample data to see the output before it is sent.

Send test notification

Dispatch a real notification through a configured channel to verify delivery.

Webhook test inbox

The webhook test inbox lets you capture and inspect outbound webhook deliveries without needing an external endpoint.

  1. Create a test webhook endpoint from the Testing tab (or use the one-step setup endpoint).
  2. Configure a notification channel's webhook to point at the test inbox ingest URL.
  3. Fire a test event or trigger a rule.
  4. Inspect the captured request in the inbox — headers, payload, query parameters, and raw body are all recorded.

The test inbox uses the same X-TrackLab-Webhook-Secret authentication as production webhook sources. Secrets for test endpoints can also be rotated independently.

Example: wind alert webhook

This example walks through setting up an automation rule that sends a webhook notification when observed wind speed exceeds a threshold.

1. Create a notification channel

Set up a webhook notification channel pointing at your external system:

  • Channel type: Webhook
  • Webhook URL: https://your-system.example.com/alerts
  • Headers: Add X-TrackLab-Webhook-Secret with a shared secret, plus any other headers your system requires.

2. Create a notification policy

Link the channel to a notification template:

  • Channel: The webhook channel from step 1.
  • Template: A template that formats the alert message (e.g., including the metric value and farm name).

3. Create the automation rule

  • Name: "High wind alert"
  • Status: Enabled
  • Cooldown: 5 minutes (prevents repeated alerts for sustained wind)
  • Scope: Select the farm(s) to monitor.

4. Configure the trigger

  • Subject type: Weather metric (weather-metric)
  • Metric: Wind speed (wind-speed)

5. Add a condition

  • Operator: Greater than (gt)
  • Threshold: 40 (km/h, or whatever unit your weather station reports)

6. Add the action

  • Action type: Send notification (send-notification)
  • Notification policy: The policy from step 2.

7. Test it

Use Fire Test Event or Dry-Run Match from the Testing tab to verify the rule matches and the notification reaches your endpoint. Use the Webhook Test Inbox to capture the outbound call if you want to inspect the payload before pointing at your production system.