https://discord.gg/botpress logo
Hubspot API Call
# šŸ¤help
d
Geting hit with a Error while executing integration action: An unexpected error occurred in the integration. when using the Call API Card. First I run the execute code
Copy code
const contactId = workflow.createContactID;

const noteContent = `
:test_tube:  Qualification:
• Industry: ${workflow.business_industry}
• New Products: ${workflow.develops_new_products}
• Spend: ${workflow.annual_spend}
• Claimed Before: ${workflow.claim}
• State: ${workflow.primary_us_state}
• Challenge: ${workflow.challenge}
`;

const payload = {
  properties: {
    hs_note_body: noteContent.trim(),
    hs_timestamp: Date.now() // Important: Required
  },
  associations: [
    {
      to: { id: contactId },
      types: [
        {
          associationCategory: "HUBSPOT_DEFINED",
          associationTypeId: 202
        }
      ]
    }
  ]
};

workflow.noteRequestBodyStr = JSON.stringify(payload);

return { success: true };
and then the Make API Call https://cdn.discordapp.com/attachments/1381706707193037002/1381706707948015666/image.png?ex=684bc9e6&is=684a7866&hm=6554b2de97021511efe02beff2f46c09ca3606c10e4bb082d2178ac6c0798412&
p
Can you show the error you're getting?
d
An unexpected error occurred in the integration.
p
Have you tried assigning an output value? an you show the logs? Are you testing in. the preview or the emulator or an external platform?
d
1. Output value prints empty 2. Logs show 23:58:30 cd85bf8de3 debug card:"Generate R&D Qualification Note for HubSpot Contact" action Execute code ""Generate R&D Qualification Note for HubSpot Contact"" 23:58:31 cd85bf8de3 error dm dm Error while executing integration action: An unexpected error occurred in the integration. Bot owners: Check logs for more informations. Integration owners: throw a RuntimeError to return a custom error message instead.. The action error will be ignored since you are running in the Studio. Error while executing integration action: An unexpected error occurred in the integration. Bot owners: Check logs for more informations. Integration owners: throw a RuntimeError to return a custom error message instead.. The action error will be ignored since you are running in the Studio. {"scope":"dm"} 3.Preview emulator
p
You have tested both in the preview and the emulator? Might I suggest seeing if it works in jsfiddle.
d
ok
how to check injs fiddle
p
You would copy the embed script in the html part of jsfiddle. Hope this helps!
d
jsfiddle still gives an error
I just cant seem to find whats causing the error
same POST request in postman is working
Copy code
endpoint:"https://api.hubapi.com/crm/v3/objects/notes"
    method:"POST"
    data:"{"properties":{"hs_note_body":"stuff","hs_timestamp":1749666522958},"associations":[{"to":{"id":"128073896732"},"types":[{"associationCategory":"HUBSPOT_DEFINED","associationTypeId":202}]}]}"
ok I solved it šŸ’€
The logs I thought meant was the logs bar in workflow and not the one u find in dashboard. In dashboard I found it said
Copy code
[envyro/hubspot] 'Make API Call' exception {"message":"request to https://api.hubapi.comhttps//api.hubapi.com/crm/v3/objects/notes failed, reason: getaddrinfo ENOTFOUND
so I Just had to write
Copy code
/crm/v3/objects/notes
as Endpoint only
p
Glad you found the solution!!
2 Views