Skip to content

Use External Packages in Postman Scripts #13542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
appurva21 opened this issue Apr 11, 2025 · 2 comments
Open

Use External Packages in Postman Scripts #13542

appurva21 opened this issue Apr 11, 2025 · 2 comments

Comments

@appurva21
Copy link
Member

appurva21 commented Apr 11, 2025

We’re excited to announce a powerful new capability in Postman’s scripting environment — support for external public packages from the NPM and JSR registries! 🎉

With this release, you can now seamlessly supercharge your pre-request and post-response scripts using your favorite open-source packages right from inside Postman.

📽️ Feature Walkthrough

Getting up and running is easy:

  1. Open the Scripts tab (Pre-request or Post-response) for any HTTP Request.
  2. Click on the Packages dropdown to search and select a package from NPM or JSR.
  3. Or, directly import packages into your script using pm.require. Examples:
// From NPM
const lodash = pm.require("npm:[email protected]");

// From JSR
const shortUUID = pm.require("jsr:@opensrc/short-uuid")
external.packages.mp4

📚 Read the full documentation here for more examples, caveats, and advanced usage.

🛠️ Planned Work Ahead

We’re just getting started! Here's what we're working on next:

  • Adding auto-suggestions in the scripts tab for packages you import — making it even easier to discover and use package APIs as you type.
  • Extending package support across all protocols, including gRPC, GraphQL, etc.
  • Bringing this feature to Postman CLI and Monitors so your workflows stay consistent across all Postman tools.

Stay tuned! 💥

⚠️ Known Limitations

While this is a huge leap forward, here are a few limitations to be aware of:

  • Postman's script environment is platform-agnostic. This means Packages that rely on Node.js built-ins like child_process or worker_threads may not work as expected. We offer best-effort implementations of Node built-ins, but they may not have complete parity with Node.js.
  • Packages that reference globals outside the allowed sandbox environment may not behave correctly, depending on the part of the package that is executed.
  • Packages that use Top-level await are not supported at the moment.

🙌 Thank You!

This was long overdue and wouldn’t have been possible without the incredible feedback and support from our Postman community. Your insights and use cases helped shape this—please keep it coming!

Happy Scripting!

@pozil
Copy link

pozil commented Apr 14, 2025

@appurva21 thanks for sharing this great feature.
Keep up the good work, we definitely need it on gRPC scripts (before invoke, after response)!

@appurva21
Copy link
Member Author

@pozil Absolutely! We are already working on it, and you’ll hear more from us on this very soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants