Can I use Node.JS modules in my scripts

Mike Hashemi
Kilo Sage

I am trying to write a script to interact with a third-party API. I think I need the crypto and axios modules. When I run this script:

 

var global = this.global || (0, eval)('this');

// Load the required modules
var crypto = global.require('crypto');
var axios = global.require('axios');

gs.log("crypto: "+ crypto);
gs.log("axios: "+ axios);

Both crypto and axios are "undefined". I am no JavaScript expert, is this correct? Can I use these modules in ServiceNow?

 

If not, what is the correct way to create a create a sha256 hmac signature and make a POST call to the third-party API?

0 REPLIES 0