postman-docs icon indicating copy to clipboard operation
postman-docs copied to clipboard

Incorrect content regarding webhooks

Open abhijitkane opened this issue 6 years ago • 4 comments

This page - https://learning.getpostman.com/docs/postman/monitors/integrations_for_alerts/ - mentions that globals.previousRequest can be used to retrieve data passed to the webhook when run via the Postman API.

This is incorrect - globals.previousRequest is only valid for cases where a webhook is fired using the monitor's slug (which is an internal-only feature). For webhooks triggered via the Postman API, globals.previousRequest isn't populated.

abhijitkane avatar Feb 08 '19 10:02 abhijitkane

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 20 '19 22:11 stale[bot]

@abhijitkane should I just remove that whole section from the doc? Am not entirely sure how much of this page is still valid in general..

SueSmith avatar Apr 17 '20 12:04 SueSmith

There is documentation for using the webhook here: https://documenter.getpostman.com/view/804329/71FWAgx?version=latest#create-a-postman-monitor

Create a Postman monitor There are currently 2 ways to run a Postman monitor on-demand. You can manually run a monitor from the Postman web dashboard, or you can use the Postman API to run a monitor, but these methods don't allow you to send a payload. This on-demand Postman monitor - which functions like a webhook - will receive the payload sent by Slack and start the "Librarian" collection run. Note: Postman webhooks are still under development, and not yet recommended for commercial use. Generate an API key from the integrations dashboard to access the Postman API. Retrieve all your collections by sending a GET request to https://api.getpostman.com/collections, and don't forget to add the x-api-key header using your Postman API key. Find (CMD/CTRL + F) the "Librarian" collection in the response and make a note of the uid field. This is your collection ID. Retrieve all of your environments by sending a GET request to https://api.getpostman.com/environments, and don't forget to add the x-api-key header using your Postman API key. Once again, find (CMD/CTRL + F) the "Librarian" collection in the response, and make a note of the uid field. This is your environment ID. Now, let's create a Postman webhook. Create a new POST request to https://api.getpostman.com/webhooks, again adding the x-api-key header. For the body, select raw, change the type to JSON, and add the example body below. Send the request, and copy the webhookUrl from the response. We will use this webhookUrl in the Slack app configuration as the Request URL, essentially telling Slack to run the Postman monitor when the Slack command is triggered.

Body of the POST request is in the screenshot from the Librarian documentation.

If you get this error (if you're not in workspace called MyWorkspace):

    "error": {
        "name": "notInWorkspaceError",
        "message": "The entity is not in the specified workspace"
    }
}

Try creating the webhook by passing the workspace ID in a X-Workspace-Id header or in the request body via workspace property inside webhook?

Documentation should also show how to debug using the Monitors console in the web dashboard.

loopDelicious avatar May 14 '20 21:05 loopDelicious

Hi @abhijitkane @jkonrath-postman I would like to work on this issue. Kindly assign it to me.

ritik307 avatar Jan 08 '22 07:01 ritik307