Slack -> Postman via webhook (parse JSON)

Hi - sorry for the super n00b question… Trying to take JSON message from a Slack slash command and parse this in postman.

  • Created a Postman webhook via Postman API, linked to a Collection
  • Using this as the URL for the slash command in Slack - seems to be connected as when the slash command is run in Slack the Collection Chain runs in Postman … but unsure where/how to pull the JSON before this happens?

I am trying to use inputs from the JSON to update Environment Variables - but struggling to figure out how to parse these.

Any advice please?

Hey @steve_pm,
You can use globals.previousRequest in your pre request script to access the payload that was sent to the webhook. You can do something like this,

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

webhookRequestData will contain the data sent to you.

Hey @bhargav.karanam - thanks for replying. Simplifying a bit - I am using this code right now in pre request script. response_url is a field in the Slack payload, so just trying to set this variable in the environment (then will figure the rest out).

However it’s still not setting the variable. The Body script runs correctly, as does the test script afterwards - so it’s working, but the variable is not being set. Any ideas?

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

pm.environment.set(“response_url”, webhookRequestData.response_url );

just to add, I can see the payload from Slack in the postman monitor for the webhook still, including the response_url field and its contents…

Could you console.log( and check if you’re receiving the data correctly? Could you also check if the environment you provided during the creation of webhook matches the one you are currently using?

Do you have a complete step by step info about Webhook testing using Postman. Please provide repo