WindmillWWindmill
Powered by
Tiago SerafimT
Windmill•3y ago•
11 replies
Tiago Serafim

Using QueryString params inside a POST webhook

Hey all,

I'd like to suggest adding to the webhook handling a way to include the
payload
payload
parameter on POSTs requests.
This parameter would be passed to the script that accepts POST requests, merging the payload from the query string with the JSON data from the POST request.

Example
For example, a request might look like this:

/api/w/admins/jobs/run_wait_result/p/u/user/undisputed_script?include_header=X-Sign,foo&payload=${encodeURIComponent(btoa(JSON.stringify({id: 42})))}
/api/w/admins/jobs/run_wait_result/p/u/user/undisputed_script?include_header=X-Sign,foo&payload=${encodeURIComponent(btoa(JSON.stringify({id: 42})))}


In this case, the
payload
payload
parameter from the query string would be combined with the JSON data from the POST request, making both available inside the webhook.

Motivation
I'm working on an async service that runs on Lambda. This service accepts a webhook that is POSTed to when the service completes.

Here's a typical use case:

1. Inside a flow, I call a third-party API, specifying another script as the webhook endpoint.
2. The flow is suspended.
3. The specified script is eventually called, receiving the ID of the suspended job in its
payload
payload
query string.
4. The script verifies the signature using the X-Sign header and resumes the flow using its ID by calling JobService.resumeSuspendedFlowAsOwner.

Alternatives
If merging the payload seems too confusing, we might consider another approach, such as adding an argument like
qs=true
qs=true
. This would pass down all the query string data to the POST script without merging it with the JSON.

I asked about this issue couple of weeks ago and I thought I understood the proposed alternative, but I couldn't figure out how to work with the suspended flow and another script without somehow using a storage to map the resume URL with a
job_id
job_id
returned by the service. I am still not sure if I'm missing something obvious about this issue. Thanks again!
WindmillJoin
3,362Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?
Recent Announcements
henri-c

Weekly kenote to tell you about our latest updates https://discord.com/channels/930051556043276338/1278977038430240813 https://youtube.com/live/2dGd9TdT8xs?feature=share

henri-c · 4d ago

Pyra

### HTTP tracing (EE) Capture HTTP requests made by job scripts as observability spans Features: - View HTTP request traces (method, URL, status, timing) in the job details UI - Auto-instrumentation for Native TypeScript, MITM proxy for other languages - Integrates with external OpenTelemetry collectors changelog: https://www.windmill.dev/changelog/http-tracing docs: https://www.windmill.dev/docs/advanced/instance_settings#http-tracing Additionally jobs memory metrics are now fully OSS!

Pyra · 2w ago

henri-c

First keynote of the year here https://discord.com/channels/930051556043276338/1278977038430240813 🙂

henri-c · 4w ago

Similar Threads

Returning a PDF from a webhook
EggingtonEEggington / help
2y ago
Triggering a script using a synchronous webhook from another script within a self-hosted Docker
steve 🦉Ssteve 🦉 / help
2y ago
Including query params
TylerTTyler / help
7mo ago
postgresql dynamic params
mitzjukimMmitzjukim / help
12mo ago