Get POST body in a CI pipeline triggered by a webhook

Hi,

I have a GitLab CI pipeline that is Triggered by a third-party webhook.
That webhook includes a JSON payload in the POST body.
I am looking for a way to read that POST body inside a CI script.
Pretty new to CI/CD and would appreciate any help.

From running printenv, the POST request does not seem to be stored in any environment variable.

The third-party webhook (from Unity Cloud Build) cannot be configured to send the JSON payload as a trigger variable.

1 Like

I’m also running into this issue. I’m using Prismic to trigger a pipeline. Have you found a solution withing Gitlab CI/CD?

If not, I am considering creating an AWS lambda middleman service that would receive the request and pull relevant content out of the body and place them as query parameters in the pipeline trigger.

Hello, I have encountered this kind of demand, is there a solution? Thank you

I too am looking for this. I am using Gitlab webhook to trigger a Gitbab Pipeline as per https://docs.gitlab.com/ee/ci/triggers/README.html#triggering-a-pipeline-from-a-webhook. But the payload gets discarded AFAICT. I think I’ll have to use Heroku just to listen to the webhook and pull out data from the payload.

I am also looking for a solution to this issue.
We receive webhooks from Splunk alerts and need to view the payload to take the required action.

Replying for visibility. This would be an awesome feature for CI/CD!

Indeed this is a feature that should be somehow provided as webhooks triggering is approached in many different ways around the different platforms…or if someone can help bringing an approach for this.