Hubspot API

Hello, it looks as though the hubspot API has recently been updated and some current endpoints are depreciated (either that or I’m doing something very wrong).
Specifically, it looks as though the Associated Company IDs endpoint has been depreciated: https://developers.hubspot.com/docs/api/crm/associations

If it’s working as expected, then I’m really stuck trying to use a company ID to associate a ticket on hubspot.

Hey @ljcn!

Which Resource and Operation in n8n are giving you an error? Also, can you share what error are you getting?

Thanks.

Hello,

I’m using the hubspot node and specifically the create ticket. In the associated company field I’m getting the errors:

  • ERROR: additionalFields.associatedCompanyIds is not iterable

  • The value 5061378862 is not supported! (where the number is the company ID on Hubspot)

I’d like to use the numerical ID as the associated company varies depending on the webhook that initiated the flow, maybe it’s not geared up for the numerical ID?

Are you passing the value in the Expression Editor?

If you can share your workflow (copy the nodes and paste them) here, I will take a look and might be able to re-create the error.

Sounds like you are providing a single value where it expects an Array.

If you select the company from the dropdown, you should see that it works fine. At least it does for me.

In case you want to set it via an expression you have to make sure to return an Array. So it has to be set to something like this:

{{ [ $json.companyId ] }}
1 Like

Thank you, I’ve tried doing both.

{
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "bb197400-1a3d-4ec9-8230-8e4c65f1ae12",
        "options": {}
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        400,
        310
      ],
      "webhookId": "bb197400-1a3d-4ec9-8230-8e4c65f1ae12"
    },
    {
      "parameters": {
        "resource": "company",
        "name": "={{$node[\"Webhook\"].json[\"body\"][\"post\"][\"post_title\"]}}",
        "additionalFields": {
          "websiteUrl": "={{$json[\"body\"][\"post_permalink\"]}}"
        }
      },
      "name": "Hubspot Company",
      "type": "n8n-nodes-base.hubspot",
      "typeVersion": 1,
      "position": [
        580,
        310
      ],
      "credentials": {
        "hubspotApi": "Hubspot"
      }
    },
    {
      "parameters": {
        "resource": "ticket",
        "pipelineId": "0",
        "stageId": "1",
        "ticketName": "New Service Added",
        "additionalFields": {
          "associatedCompanyIds": "5061376684",
        }
      },
      "name": "Create Ticket",
      "type": "n8n-nodes-base.hubspot",
      "typeVersion": 1,
      "position": [
        760,
        310
      ],
      "credentials": {
        "hubspotApi": "Hubspot"
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Hubspot Company",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Hubspot Company": {
      "main": [
        [
          {
            "node": "Create Ticket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Hi @jan

This makes sense! And your solution works!
Thank you so much, the support here is insane!

1 Like

You are welcome. Great to hear both! Have fun!

1 Like