webhook
Latest Version | v1.0.0 |
Input Content Type | Any |
Output Content Type | Any |
Sending data to a webhook for transformation incurs usage costs after exceeding the free tier. See Golioth pricing for more information.
The webhook
transformer invokes an external API endpoint and, on success,
replaces the data message content and content type with that of the response. If
both the input and output are application/json
data, the embed
parameter can
be used to preserve the original data, returning a merged JSON object where the
input data is embedded under the top-level input
key, and the output data is
returned under the top-level output
key.
The webhook
transformer is not to be confused with the webhook
data
destination. The transformer allows for
modifying the content of a data message in a pipeline via an external API call,
while the data destination delivers the event to an external location.
Parameters
Parameter | Type | Description | Required |
---|---|---|---|
url | string | The URL for the external webhook. | ✅ |
headers | Map (string : string ) | Headers to be included in requests. | |
embed | boolean | Preserve input data in resulting JSON object. |
Example Secrets
API_KEY
sup3rs3cr3t
Example Usage
transformer:
type: webhook
version: v1
parameters:
url: https://my-webhook.example.com
headers:
x-api-key: $API_KEY
Example Input
{
"temp": 32
}
The following headers will be present on all requests to external webhooks, in addition to any defined in the parameters.
Ce-Source
: ID of deviceCe-Subject
: ID of projectCe-Type
: Prefixed path (if path is/sensor
, the value will beio.golioth.data.v1/.s/sensor
)Content-Type
: the content type of the data message payload
Example Output
In this example, the webhook converts Celsius temperature readings to Fahrenheit.
{
"temp": 89.6
}
Example Usage with embed: true
transformer:
type: webhook
version: v1
parameters:
url: https://my-webhook.example.com
headers:
x-api-key: $API_KEY
embed: true
Example Input with embed: true
{
"temp": 32
}
Example Output with embed: true
In this example, the webhook converts Celsius temperature readings to Fahrenheit, but preserves both values in the output.
{
"input": {
"temp": 32
},
"output": {
"temp": 89.6
}
}