Skip to content

Instantly share code, notes, and snippets.

@HubSpotHanevold
Created September 20, 2022 17:35
Show Gist options
  • Save HubSpotHanevold/7530c8f569b9f7cf5c32014f38f39340 to your computer and use it in GitHub Desktop.
Save HubSpotHanevold/7530c8f569b9f7cf5c32014f38f39340 to your computer and use it in GitHub Desktop.
const request = require('request');
exports.main = async (event, callback) => {
const REPLACE = event.inputFields['REPLACE'];
var options = {
'method': 'GET',
'url': 'https://api.hubapi.com/hubdb/api/v2/tables/REPLACE/rows?',
'headers': {
'Authorization': 'Bearer ' + process.env.HUBDBKEY
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
const obj = JSON.parse(response.body);
let REPLACE = obj.objects[0].values['1'];
console.log(REPLACE)
callback({
outputFields: {
REPLACE: REPLACE
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment