Hi Team,
I am getting this issue while trying to create association with deal to cintact through api.Below is my code.
const hubspot = require(‘@hubspot/api-client’);
const hubspotClient = new hubspot.Client({“apiKey”:“api key here”});
const BatchInputPublicAssociation = { inputs: [{“from”:{“id”:“deal_id here”},“to”:{“id”:“contact-id here”},“type”:“deal_to_contact”}] };
const fromObjectType = “Deals”;
const toObjectType = “Contacts”;
try {
const apiResponse = await hubspotClient.crm.associations.batchApi.create(fromObjectType, toObjectType, BatchInputPublicAssociation);
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)
}
Error:
{
[0] “statusCode”: 500,
[0] “body”: {
[0] “status”: “error”,
[0] “message”: “internal error”,
[0] “correlationId”: “7f3142a4-9ff8-42c8-8804-27b73c506114”
[0] },
I even tried this Accounts Dashboard | HubSpot endpoint and this one PUT…/crm/v3/objects/deals/{dealId}/associations/{toObjectType}/{toObjectId}/{associationType}
as well but with same error.