@postman/postman-plugin 0.2.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +58 -10
  2. package/dist/hosts/antigravity.js +47 -0
  3. package/dist/hosts/copilot.js +60 -0
  4. package/dist/hosts/index.js +3 -1
  5. package/dist/hosts/opencode-config.js +147 -0
  6. package/dist/hosts/opencode.js +315 -34
  7. package/dist/hosts/shared.js +10 -3
  8. package/dist/source.js +19 -5
  9. package/dist/system.js +20 -1
  10. package/hooks/session-start-context.md +1 -1
  11. package/mcp.pi.json +2 -2
  12. package/package.json +1 -1
  13. package/skills/ai-readiness/SKILL.md +40 -44
  14. package/skills/api-discovery/SKILL.md +64 -129
  15. package/skills/api-discovery/reference/orbit.md +17 -5
  16. package/skills/api-documentation/SKILL.md +38 -25
  17. package/skills/api-engineer/SKILL.md +78 -23
  18. package/skills/api-mocking/SKILL.md +117 -135
  19. package/skills/api-monitoring/SKILL.md +52 -129
  20. package/skills/api-simulation/SKILL.md +138 -0
  21. package/skills/api-simulation/reference/sim_yaml_schema.md +50 -0
  22. package/skills/api-testing/SKILL.md +48 -95
  23. package/skills/bootstrap/SKILL.md +123 -210
  24. package/skills/bootstrap/reference/cli_installation.md +4 -3
  25. package/skills/ci-integration/SKILL.md +53 -112
  26. package/skills/collection-schema-v3/SKILL.md +43 -204
  27. package/skills/collection-schema-v3/reference/http.md +150 -0
  28. package/skills/datasets/SKILL.md +89 -314
  29. package/skills/datasets/reference/spreadsheets.md +25 -0
  30. package/skills/flows/SKILL.md +57 -206
  31. package/skills/flows/reference/flow_cli_flags.md +3 -2
  32. package/skills/performance-testing/SKILL.md +46 -62
  33. package/skills/performance-testing/references/jmeter-import/README.md +113 -0
  34. package/skills/performance-testing/references/jmeter-import/import-report.md +52 -0
  35. package/skills/performance-testing/references/jmeter-import/mapping-table.md +97 -0
  36. package/skills/performance-testing/references/jmeter-import/postman-perf-capabilities.md +56 -0
  37. package/skills/performance-testing/references/jmeter-import/script-translation.md +98 -0
  38. package/skills/performance-testing/references/jmeter-import/scripts/groovy_to_js.py +83 -0
  39. package/skills/performance-testing/references/jmeter-import/scripts/jmx_to_postman.py +1433 -0
  40. package/skills/postman-mcp-server/SKILL.md +53 -59
  41. package/skills/postman-mcp-server/references/docs.md +0 -1
  42. package/skills/postman-mcp-server/references/learn.md +10 -9
  43. package/skills/postman-mcp-server/references/mock.md +0 -1
  44. package/skills/postman-mcp-server/references/search.md +0 -1
  45. package/skills/postman-mcp-server/references/security.md +0 -1
  46. package/skills/postman-mcp-server/references/setup.md +0 -1
  47. package/skills/postman-mcp-server/references/sync.md +0 -1
  48. package/skills/postman-mcp-server/references/test.md +0 -1
  49. package/skills/variables/SKILL.md +63 -0
  50. package/skills/webhook-testing/SKILL.md +103 -0
  51. package/skills/webhook-testing/reference/forwarding.md +10 -0
  52. package/skills/webhook-testing/reference/outbound_webhooks.md +25 -0
  53. package/skills/webhook-testing/reference/webhook_scripts.md +163 -0
@@ -1,71 +1,65 @@
1
1
  ---
2
2
  name: postman-mcp-server
3
- description: Postman concepts and MCP tool guidance. Loaded when working with Postman MCP tools to make better decisions about tool selection and workarounds.
4
- user-invocable: false
3
+ description: Use when working through Postman MCP tools to inspect or change workspace resources, choose a targeted operation, or handle MCP limitations. Supports hosted workflows when the CLI is unavailable and distinguishes tool completion from a usable result. Use for requests such as "use Postman MCP to inspect this collection".
5
4
  ---
6
5
 
7
- # Postman Knowledge
6
+ # Postman MCP Server
8
7
 
9
- Reference for Postman concepts and MCP tool selection. Use this context when working with Postman MCP tools to make better decisions.
8
+ MCP exposes workspace resources directly to an agent. Existing collections,
9
+ specs, examples, and environments provide maintained API knowledge; fetching
10
+ the relevant entity preserves that context when a local CLI workflow is not
11
+ available. For repository edits and Git review, prefer the local workflows in
12
+ **api-engineer** and **bootstrap** when available.
10
13
 
