Can I use Node.JS modules in my scripts
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2023 03:12 PM
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