I’m trying to create a simple association between a contact and a deal in nodejs library, specifically using typescript, but cannot find documentation on the associationType string or the toObjectType to use.
There is a legacy list of Definition IDs here, but I am using the version 3 nodejs library, which asks for a string in the typescript type definitions like:
The first 3 parameters seem obvious, but note that associationType is a string, not a number as given in the legacy docs. Is there a list like this for v3 library api?
More generally, is there a standard place to find documents with this type of definition?
Thanks for writing this out. We are working hard on creating and updating documentation to be more consistent. We will also be focusing on creating more sample projects for the various libraries. Although I do not have anything for you now, I just want you to know that your voice is not unheard here.
I found that calling the associationsApi for existing associations gives me the type that I can then use to create an association.
So I can get and view the association like this:
const result = await hubspotClient.crm.contacts.associationsApi.getAll(contactId,'deal');
console.log(JSON.stringify(result.body.results))
and it shows output for existing related deals like this:
[{"id":"1234567890","type":"contact_to_deal"}]
This gives me a way to find any given associationType if I really want to verify it. It also corroborates my guess that it is the module names with “_to_” in between so they should generally be easy to guess.
I have not yet verified that I can create the association using that associationType, but I expect that to work.
Of course a full list would be welcome, or a better way that does not require that I create an association through the UI and write dummy code to show it. But this lets me move on.