Hi @Teun ,
I was able to locate the documentation of migrating to private app and tried out the approach suggested in there. I was able to get the Custom Code action working with the Access token instead of API KEY.
Pre-requisite: Create a private app with your deveopers HubSpot account
1. Go to Settings --> Integrations --> Private Apps
2. Create Private App
3. Provide the name to the App
4. Add the modules (for ex., hubdb, contacts, deals, etc.) as required
5. Create app
6. You should be able to find your access token in the app which you can add as Secret in Custom Code Action instead of API KEY
Here is the final code snippet which could help someone else as well:
const hubspot = require(‘@hubspot/api-client’);
exports.main = async (event, callback) => {
const hubspotClient = new hubspot.Client({
accessToken: process.env.ACCESSTOKEN
});
// Make sure ACCESSTOKEN is added in SecretKey
const values = {
“id”:“3”,
“userid”: “16”,
“title”: “Test new row”,
“completed”: “true”,
};
const HubDbTableRowV3Request = { path: “test_path11”, name: “test_title11”, values };
const tableIdOrName = “test_table”;
try {
const apiResponse = await hubspotClient.cms.hubdb.rowsApi.createTableRow(tableIdOrName, HubDbTableRowV3Request);
console.log(JSON.stringify(apiResponse.body, null, 2));
} catch (e) {
e.message === ‘HTTP request failed’ ? console.error(JSON.stringify(e.response, null, 2)) : console.error(e)
}
};
Thank you so much on working this with me and taking this to resolution. I really appreciate it. ![]()
Have a great day ahead.
Best Regards,
Swapnil