Skip to main content

Webhook

Purpose

The Webhook target sends variables, devices, alarms, and plugin events to an HTTP endpoint. It supports raw JSON, text notification formats, Markdown notification formats, custom headers, and request signing.

Configure the forwarding group and target through Data Forwarding. This page covers Webhook-specific request settings, templates, and debug actions.

Open the plugin

Open Development Configuration → Data Forwarding and:

  1. Configure and save the forwarding group range, trigger, interval, online filter, and batching.
  2. Add a target, choose Webhook, and fill in the basic target information.
  3. Open Target properties and configure endpoint templates, message format, authentication, scripts, templates, and cache.
  4. Save and enable the group and target, then use Target debug for a read-only probe or a confirmed test request.

Basic target information

SettingDefaultConfiguration
Group-Select a saved forwarding group.
Target name-Required and unique within the group.
EnableEnabledDisable to stop requests.
Log levelInfoTemporarily use Debug for HTTP, signing, or template diagnostics.
Start timeout60 secondsValid range is 1 to 3600 seconds.

Target properties

Message and endpoints

SettingDefaultConfiguration
Message formatRawRaw sends generated JSON; Text wraps it as a DingTalk/WeCom/Feishu text message; Markdown wraps DingTalk/WeCom Markdown. Feishu requires its card format.
Device Topic templateEmptyHTTP/HTTPS URL for device records. Empty disables device posts.
Variable Topic templatehttp://127.0.0.1:7502/ThingsGateway/VariableURL for variable records. ${DeviceName} and ${Name} can be used.
Alarm Topic templateEmptyURL for alarm records; empty disables alarm posts.
Plugin-event Topic templateEmptyURL for plugin-event records; empty disables plugin-event posts.
Request timeout (seconds)10Positive maximum wait for one POST request.

In this plugin, “Topic template” means the final HTTP request URL, not an MQTT Topic. ${field} must exist on the entity or entity-script output.

Security

SettingDefaultConfiguration
Signing secretEmptyDingTalk robot signing Secret only. The target appends timestamp and sign query parameters automatically.
Custom headersEmptyA JSON object of string pairs, for example {"Authorization":"Bearer <token>","X-Environment":"test"}. Invalid JSON causes the request to fail.

The signing secret and headers are sensitive. Signing does not replace a receiver's Token or other required authentication header.

Target-variable properties

Webhook inherits the optional text fields Data1 to Data10, all empty by default. They are not added to HTTP bodies automatically. Configure membership, aliases, trigger, and batching in Data Forwarding.

SettingDefaultConfiguration
Data1 to Data10EmptyProject-specific metadata. Reference values explicitly from an entity script or upload template; never store passwords or tokens here.

Data and scripts

SettingDefaultConfiguration
Detail logDisabledEnable briefly to inspect request payloads or counts.
JSON indentationEnabledDisable to reduce request-body size.
Ignore JSON nullsEnabledDisable when null fields must remain.
Device list uploadEnabledPOST devices as a list; disable for one request per device.
Variable list uploadEnabledPOST variables as a list; disable for one request per variable.
Variable dictionary uploadDisabledApplies only to variable-list mode; groups by DeviceName → Name → Value.
Alarm list uploadEnabledPOST alarms as a list; disable for one request per alarm.
Alarm dictionary uploadDisabledApplies only to alarm-list mode; groups by device and variable.
Plugin-event list uploadEnabledPOST plugin events as a list; disable for one request per event.
Entity scriptsEmptySelect saved device, variable, alarm, or plugin-event scripts before URL and body rendering.

Upload template fields

For each entity in Upload Template Configuration, choose Text or Json and insert ${field} placeholders. Empty content uses default JSON serialization; preview before saving.

EntityAvailable fields
VariableId, Name, DeviceName, Value, RawValue, LastSetValue, CollectGroup, CollectTime, CreateTime, ChangeTime, IsOnline, DataType, Unit, RegisterAddress, OtherMethod, Description, ProtectType, RpcWriteEnable, Remark1 to Remark5, ValueInited, IsMemory
DeviceId, Name, ActiveTime, DeviceStatus, PluginName, Description, LastErrorMessage, Remark1 to Remark5
AlarmAlarmId, VariableId, Name, DeviceName, AlarmCode, AlarmLevel, AlarmLimit, AlarmText, RecoveryCode, AlarmTime, EventTime, FinishTime, ConfirmTime, ConfirmText, AlarmType, EventType, Remark1 to Remark5
Plugin eventDeviceName, ObjectValue

An entity script changes the upload object before endpoint grouping and template rendering. Keep placeholders aligned with the script output. An empty URL template disables that entity type.

Cache and capacity

SettingDefaultConfiguration
Enable failed-write retry cacheDisabledEnable in production to retain failed requests in CacheDB and replay them after recovery.
Cache file maximum rows262144Maximum CacheDB outbox rows; oldest rows are removed after the limit.
Upload chunk size2000Maximum records per write or replay batch.
Memory queue limit100000Maximum in-memory records before CacheDB handoff; sustained overload can still discard old data.
Filter offline dataDisabledFilters offline variables at dequeue; the forwarding-group filter also applies.
Upload concurrency1HTTP clients are reused; keep 1 until receiver rate limits are tested.

Target debug

Open Development Configuration → Data Forwarding, select the forwarding group and target, and open Debug.

HTTP Webhook protocol panel

Webhook HTTP protocol debug panel

Use Probe for DNS and HTTP HEAD only; it never sends a business payload. Use Send test request to send a bounded payload to the current variable URL after confirmation. The test body is limited to 64 KiB.

Do not call production write or delete endpoints during routine debugging. Use a test URL with a small payload.

Verify the target

  1. Configure a test endpoint and request header.
  2. Select Raw, Text, or Markdown according to the receiver's contract.
  3. Send one test variable or event.
  4. Confirm URL, HTTP method, status code, headers, body, and receiver logs.
  5. Check the target log for timeout, authentication, or retry errors.

Troubleshooting

SymptomCheck
HTTP request failsEndpoint URL, HTTP method, TLS certificate, firewall, receiver status code, and target log.
Receiver rejects authenticationCustom header JSON, signing secret, token format, and token expiration.
Receiver accepts request but data is wrongMessage format, template preview, entity fields, and entity-script output.
Notification format is invalidReceiver format requirements: raw JSON, text, Markdown, or platform-specific card format.
Requests time outEndpoint reachability, receiver load, request timeout, and target retry/cache state.
Test request failsRun Probe first, then check the URL, headers JSON, signing secret, message format, and target log.
Signature is rejectedUse the signing secret only for DingTalk signing. The target appends timestamp and sign; do not append them manually.