Skip to content

Commit 7f56821

Browse files
committed
[transformer/webhook] document embed parameter
Adds documentation for the new `embed` parameter. Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
1 parent 154a9aa commit 7f56821

1 file changed

Lines changed: 43 additions & 1 deletion

File tree

docs/data-routing/3-transformers/9-webhook.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ information.
1515
:::
1616

1717
The `webhook` transformer invokes an external API endpoint and, on success,
18-
replaces the data message content and content type with that of the response.
18+
replaces the data message content and content type with that of the response. If
19+
both the input and output are `application/json` data, the `embed` parameter can
20+
be used to preserve the original data, returning a merged JSON object where the
21+
input data is embedded under the top-level `input` key, and the output data is
22+
returned under the top-level `output` key.
1923

2024
:::info Tip
2125
The `webhook` transformer is not to be confused with the [`webhook` data
@@ -30,6 +34,7 @@ while the data destination delivers the event to an external location.
3034
|---|---|---|:---:|
3135
|`url`|`string`| The URL for the external webhook. ||
3236
|`headers`| Map (`string`: `string`)| Headers to be included in requests. ||
37+
|`embed`| `boolean` | Preserve input data in resulting JSON object. ||
3338

3439
### Example Secrets
3540

@@ -77,3 +82,40 @@ Fahrenheit.
7782
"temp": 89.6
7883
}
7984
```
85+
86+
### Example Usage with `embed: true`
87+
88+
```yaml
89+
transformer:
90+
type: webhook
91+
version: v1
92+
parameters:
93+
url: https://my-webhook.example.com
94+
headers:
95+
x-api-key: $API_KEY
96+
embed: true
97+
```
98+
99+
### Example Input with `embed: true`
100+
101+
```json
102+
{
103+
"temp": 32
104+
}
105+
```
106+
107+
### Example Output with `embed: true`
108+
109+
In this example, the webhook converts Celsius temperature readings to
110+
Fahrenheit, but preserves both values in the output.
111+
112+
```json
113+
{
114+
"input": {
115+
"temp": 32
116+
},
117+
"output": {
118+
"temp": 89.6
119+
}
120+
}
121+
```

0 commit comments

Comments
 (0)