Triggering runs with webhooks

A webhook provides a way to automatically send data from one application to another. Using a webhook, you can trigger a collection run in Postman at a specific time or when an event occurs. You can also send a custom payload to the webhook, which can be accessed when the collection runs. This enables the collection to be run independently of any environment, instead relying only on the data sent to the webhook.

Creating a webhook

With a collection webhook, data is sent to the webhook URL using a POST request when certain events are triggered. (It's up to you to configure the application that sends the data and what the trigger events are.) The data sent to the webhook is accessible inside the collection in the globals object. Using scripts, you can parse that data and use it during the collection run in any way possible.

Webhooks for a collection can only be created using the Postman API. To create a webhook, refer to the documentation for

Accessing the request body in scripts

The request body of the webhook is available inside the globals.previousRequest object. In order to use it, first parse the globals.previousRequest object. The data sent to the webhook is available in the data parameter inside the parsed object, as shown in the code snippet below.

var previousRequest = JSON.parse(globals.previousRequest),
    webhookRequestData =;

// webhookRequestData contains the data sent to your webhook.

The request body sent to the webhook must use JSON format only.

Sending output to another API

The data that is sent to the collection webhook can be used to define logic and trigger another API. For example, you might set up a webhook for your GitHub repository. Based on the updates happening in your repository, you can use the webhook to run custom build pipelines or perform CI tests.