11
- See `references/setup.md` for how to to setup postman mcp server and auth.
14
+ Each tool definition exposed to the model consumes context whenever it is
15
+ included in a request. Prefer the smallest available toolset that covers the
16
+ task; expanding to every tool can crowd out the API evidence needed to reason.
17
+ When exposed, call `getEnabledTools` to inspect the active toolset before
18
+ diagnosing a missing operation. Otherwise use the host's discovered tools and
19
+ report that limitation. Do not infer availability from reference tool names or
20
+ assume a client can switch a route pinned to a specific MCP endpoint.
12
21
 
13
- ## Core Concepts
22
+ 1. Select tools from the connected server's actual surface. Tool availability
23
+ varies by mode; a name listed in a reference is not proof it is exposed.
24
+ Use [setup](references/setup.md) for connection/auth failures and
25
+ [limitations](references/mcp-limitations.md) when an operation is missing
26
+ or behaves differently from the CLI.
27
+ 2. Search to locate an entity, then fetch enough detail to work on it.
28
+ `searchPostmanElements` finds candidates; collection, spec, and workspace
29
+ detail tools establish IDs, ownership, and content. A search preview is
30
+ insufficient evidence for replacing a collection or declaring an API absent.
31
+ 3. Match the mutation to the intended scope. Request-level updates preserve
32
+ unrelated collection content; whole-collection replacement requires the
33
+ current complete object. A workspace is a container and access boundary,
34
+ not a reason to create duplicate resources whenever a new task begins.
35
+ 4. Preserve the source of truth when synchronizing. Spec-to-collection
36
+ generation reuses the interface, while collection-to-spec sync carries
37
+ changes in the other direction. Choose from the intended contract rather
38
+ than overwriting whichever artifact is easiest to reach. An asynchronous
39
+ acceptance response needs a completed task result before claiming sync.
40
+ 5. Treat publication separately from editing. A collection example can feed
41
+ docs and a classic mock, but neither becomes publicly accessible merely
42
+ because it exists. Apply the user's intended audience and authorization
43
+ before publishing docs or mocks, or changing shared resources.
14
44
 
15
- - **Collection:** A group of API requests organized in folders. The primary unit of work in Postman. Contains requests, examples, tests, and documentation.
16
- - **Environment:** Key-value pairs (variables) scoped to a context (dev, staging, prod). Used to swap base URLs, auth tokens, and config without changing requests.
17
- - **Workspace:** Container for collections, environments, and specs. Can be personal, team, or public.
18
- - **Spec (Spec Hub):** An OpenAPI or AsyncAPI definition stored in Postman. Can generate collections and stay synced.
19
- - **Request:** A single API call definition (method, URL, headers, body, tests).
20
- - **Response:** A saved example response for a request. Used by mock servers and documentation.
21
- - **Folder:** A grouping within a collection, typically by resource (e.g., "Users", "Orders").
22
- - **Tags:** Labels on collections for categorization and search.
23
- - **Monitor:** A scheduled collection runner that checks API health.
24
- - **Mock Server:** A fake API that serves example responses from a collection.
45
+ Read the reference for the branch being used:
25
46
 
26
- ## Decision Guide
47
+ | Task | Reference and decision it supports |
48
+ | --- | --- |
49
+ | Locate an API | [Search](references/search.md): narrow candidates to the intended resource |
50
+ | Generate or synchronize artifacts | [Sync](references/sync.md): choose source and track completion |
51
+ | Serve saved examples | [Mock](references/mock.md): classic collection mocks; for CLI Code Mocks use **api-mocking** |
52
+ | Execute saved assertions | [Test](references/test.md): distinguish run completion from failures |
53
+ | Improve or publish docs | [Docs](references/docs.md): fill contract gaps and verify reader access |
54
+ | Requested security review | [Security](references/security.md): assess concrete API risks |
55
+ | Product how-to questions | [Learning Center](references/learn.md): product documentation search when exposed |
27
56
 
28
- | Goal | Approach |
29
- |------|----------|
30
- | Push code changes to Postman | Create/update spec in Spec Hub, then sync to collection |
31
- | Consume a Postman API | Read collection + generate client code |
32
- | Find an API | Use `searchPostmanElements`, then drill into details |
33
- | Test an API | Run collection with `runCollection` |
34
- | Create a fake API for frontend | Create mock server from collection with examples |
35
- | Document an API | Analyze collection completeness, fill gaps, optionally publish |
36
- | Audit API security | Run security checks against spec or collection |
37
- | Learn how to use a Postman feature | Search Postman docs with `searchLearningCenter` (Full mode) |
57
+ ## Verification
38
58
 
39
- ## MCP Tool Selection
59
+ State the active toolset as observed through `getEnabledTools`, or identify the
60
+ host discovery evidence used when that tool is unavailable. Report any operation
61
+ the connected surface could not perform instead of claiming it succeeded.
40
62
 
