Creating Custom Labels Complains of no unlabeled labels but one exists

I’m trying to set up an association between a Contact and Communication. For outbound SMS I’m tagging them as `{ associationCategory: “HUBSPOT_DEFINED”, associationTypeId: 81}` which works fine. I want to then tag incoming SMS messages and differentiate them.

Since the Hubspot defined one is generic, I attempted to make a new one via `/crm/v4/associations/contacts/Communications/labels`, but when I do I get the following error:

“Invalid object type pair for custom association definition as unlabeled definition doesn’t exist for CONTACT → COMMUNICATION association”

If I query `/crm/v4/associations/contacts/Communications/labels` with a GET request I get one result back:

{ results: [ { category: "HUBSPOT_DEFINED", typeId: 82, label: null, }, ],}

Ignoring that the `typeId` is different (82 never works for me, but 81 does, which matches the docs), I see that the label is null, but the `POST` request seems to think there isn’t an existing blank label.

I’m following the directions at https://developers.hubspot.com/docs/api/crm/associations for creating new association labels.

Hey, @ctank_work :waving_hand: Can you share your request when trying to use the ID 82, please?

I think I need further information, but it sounds like:

  • using the typeID of 81 (Communication to Contact) works
  • using the typeID of 82 (Contact to Communication) doesn’t work as expected for your use case
  • if I’m understanding, you need a second (custom) association to signify Incoming (Communication to Contact) communications
  • It’s worth noting associations are always omni-directional

Do you get a validation error when trying to create a custom association from Communication to Contact?
Can you try from the Association Schema Endpoints tab here, please? — Associations v4

My quick test:

Request

curl --request POST \
 --url https://api.hubapi.com/crm/v4/associations/Communication/Contact/labels \
 --header 'authorization: Bearer YOUR_ACCESS_TOKEN' \
 --header 'content-type: application/json' \
 --data '{
 "label": "Incoming SMS",
 "name": "incoming-sms"
}'

Response

HTTP 400

{
 "status": "error",
 "message": "Invalid object type pair for custom association definition as unlabeled definition doesn't exist for COMMUNICATION -> CONTACT association",
 "correlationId": "13471df6-5f64-4ed3-9b62-068d76d25f65",
 "category": "VALIDATION_ERROR"
}

Thanks! — Jaycee

This might be part of the confusion. The docs for Associations just mention that “82” is the ID for Contact to Communication, but never mention “81”. I only stumbled on that “81” works because some examples showed “87” instead of “88” when it came to associating Company and Communications, so I chalked this up to a documentation error.

Looking at your examples, you are doing Communications → Contact, where I’ve been doing Contact → Communications. That seems to be part of my issue, because “81” exists on Communication → Contact, and “82” exists on Contact → Communication. That clears that up for me a bit.


@Jaycee_Lewis wrote:
[…]

  • It’s worth noting associations are always omni-directional

If I’m understanding this, I should be able to create an association either way and get the same result - adding a Communication → Contact relationship is the same as a Contact → Communication relationship, they just have different association IDs, correct?
Hubspot itself doesn’t seem to differentiate between an incoming communication and an outgoing communication, correct? It’s just “A communication over some channel”? That’s how it appears to me, which is why I’m trying to make an actual labeled version so I can distinguish an inbound versus an outbound message.
As to making a new label under `Communications/contact`, I get the following error:

{
 status: "error",
 message: "Invalid object type pair for custom association definition as unlabeled definition doesn't exist for COMMUNICATION -> CONTACT association",
 correlationId: "8b33f832-c23a-4029-8dbf-974a81c84022",
 category: "VALIDATION_ERROR",
}

So the issue still exists, because if I query `/crm/v4/associations/Communications/contact/labels` I get an unlabled “81”:

{
 results: [
 {
 category: "HUBSPOT_DEFINED",
 typeId: 81,
 label: null,
 },
 ],
}

and if I query `/crm/v4/associations/contact/Communications/labels` I get an unlabled “82”. It seems either way it’s not noticing that there is indeed an unlabeled association already.