You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core_concepts/4_webhooks/index.mdx
+41-4Lines changed: 41 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ Webhooks are a way to interact with Windmill using standard web technologies.
9
9
Snippet of a Deno/TypeScript script using only native JavaScript to trigger a
10
10
webhook can be found on [Windmill Hub][script].
11
11
12
-
<br/>
12
+
<br/>
13
13
14
14
Some use cases include triggering scripts and flows from [Slack](/blog/handler-slack-commands) or [Emails](../../integrations/mailchimp_mandrill.md).
15
15
@@ -80,7 +80,6 @@ When using the **synchronous mode**, the webhook returns the result of the scrip
80
80
81
81
When using the **asynchronous mode**, the webhook returns a `uuid` and you can poll the [get job](https://app.windmill.dev/openapi.html#/operations/getJob) API call to fetch the status and results once it is completed.
82
82
83
-
84
83
## User token
85
84
86
85
To interact with Windmill you always need to use `Bearer` token authentication.
@@ -189,9 +188,47 @@ Similarly to request headers, if the query args contain `raw=true`, then an addi
189
188
190
189
## Custom Response Code
191
190
192
-
For all sync run jobs endpoints, if the response contains a key `windmill_status_code` with a number value, that value will be used as the status code.
191
+
For all sync run jobs endpoints, if the response contains a key `windmill_status_code` with a number value, that value will be used as the status code. For example, if a script or flow returns:
192
+
193
+
```json
194
+
{
195
+
"windmill_status_code": 201,
196
+
"result": {
197
+
"Hello": "World"
198
+
}
199
+
}
200
+
```
201
+
202
+
the synchronous endpoint will return:
203
+
204
+
```json
205
+
{
206
+
"Hello": "World"
207
+
}
208
+
```
209
+
210
+
with a status code `201`.
211
+
212
+
Note that if the status code is invalid (w.r.t [RFC9110](https://httpwg.org/specs/rfc9110.html#overview.of.status.codes)), the endpoint will return an error.
213
+
214
+
## Custom Content Type
215
+
216
+
Similarly to the above, for all sync run jobs endpoints, if the response contains a key `windmill_content_type`, the associated value will be used as the content type header of the response. For example, if a script or flow returns:
217
+
218
+
```json
219
+
{
220
+
"windmill_content_type": "text/csv",
221
+
"result": "Hello;World"
222
+
}
223
+
```
224
+
225
+
the synchronous endpoint will return:
226
+
227
+
```csv
228
+
"Hello;World"
229
+
```
193
230
194
-
e.g: `{"windmill_status_code": 201}`
231
+
with the response header: "Content-Type: text/csv".
0 commit comments