41
- **Workspace operations:** `getWorkspaces`, `getWorkspace`, `createWorkspace`
42
- **Collection CRUD:** `getCollections`, `getCollection`, `createCollection`, `putCollection`, `patchCollection`, `deleteCollection`
43
- **Request/Response:** `getCollectionRequest`, `createCollectionRequest`, `updateCollectionRequest`, `getCollectionResponse`, `createCollectionResponse`, `updateCollectionResponse`
44
- **Folder management:** `getCollectionFolder`, `createCollectionFolder`, `updateCollectionFolder`
45
- **Spec Hub:** `getAllSpecs`, `getSpec`, `createSpec`, `getSpecDefinition`, `updateSpecFile`, `getSpecFiles`
46
- **Sync:** `generateCollection`, `syncCollectionWithSpec`, `syncSpecWithCollection`
47
- **Environments:** `getEnvironments`, `getEnvironment`, `createEnvironment`, `putEnvironment`
48
- **Mocks:** `getMocks`, `getMock`, `createMock`, `publishMock`, `unpublishMock`
49
- **Tests:** `runCollection`
50
- **Docs:** `publishDocumentation`, `unpublishDocumentation`
51
- **Search:** `searchPostmanElements` , `getTaggedEntities`
52
- **Learning Center:** `searchLearningCenter` (Full mode only — searches Postman product docs for how-to guidance)
53
- **User:** `getAuthenticatedUser`
54
-
55
- See `references/mcp-limitations.md` for known limitations and workarounds.
56
-
57
- ## Workflows
58
-
59
- Each reference below is a full MCP-tool workflow for one goal — the tool
60
- call sequence, what to present at each step, and error handling. Reach for
61
- one once the Decision Guide above has picked a goal; they assume MCP tools
62
- only, no `postman` CLI.
63
-
64
- - `references/setup.md` — first-run auth (OAuth or API key) and workspace verification.
65
- - `references/search.md` — discover APIs across workspaces with `searchPostmanElements`.
66
- - `references/sync.md` — create/update collections from specs, or sync a spec from collection changes.
67
- - `references/mock.md` — create a mock server from a collection or spec.
68
- - `references/test.md` — run collection tests and diagnose failures.
69
- - `references/docs.md` — generate, improve, and publish API documentation.
70
- - `references/security.md` — audit a spec or collection against the OWASP API Top 10.
71
- - `references/learn.md` — search the Postman Learning Center for how-to guidance.
63
+ Report the resource and observed result: assertions for a run, completed sync
64
+ for a generated artifact, or the reachable URL and visibility for publication.
65
+ Tool success alone does not establish any of those outcomes.
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  description: Generate, improve, and publish API documentation from Postman collections.
3
- allowed-tools: Read, Write, Glob, Grep, mcp__postman__getWorkspaces, mcp__postman__getAllSpecs, mcp__postman__getSpecDefinition, mcp__postman__getCollections, mcp__postman__getCollection, mcp__postman__updateCollectionRequest, mcp__postman__publishDocumentation, mcp__postman__unpublishDocumentation, mcp__postman__syncCollectionWithSpec, mcp__postman__syncSpecWithCollection, mcp__postman__getCollectionUpdatesTasks
4
3
  ---
5
4
 
6
5
  # API Documentation
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  description: Search the Postman Learning Center for how-to guidance, feature explanations, and suggested workflows. Use for "how do I..." questions about the Postman product.
3
- allowed-tools: Read, mcp__postman__searchLearningCenter, mcp__postman__getEnabledTools
4
3
  ---
5
4
 
6
5
  # Learn Postman
@@ -11,14 +10,16 @@ Use this to learn *about Postman itself* — not to search the user's own collec
11
10
 
12
11
  ## Prerequisites
13
12
 
14
- This workflow uses `searchLearningCenter`, which the Postman MCP Server exposes only in **Full mode**.
13
+ Use `searchLearningCenter` when it is exposed by the connected server. Follow
14
+ **postman-mcp-server**'s toolset inspection guidance before diagnosing a missing
15
+ tool; a remembered mode-to-tool mapping is not evidence of current availability.
16
+ The route's MCP endpoint determines its configured surface. `POSTMAN_MCP_MODE`
17
+ is not read by this plugin's routes and cannot switch that surface.
15
18
 
16
- The mode is fixed by the endpoint in each route's MCP config, not by the environment. A route pinned to `https://mcp.postman.com/mcp` has the tool; a route pinned to `https://mcp.postman.com/minimal` does not. Read it off the route's own MCP config rather than inferring it from the agent's name — which endpoint an agent gets is a per-route product decision, and new routes are added. **`POSTMAN_MCP_MODE` is not read on any route** — never tell the user to set or unset it to change the tool set.
17
-
18
- - If MCP tools aren't available at all, follow `references/setup.md` to connect the Postman MCP Server.
19
- - If `searchLearningCenter` is missing, call `getEnabledTools` to confirm the active tool set, then split on which endpoint the route is pinned to. On a `/minimal` route it is absent by design and the user cannot change it from the client: say the Learning Center tool isn't part of that route's tool set and point them at https://learning.postman.com to search directly. On a `/mcp` route its absence is not a mode problem — the server isn't connected as configured: follow `references/setup.md` to reconnect it.
20
-
21
- Do not answer a "how do I..." question from memory when the tool is unavailable. Cite only URLs the tool returned, or send the user to the Learning Center.
19
+ If no MCP tools are available, follow `references/setup.md`. If only the learning
20
+ tool is absent, use an available web search/browser to read the official Learning
21
+ Center and cite the pages actually consulted. Without either capability, report
22
+ the limitation and link the Learning Center rather than inventing product steps.
22
23
 
