Skip to main content


Enables you to install and use npm packages as part of your test scripts.

npm is a package manager for JavaScript that makes it easy to share and reuse code. With npm support in testRTC, you can now leverage the ecosystem of packages and modules provided by the Node.js community.

rtcRequire() can be used by applications to use third party packages and enhance the capabilities of their scripts. This script command receives a package name and a function as an input. The function will operate in the context of the package.


Name Type Description
name string The name of the package. This can also include a version number using the format <name>@<version>.
npmFunct function(object) The npm package can be used inside this function. Outside of it, it won’t exist.

Code Example

     //This will send HTTP POST to the to save some data
    .rtcActivateWebhook(restURL, { value: sampleValue }, function(answer) {
        client.rtcInfo('rtcActivateWebhook Post answer ' + answer);
    //This will send HTTP Get to the same url to retrive the just posted data
    .rtcActivateWebhook(restURL, function(answer) {
        client.rtcInfo('rtcActivateWebhook Get answer' + answer);

HTTP Headers

It is possible to set the Webhook HTTP header, by using the url argument as a json object and adding the header fields as the object’s internal json object. For example:
var webHookOptions = {
        url: 'https://[url]',
        headers: {
            'X-HTTP-Method-Override': 'PATCH',
            'Cache-Control': 'no-cache',
            'Content-Type': 'text/xml' 
    client.rtcActivateWebhook(webHookOptions, {value: 100}, function(answer) {
        . . .
Note: A complete sample test script source, that uses the rtcActivateWebhook() command, can be found here.

Was this article helpful?

0 out of 0 found this helpful