Sorry if the question is too simple, but my function keeps getting an empty promise… can you please help me?
const request = require(‘request-promise’);
const hubspot = require(‘@hubspot/api-client’);
const hubspotClient = new hubspot.Client({“accessToken”:“THE ACCESS TOKEN”});
const contactId = ‘51’;
const properties = [“firstname”,
“cedula”,
“email”];
const propertiesWithHistory = [];
const associations = undefined;
const archived = false;
async function f() {
console.log('\*\*bleep\*\*ing work')
try {
const apiResponse = await hubspotClient.crm.contacts.basicApi.getById(contactId, properties, propertiesWithHistory, associations, archived);
console.log(JSON.stringify(apiResponse.body, null, 2));
const a = JSON.stringify(apiResponse.body, null, 2);
return a;
} catch (e) {
e.message === 'HTTP request failed'
? console.error(JSON.stringify(e.response, null, 2))
: console.error(e)
}
}
const a = f()
console.log(a)