23
24
  ## Workflow
24
25
 
@@ -68,6 +69,6 @@ To create a mock server in Postman:
68
69
  ## Error Handling
69
70
 
70
71
  - **MCP not configured:** Follow `references/setup.md` to connect the Postman MCP Server.
71
- - **`searchLearningCenter` unavailable:** Confirm with `getEnabledTools`. Expected on any route pinned to the `minimal` endpoint — say the tool isn't in that route's tool set and point the user at https://learning.postman.com. On a `/mcp` route: follow `references/setup.md` to reconnect it.
72
+ - **`searchLearningCenter` unavailable:** Use the toolset inspection and official-documentation fallback under Prerequisites.
72
73
  - **401 Unauthorized:** "Your Postman API key was rejected. Generate a new one at https://go.postman.co/settings/me/api-keys." Then re-authenticate with `references/setup.md`.
73
74
  - **No results:** "Nothing matched in the Learning Center. Try rephrasing with the Postman feature name, or ask about a more specific step."
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  description: Create Postman mock servers for frontend development. Generates missing examples, provides integration config.
3
- allowed-tools: Bash, Read, Write, Glob, Grep, mcp__postman__getWorkspaces, mcp__postman__getCollections, mcp__postman__getCollection, mcp__postman__getCollectionRequest, mcp__postman__createCollectionResponse, mcp__postman__createSpec, mcp__postman__generateCollection, mcp__postman__getGeneratedCollectionSpecs, mcp__postman__getSpecCollections, mcp__postman__getAsyncSpecTaskStatus, mcp__postman__getMocks, mcp__postman__getMock, mcp__postman__createMock, mcp__postman__publishMock, mcp__postman__unpublishMock
4
3
  ---
5
4
 
6
5
  # Create Mock Servers
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  description: Discover APIs across your Postman workspaces. Ask natural language questions about available endpoints and capabilities.
3
- allowed-tools: Read, Glob, Grep, mcp__postman__searchPostmanElements, mcp__postman__getWorkspaces, mcp__postman__getCollections, mcp__postman__getTaggedEntities, mcp__postman__getCollection, mcp__postman__getCollectionRequest, mcp__postman__getCollectionResponse, mcp__postman__getSpecDefinition
4
3
  ---
5
4
 
6
5
  # Discover APIs
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  description: Security audit your APIs against OWASP API Top 10. Finds vulnerabilities and provides remediation guidance.
3
- allowed-tools: Read, Edit, Write, Glob, Grep, mcp__postman__getWorkspaces, mcp__postman__getAllSpecs, mcp__postman__getSpecDefinition, mcp__postman__getCollections, mcp__postman__getCollection, mcp__postman__getEnvironment, mcp__postman__putEnvironment, mcp__postman__updateCollectionRequest, mcp__postman__updateCollectionResponse
4
3
  ---
5
4
 
6
5
  # API Security Audit
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  description: Set up Postman MCP Server. Authenticate via OAuth or API key, verify connection, select workspace.
3
- allowed-tools: mcp__postman__authenticate, mcp__postman__complete_authentication, mcp__postman__getAuthenticatedUser, mcp__postman__getWorkspaces, mcp__postman__getCollections, mcp__postman__getAllSpecs
4
3
  ---
5
4
 
6
5
  # First-Run Configuration
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  description: Sync Postman collections with your API code. Create collections from specs, push updates, keep everything in sync.
3
- allowed-tools: Bash, Read, Write, Glob, Grep, mcp__postman__getWorkspaces, mcp__postman__getCollections, mcp__postman__getCollection, mcp__postman__createSpec, mcp__postman__updateSpecFile, mcp__postman__generateCollection, mcp__postman__getAsyncSpecTaskStatus, mcp__postman__getGeneratedCollectionSpecs, mcp__postman__syncCollectionWithSpec, mcp__postman__syncSpecWithCollection, mcp__postman__getCollectionUpdatesTasks, mcp__postman__createEnvironment, mcp__postman__createCollectionRequest, mcp__postman__updateCollectionRequest, mcp__postman__createCollectionFolder, mcp__postman__createCollectionResponse
4
3
  ---
5
4
 
