Created
September 20, 2022 17:35
-
-
Save HubSpotHanevold/7530c8f569b9f7cf5c32014f38f39340 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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