APIs & Integrations

Astroraf
Member

Matching Ticket to Contact

I am using Python to extract the data from HubSpot with the Private App API calls. I am using the Ticket and Contacts to load into dataframes within my python environment.

 

 

Tickets give me these key attributes:

archived
archived_at
associations
created_at
id
content
createdate
hs_lastmodifieddate
hs_object_id
hs_pipeline
hs_pipeline_stage
hs_ticket_category
hs_ticket_priority
subject
properties_with_history
updated_at
 
Contact gives me these key attributes:
archived
archived_at
associations
created_at
id
createdate
email
firstname
hs_object_id
lastmodifieddate
lastname
properties_with_history
updated_at

 

I am trying to match each ticket created to the contact but there isn't a key attribute in both data frames for me to match. Is this because of the Private Apps and what scopes I am picking or is there something else going on? Any and all help will be much appreciated. 

0 Upvotes
6 Replies 6
Astroraf
Member

Matching Ticket to Contact

get_object_id = api_client.crm.tickets.associations_api.get_all(ticket_id=1407233837, to_object_type='contacts')
get_object_id.results[0].to_object_id
0 Upvotes
TShma
Contributor

Matching Ticket to Contact

You should use the Associations API where you specify which object types (Contact and Ticket) you look for, and specific id of one of them (for instance, the contactId you want all connected Tickets for). In javascript/node.js the Hubspot client really simplifies things, so maybe the Python one does it as well. 

franksteiner79
Key Advisor

Matching Ticket to Contact

Hi @Astroraf 

 

My API/dev knowlegde is rudimentary, but I know HubSpot works with hs_object_id to identify individual records, and then associations to link objects together.

 

I would expect that the associations attribute in the ticket object contains a reference to a hs_object_id on a contact. This article seems to confirm my assumption.

 

I hope that helps.

Frank

Found my comment helpful? Great! Please mark it as a solution to help other community users.


Frank Steiner

Marketeer | HubSpot Expert | CRM Consultant

InboundPro

Let's Talk About Your Project
Astroraf
Member

Matching Ticket to Contact

Hi Frank,

 

So you are saying that Contacts has multiple hs_object_id's that are associated with one ticket?

0 Upvotes
franksteiner79
Key Advisor

Matching Ticket to Contact

Hi @Astroraf 

 

Yes and no.

  • Each object in HubSpot (contact, company, deal, ticket, etc.) has a hs_object_id
  • Each object in HubSpot is associated to one or more other HubSpot objects, check out https://app.hubspot.com/data-model-overview/HubID/ for an interactive overview. The ticket object can be associated with companies, contacts and deals with a 1-to-many relationship, i.e. 1 ticket is associated with 2 contacts.Screenshot 2023-02-01 at 21.36.41.png
  • This would mean, that the ticket in question would show 2 hs_contact_ids under the ticket association.
  • Similarly, if a contact has multiple tickets (pretty common scenario) you would be able to query the associated ticket objects which would return a series of hs_object_ids for tickets.

Does that make sense?

Frank

Found my comment helpful? Great! Please mark it as a solution to help other community users.


Frank Steiner

Marketeer | HubSpot Expert | CRM Consultant

InboundPro

Let's Talk About Your Project
0 Upvotes
Astroraf
Member

Matching Ticket to Contact

The link you provided, unfortunately, didn't work, but when I tried to match the Hubspot object ID in tickets to the HubSpot in Contacts, nothing matched. 

 

What I am finding is that the Contact object_id is no longer than 6 characters whereas the HubSpot object_id in the ticket is 10 characters long. 

 

Their object_id's do not match in length. 

 

As well, with my company's tickets, there is an option to fill an area called affiliate_code but this does not show in the ticket information. Is there a way to change this or get all the information from the ticket even if it's blank?

0 Upvotes