Hi,
I want to get userId in custom code action in Hubspot worflow.
I use hubspot API, code below:
const hubspot = require(‘@hubspot/api-client’);
exports.main = async (event, callback) => {
const hubspotClient = new hubspot.Client({
apiKey: process.env.HAPIKEY
});
const email = event.inputFields[‘email’];
const after = 0;
const limit = 1;
const archived = false;
try {
const apiResponse = await hubspotClient.crm.owners.ownersApi.getPage(email, after, limit, archived);
console.log(JSON.stringify(apiResponse.body, null, 2));
} catch (err) {
console.error(err);
//throw err;
}
callback({
//outputFields: {
// email: email
// }
});
}
Unfortunately when I test it I get this error:
2021-11-09T16:06:10.802Z ERROR TypeError: Cannot read property 'getPage' of undefined
at Object.exports.main (/var/task/file.js:17:67)
at Runtime.exports.hubspot_handler [as handler] (/var/task/hubspotHandler.js:6:21)
at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)
Looks as if getPage method was not avilable.
I would be gratefull if someone could help me solve this problem.