Hi there team ^^!
There is an error calling the HubSpot API from the custom code, ‘The action will retry soon.’(see pics, code below)
When do I recieve that message? Is this an authendication problem? Am I using the api wrongly in the custom code? Is there a problem with my API key?
const hubspot = require('@hubspot/api-client');
exports.main = (event, callback) => {
const hubspotClient = new hubspot.Client({ apiKey: "inserted the key myself here" });
const dealId = "4052177067";
const toObjectType = "Line_items";
const after = undefined;
const limit = 500;
hubspotClient.crm.deals.associationsApi.getAll(dealId, toObjectType, after, limit).then(results => {
let response = JSON.stringify(results.body, null, 2);
callback({outputFields: {lineItem_ID_ComOps: response.results.id}});
});
}
system
2
Hi @AbelAioanei ,
Please use below code to fetch deal associated line item.
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, ‘https://api.hubapi.com/crm-associations/v1/associations/\/HUBSPOT_DEFINED/19?hapikey=demo’);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
$headers = array();
$headers[] = ‘Content-Type: application/json’
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo ‘Error:’ . curl_error($ch);
}
curl_close($ch);
return $result;
?>
Hope this helps!
If we were able to answer your query, kindly help the community by marking it as a solution.
Thanks and Regards.
Thank you @webdew but we’re working here with custom code as part of the workflow (see pic) which supports only NodeJS.
Remove parameter “after”:
const apiResponse = await hubspotClient.crm.deals.associationsApi.getAll(dealId, toObjectType, limit);