> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt. For full content including API reference and SDK examples, see https://learning.postman.com/llms-full.txt.

# Test and debug values in gRPC requests using JavaScript in Postman

Postman has a powerful scripting environment that enables you to add JavaScript code (scripts) in your gRPC requests and [multi-protocol collections and folders](/docs/collections/use-collections/add-requests-to-collections/#about-multi-protocol-collections). You can define scripts for three hooks available during the request run lifecycle:

* Before invoking the method and establishing a connection with the server, in the **Before invoke** tab.
* When the client receives a message from the server, in the **On message** tab.
* After closing the connection with the server, in the **After response** tab.

You can use scripts to write API tests, debug your requests by logging to [Postman Console](/docs/use/send-requests/response-data/troubleshooting-api-requests/), or dynamically read/update the values of [variables](/docs/use/send-requests/variables/variables/). You can [import packages](/docs/tests-and-scripts/write-scripts/packages/package-library/) with scripts and tests from your team's Postman Package Library. You can also [import packages from external package registries](/docs/tests-and-scripts/write-scripts/packages/external-package-registries/), such as npm and JSR.

Once you invoke your gRPC request, updates to scripts in the **On message** tab won't take effect until the next time you invoke the request.

![gRPC scripts](https://assets.postman.com/postman-docs/v11/sending-requests-grpc-scripting-in-grpc-request-v11.66.0.jpg)

The [Postman Sandbox](/docs/tests-and-scripts/write-scripts/postman-sandbox-reference/overview/) is available to you when you write your **Before invoke**, **On message**, and **After response** scripts. The sandbox is a JavaScript runtime environment where your scripts run.

To learn more about Postman test scripts, see [Write scripts to test API response data in Postman](/docs/tests-and-scripts/write-scripts/test-scripts/).