6
5
  # Sync Collections
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  description: Run Postman collection tests, analyze results, diagnose failures, and suggest fixes.
3
- allowed-tools: Bash, Read, Write, Glob, Grep, mcp__postman__getWorkspaces, mcp__postman__getCollections, mcp__postman__getCollection, mcp__postman__runCollection, mcp__postman__getEnvironments, mcp__postman__getCollectionRequest, mcp__postman__getCollectionResponse, mcp__postman__updateCollectionRequest, mcp__postman__updateCollectionResponse
4
3
  ---
5
4
 
6
5
  # Run Collection Tests
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: variables
3
+ description: Use when parameterizing requests across environments, choosing variable scopes, chaining values in scripts, or referencing credentials without committing or exposing them. Keeps one reusable collection while separating target configuration from secret values. Use for requests such as "where should I put this API key".
4
+ ---
5
+
6
+ # Variables
7
+
8
+ Variables let one maintained collection run against different targets without
9
+ forking its requests. Scope determines which value wins; secret references
10
+ allow the same files to be shared without sharing credential values.
11
+
12
+ 1. Put API defaults in collection variables and target-specific values, such
13
+ as `base_url`, in an environment. Parameterize values that actually vary;
14
+ a stable literal need not become another configuration choice. Reference
15
+ values as `{{key}}` in URLs, headers, parameters, or bodies.
16
+ 2. Resolve surprises through precedence: local script values override
17
+ iteration data, then environment, collection, and global values. A correct
18
+ environment file can still lose to a row or script override. Values can
19
+ reference other variables and resolve at send time, so inspect the chain
20
+ rather than just the final request field.
21
+ 3. Use runtime values for chaining responses into later requests. Choose
22
+ `pm.environment` or `pm.collectionVariables` when the scope is intentional;
23
+ `pm.variables.get` reads across scopes, and `pm.variables.set` holds a local
24
+ value for the current run. For transient sensitive values, avoid persisting
25
+ them to an environment or logging them.
26
+ 4. Store durable credentials in the shared vault and commit references.
27
+ `type: secret` alone masks the UI but still leaves a literal YAML value
28
+ readable. **collection-schema-v3**'s environment reference describes the
29
+ file schema; command-specific `-h` supplies supported vault operations.
30
+
31
+ For non-sensitive target configuration:
32
+
33
+ ```bash
34
+ postman environment new "Staging"
35
+ postman environment var set base_url https://staging.example.com \
36
+ --environment "postman/environments/Staging.environment.yaml"
37
+ ```
38
+
39
+ For a secret, have the user supply the value through the CLI's masked prompt,
40
+ not through agent context or a literal command argument:
41
+
42
+ ```bash
43
+ postman secret create STRIPE_API_KEY --workspace <workspace-id>
44
+ postman environment var set api_key --secret-id <secret-id> --vault-id <vault-id> \
45
+ --environment "postman/environments/Staging.environment.yaml"
46
+ ```
47
+
48
+ The environment then carries the vault/secret IDs rather than the value.
49
+ Secret resolution and permission to view the secret are distinct; a teammate's
50
+ ability to run a request need not expose the credential to them. Use
51
+ **bootstrap** when the vault operation needs unresolved authentication.
52
+
53
+ ## Verification
54
+
55
+ Run `postman environment lint <path> --fail-severity warning` to fail on
56
+ warnings as well as errors in the saved environment. Lint checks the artifact;
57
+ it does not prove that the session can resolve a vault secret. Verify resolution
58
+ with an appropriate authenticated request and a contract-derived assertion,
59
+ keeping credentials out of output. An unresolved-reference or authorization
60
+ failure needs investigation, not a claim that the secret worked.
61
+ Report the selected environment and scope
62
+ or reference that supplies the value; a masked display alone does not prove
63
+ that the committed file contains no literal secret.
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: webhook-testing
3
+ description: Capture, forward to localhost, replay, and validate webhook deliveries using a reusable public URL. Keep sender configuration across debugging sessions and record arrivals even while local forwarding is stopped, helping distinguish delivery failures from local connectivity issues. Use for implementing or debugging incoming handlers and testing webhooks an API sends, whether or not Postman is mentioned. Example requests include "get payment events to localhost," "inspect a webhook delivery," and "replay an event after a fix"; these illustrate intent, not an exhaustive list or exact phrases to match.
4
+ ---
5
+
6
+ # Webhook Testing
7
+
8
+ `postman webhook` gives a sender a hosted URL,
9
+ `https://<webhookId>.webhook.pstmn.io`, that records every request it gets,
10
+ with the raw headers and body as they were sent, and forwards each one to a
11
+ port on this machine. You don't need a separate tunnel. Two properties shape
12
+ how to use it:
13
+
14
+ - **Reuse the URL across debugging sessions.** It survives new sessions, pause
15
+ and start, so the sender is registered once. Reuse a webhook when the user
16
+ names one or says the sender already posts to one. Use `list` to resolve that
17
+ reference; ask only if the available context still leaves multiple plausible choices.
18
+ Create a new one when a new endpoint is needed. Each new webhook is another
19
+ URL to register and a second event history.
20
+ - **Every request is recorded,** including requests that arrive while nothing
21
+ is forwarding. `requests describe` shows a delivery exactly as it was sent.
22
+ After a fix, `requests replay` sends it again, so you don't need the sender
23
+ to fire it again.
24
+
25
+ The command is singular, and every subcommand needs a signed-in session. Run what you need,
26
+ and read `bootstrap` only if a command fails with a setup error such as `Authentication required`.
27
+ When all you have is the URL, its subdomain is the webhook id.
28
+
29
+ For capture or inspection alone, create or reuse a webhook and inspect its
30
+ recorded requests; no local service or forwarding to a local port is needed.
31
+
32
+ Use replays and [scripts](reference/webhook_scripts.md) to validate incoming events.
33
+
34
+ ## Get a sender reaching localhost
35
+
36
+ When the task is to reach a local handler, check the path from the public URL
37
+ meant to be forwarded to the local service:
38
+
39
+ 1. **Make sure the route exists.** A URL that forwards to a local service with no
40
+ matching route only ever returns 404. Check the local service for a handler for
41
+ this event. Add a missing handler when implementing the receiver is part
42
+ of the task. Senders retry, and replay re-sends an identical request, so
43
+ deduplicate using the sender's stable event identifier where available.
44
+ Acknowledge valid, authenticated events that the handler intentionally
45
+ ignores with a 2xx to avoid unnecessary retries; malformed or
46
+ unauthenticated requests still need rejection.
47
+ 2. **Reuse the existing webhook or create a new endpoint.** To create one,
48
+ use `postman webhook create --title <name>`. When a new endpoint is clearly
49
+ needed, creating it directly avoids an unnecessary discovery step.
50
+ 3. **Start the local service, then forward to its port** with
51
+ `postman webhook forward <webhookId> <port>`. `forward` runs until it's
52
+ stopped, so run it in the background. For stopping the forwarding process,
53
+ see [Forwarding lifecycle](reference/forwarding.md).
54
+ 4. **Send one request to the URL, at the route's path.** Check that a 2xx came
55
+ back and that the handler logged the request. `requests list` shows whether
56
+ the request reached the webhook at all, which separates a wrong URL from a
57
+ forwarding or routing problem.
58
+
59
+ For a connectivity task, one successful probe demonstrates that the tested
60
+ path reaches the handler. Sender compatibility and handler correctness need
61
+ evidence from actual sender deliveries and relevant scenarios.
62
+
63
+ ## Gotchas / Notes
64
+
65
+ - **Build the webhook script's test event from the sender's contract, not from your handler.**
66
+ A payload written to match the handler you just wrote only proves the two
67
+ agree with each other. Take it from the sender's documented event schema.
68
+ Better, use a real delivery: send one from the sender's test mode (such as
69
+ `stripe trigger <event>` or a GitHub redelivery), then replay that recorded
70
+ request as you iterate.
71
+ - **A permission error needs workspace context.** Check the selected workspace
72
+ and the account's access. A cloned repository may point to a workspace this
73
+ account cannot use. If the intended accessible workspace is known, pass
74
+ `-w`; otherwise ask which workspace to use. Creating another workspace does
75
+ not grant access to the existing one.
76
+ - **Some old signed events fail verification on replay, by design.** Stripe
77
+ (`t=` in `Stripe-Signature`) and Slack (`X-Slack-Request-Timestamp`) sign a
78
+ timestamp, and their SDKs reject one older than about five minutes.
79
+ Send a fresh event instead of loosening verification. GitHub's signature has no
80
+ timestamp, so its replays still verify.
81
+ - **Confirm before `delete`.** It's permanent, and a sender still registered
82
+ to the URL starts failing. Replay also reaches application code, so account
83
+ for the handler's side effects when choosing which delivery to resend.
84
+
85
+ ## Handing over
86
+
87
+ For endpoint setup, leave the webhook active so the user can point a sender
88
+ at it. For a completed investigation, choose the final state based on whether
89
+ the sender still needs the endpoint. Forwarding stops when the `forward`
90
+ process does; while the webhook remains active, arrivals are recorded and
91
+ can be replayed. Give the user:
92
+
93
+ - the URL with the route's path;
94
+ - for local forwarding, the two commands that start the loop again: start
95
+ the local service, then `postman webhook forward <webhookId> <port>`;
96
+ - any changes made to the local service;
97
+ - what was verified: the captured delivery or the response and handler receipt
98
+ for a forwarding test.
99
+
100
+ To validate deliveries automatically with a `pm.test` script, see
101
+ [reference/webhook_scripts.md](reference/webhook_scripts.md). To test the
102
+ webhooks your own API sends, with a Postman webhook as the subscriber, see
103
+ [reference/outbound_webhooks.md](reference/outbound_webhooks.md).
@@ -0,0 +1,10 @@
1
+ # Forwarding lifecycle
2
+
3
+ `postman webhook forward <webhookId> <port>` runs until stopped. To stop a
4
+ background forwarding process, use
5
+ `pkill -INT -f "webhook forward <webhookId>"`. `kill $!` may reach only the
6
+ `postman` launcher and leave forwarding running.
7
+
8
+ Stopping forwarding leaves the webhook available to record deliveries. Start
9
+ forwarding again when the local service is ready, then replay a captured
10
+ request when the task needs it.
@@ -0,0 +1,25 @@
1
+ # Testing the webhooks your API sends
2
+
3
+ Here the Postman webhook stands in for a subscriber. Create one with
4
+ `postman webhook create`, then register its URL as the subscriber endpoint in
5
+ your app, through its config or your subscription API. Trigger the action that
6
+ emits the event, with `postman request` or a collection that already covers it
7
+ (see the `api-testing` skill). Find the delivery with `requests list` and read
8
+ it with `requests describe`.
9
+
10
+ Check the delivery against the event contract you publish:
11
+
12
+ - the event type and the body's shape;
13
+ - the signature header, recomputed from the raw body with the secret your
14
+ subscriber holds;
15
+ - the delivery or idempotency id, which should be unique per event and stay
16
+ the same across retries.
17
+
18
+ Put those checks in an `onEvent` script so each delivery gets a test report;
19
+ see [webhook_scripts.md](webhook_scripts.md). Its last section covers checking
20
+ your own signature scheme.
21
+
22
+ To test retries, the subscriber has to fail. Either set the webhook's routing to
23
+ respond with a 5xx in the Postman app (routing isn't a CLI command), or forward
24
+ to a local endpoint that returns one. Check that `requests list` records the
25
+ failing response status before you read the repeated deliveries as retries.
@@ -0,0 +1,163 @@
1
+ # Webhook scripts
2
+
3
+ Recipes for the `onEvent` script that `postman webhook scripts set` uploads.
4
+ Each delivery runs the script in a fresh Postman sandbox, with the incoming
5
+ request in `pm.request`. `pm.test` results appear in
6
+ `postman webhook requests describe <webhookId> <requestId>`, and the
7
+ `console.log` output appears with `--verbose`.
8
+
9
+ ```bash
10
+ postman webhook scripts set <webhookId> ./webhooks/github-on-event.js --event onEvent
11
+ ```
12
+
13
+ ## Contents
14
+
15
+ - [How webhook scripts behave](#how-webhook-scripts-behave)
16
+ - [What a script can use](#what-a-script-can-use)
17
+ - [Asserting on the payload](#asserting-on-the-payload)
18
+ - [Signature checks](#signature-checks): GitHub, Stripe, Slack, any HMAC
19
+
20
+ ## How webhook scripts behave
21
+
22
+ - **`onEvent`** runs when a request arrives, before Postman forwards or
23
+ responds. Use it to validate the payload, verify the signature, or modify
24
+ the request. **`onResponse`** runs after Postman has responded to the
25
+ sender. Use it for logging and follow-up work from your local responder
26
+ or the configured forwarding endpoint.
27
+ - **The file in the repo is the only copy you can read.** The CLI has
28
+ `scripts set` but no command that reads a script back, and a second `set`
29
+ replaces the first. Commit the script beside the handler it guards, and set
30
+ it again after you edit it. The file can be JavaScript or TypeScript.
31
+ - **No state carries over between deliveries.** A script can't remember which
32
+ event ids it has already seen, so test duplicate handling in the handler, by
33
+ replaying a request twice.
34
+ - **Secrets come from the linked environment.** Read a signing secret with
35
+ `pm.environment.get` and never write it into the file. An environment is
36
+ linked to a webhook in its settings in the Postman app. See the `variables`
37
+ skill for where a secret belongs.
38
+ - **Results are per delivery.** The console output that `--verbose` shows is
39
+ capped at 25 KB per event.
40
+ - **A script is a test, not your handler's guard.** Postman doesn't document
41
+ that a failing `pm.test` stops the request from being routed. Your handler
42
+ verifies signatures itself, whatever the script reports.
43
+
44
+ ## What a script can use
45
+
46
+ | Available | Not available |
47
+ | --- | --- |
48
+ | `pm.request.headers.get(name)`, `pm.request.body.raw` | `pm.globals`, `pm.collectionVariables`, `pm.iterationData` |
49
+ | `pm.test`, `pm.expect` | `pm.execution.setNextRequest`, `pm.visualizer` |
50
+ | `pm.environment.get`, from the environment linked to the webhook | State that lasts beyond one delivery |
51
+ | `require("crypto-js")` and other packages, from the Package Library, npm or JSR | |
52
+ | `pm.execution.runRequest`, to run a saved collection request | |
53
+
54
+ Parse and hash `pm.request.body.raw`. Postman keeps the body exactly as the
55
+ sender sent it, and every signature scheme below is computed over those exact
56
+ bytes. A body that was parsed and serialized again fails the check even when
57
+ the JSON is the same.
58
+
59
+ ## Asserting on the payload
60
+
61
+ Write down the contract the handler depends on. A test fails on the first
62
+ delivery that breaks it, instead of when the handler happens to crash.
63
+
64
+ ```javascript
65
+ // Just a reference based on expected payload, it can be of a different data type as well.
66
+ const event = JSON.parse(pm.request.body.raw);
67
+
68
+ pm.test("is a JSON event with an id and a type", function () {
69
+ pm.expect(event).to.have.property("id").that.is.a("string");
70
+ pm.expect(event).to.have.property("type").that.is.a("string");
71
+ });
72
+
73
+ pm.test("is an event this handler subscribes to", function () {
74
+ pm.expect(["payment_intent.succeeded", "payment_intent.payment_failed"])
75
+ .to.include(event.type);
76
+ });
77
+ ```
78
+
79
+ ## Signature checks
80
+
81
+ Postman also has signature-verification presets for Stripe, GitHub and Slack
82
+ in the Postman app. Use a script when you want the check in a file that can be
83
+ reviewed, or when the provider has no preset. Read the secret from the linked
84
+ environment. A secret pasted into the script ends up in the repo and in the
85
+ webhook's configuration.
86
+
87
+ ### GitHub
88
+
89
+ `X-Hub-Signature-256` is `sha256=` followed by the hex HMAC-SHA256 of the raw
90
+ body. There's no timestamp, so a replayed delivery still verifies.
91
+
92
+ ```javascript
93
+ const CryptoJS = require("crypto-js");
94
+
95
+ const secret = pm.environment.get("github_webhook_secret");
96
+ const expected = "sha256=" +
97
+ CryptoJS.HmacSHA256(pm.request.body.raw, secret).toString(CryptoJS.enc.Hex);
98
+
99
+ pm.test("GitHub signature matches the body", function () {
100
+ pm.expect(pm.request.headers.get("X-Hub-Signature-256")).to.equal(expected);
101
+ });
102
+ ```
103
+
104
+ ### Stripe
105
+
106
+ `Stripe-Signature` is `t=<unix seconds>,v1=<hex>[,v1=<hex>…]`. Stripe signs
107
+ `<t>.<raw body>` with the endpoint's whole `whsec_…` secret, prefix included.
108
+ More than one `v1` appears while a secret is being rolled, and any one of them
109
+ can match.
110
+
111
+ ```javascript
112
+ const CryptoJS = require("crypto-js");
113
+
114
+ const secret = pm.environment.get("stripe_webhook_secret");
115
+ const fields = pm.request.headers.get("Stripe-Signature").split(",");
116
+ const t = fields.find(f => f.startsWith("t=")).slice(2);
117
+ const signatures = fields.filter(f => f.startsWith("v1=")).map(f => f.slice(3));
118
+ const expected = CryptoJS.HmacSHA256(t + "." + pm.request.body.raw, secret)
119
+ .toString(CryptoJS.enc.Hex);
120
+
121
+ pm.test("Stripe signature matches the body", function () {
122
+ pm.expect(signatures).to.include(expected);
123
+ });
124
+
125
+ pm.test("Stripe timestamp is within five minutes", function () {
126
+ pm.expect(Math.abs(Date.now() / 1000 - Number(t))).to.be.below(300);
127
+ });
128
+ ```
129
+
130
+ The timestamp test fails on a replay of anything older than five minutes. That
131
+ failure is expected and doesn't mean the replay is broken.
132
+
133
+ ### Slack
134
+
135
+ Slack signs `v0:<X-Slack-Request-Timestamp>:<raw body>` with the app's signing
136
+ secret and sends `X-Slack-Signature: v0=<hex>`.
137
+
138
+ ```javascript
139
+ const CryptoJS = require("crypto-js");
140
+
141
+ const secret = pm.environment.get("slack_signing_secret");
142
+ const ts = pm.request.headers.get("X-Slack-Request-Timestamp");
143
+ const expected = "v0=" +
144
+ CryptoJS.HmacSHA256("v0:" + ts + ":" + pm.request.body.raw, secret)
145
+ .toString(CryptoJS.enc.Hex);
146
+
147
+ pm.test("Slack signature matches the body", function () {
148
+ pm.expect(pm.request.headers.get("X-Slack-Signature")).to.equal(expected);
149
+ });
150
+
151
+ pm.test("Slack timestamp is within five minutes", function () {
152
+ pm.expect(Math.abs(Date.now() / 1000 - Number(ts))).to.be.below(300);
153
+ });
154
+ ```
155
+
156
+ ### Any other HMAC scheme, including your own API's
157
+
158
+ Start from the provider's documentation, or your own if you're checking the
159
+ webhooks your API sends. Find out three things: which header carries the
160
+ signature and any prefix it uses, exactly which bytes are signed (the body
161
+ alone, or a timestamp or id joined to it), and whether the result is hex or
162
+ base64. A mismatch is nearly always one of those three. Use
163
+ `CryptoJS.enc.Base64` in place of `CryptoJS.enc.Hex` for a base64 signature.