Skip to content

Commit 3bf9cff

Browse files
authored
webhook docs update, add more info on path and query (#340)
1 parent 1078d47 commit 3bf9cff

File tree

2 files changed

+70
-3
lines changed

2 files changed

+70
-3
lines changed

docs/cloud/concepts/webhook-config.mdx

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ transforms:
1919
webhook:
2020
outputParts: [body | full (default)]
2121
outputType: [text | json (default)]
22+
outputUri: [none | full (default)]
2223
```
2324
2425
## Config options
@@ -42,10 +43,40 @@ The output record from the webhook request is configurable
4243
* `body` - Only return the body of the request
4344

4445
`outputType` options:
45-
* `json`- Output is parsed into json (Default)
46-
* `text` - Output is plaintext
46+
* `json`- Output is parsed into json
47+
* `text` - Output is plaintext (Default)
4748

49+
`outputUri` options:
50+
* `full` - Parse URI path and query parameters into output
51+
* `none` - Don't parse path and query parameters into output (Default)
52+
* `path` - Only record path into the output
53+
* `query` - Only record query parameters into the output
54+
55+
## output behavior
56+
57+
If `outputUri` behavior is fully enabled, information from the URI call is encoded in
58+
the webhook records.
59+
60+
A http webhook connection to a URI of `https://infinyon.cloud/webhooks/v1/[uri-key]/path1/path2/path3?p1=1&param2=2`
61+
will return path and query information as follows:
62+
* path: `path1/path2/path3`
63+
* query: `p1=1&param2=2`
64+
65+
:::note
66+
67+
If intending to process URI `path` & `query` information with Smartmodule
68+
transformations, it is recommended to also configure `outputType` to json.
69+
The path and query parameters will be part of the json object and can be
70+
directly operated upon by the Smartmodule.
71+
72+
See the How to Use WebHooks: [URI path & query] section for an example of
73+
the json object.
74+
75+
:::
4876

4977
## References
5078

51-
* [How to Use WebHooks]: ../how-to/use-webhooks.mdx
79+
* [How to Use WebHooks]
80+
81+
[How to Use WebHooks]: ../how-to/use-webhooks.mdx
82+
[URI path & query]: ../how-to/use-webhooks.mdx#webhook-path-and-query-info

docs/cloud/how-to/use-webhooks.mdx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,42 @@ The consumer should now show the following output:
148148
}
149149
```
150150

151+
### Webhook Path and Query info
152+
153+
A curl with path and query info to `https://infinyon.cloud/webhooks/v1/[uri-key]/path_a/path_b?param_a=1&param_b=2` can be sent as follows: *(note the single quotes around the URI)*
154+
155+
```bash
156+
$ curl -v -X POST -H "Content-Type: application/json" -d '{"key": "value"}' \
157+
'https://infinyon.cloud/webhooks/v1/[uri-key]/path_a/path_b?param_a=1&param_b=2'
158+
```
159+
The consumer should show return path and query information as follows:
160+
161+
```json
162+
{
163+
"body": {
164+
"key": "value"
165+
},
166+
"headers": {
167+
"accept": "*/*",
168+
"accept-encoding": "gzip, br",
169+
"content-length": "16",
170+
"content-type": "application/json",
171+
"host": "infinyon.cloud",
172+
"user-agent": "curl/x.y.z",
173+
"x-forwarded-for": "..."
174+
},
175+
"path": "path_a/path_b",
176+
"query": "param_a=1&param_b=2"
177+
}
178+
```
179+
180+
:::note
181+
182+
Json output is the recommended way to receive uri `path` and `query` information
183+
so that Smartmodule transformation can be directly applied. See [Webhook Config] for more details.
184+
185+
:::
186+
151187
## Conclusion
152188

153189
You now know how to create and configure the output of Webhooks. Check out the [Webhook Config] reference to see how to configure other transformations.

0 commit comments

Comments
 (0)