How to Make Your NPM Package Available in Google App Script

eval(UrlFetchApp.fetch('https://hostedsomwhere/sdk.js').getContentText());
Using browser-only version of superagent in non-browser environment
non-browser env
npm install -g browserify
browserify --standalone sdk_name --bare src/index.js -o dist/sdk.js
// Make a POST request with a JSON payload.
var data = {
'name': 'Bob Smith',
'age': 35,
'pets': ['fido', 'fluffy']
};
var options = {
'method' : 'post',
'contentType': 'application/json',
// Convert the JavaScript object to a JSON string.
'payload' : JSON.stringify(data)
};
UrlFetchApp.fetch('https://httpbin.org/post', options);

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store