Hubspot pipeline tickets API

PerrySmithMoss
Member

Hi,

 

I was wondering if there was a way in which I could get the associated contact and company details of a ticket using an API? Or copy the ticket's associated company and contact details into fields on the ticket via a workfllow? 

 

For a little background information... I have an application which currently pulls all tickets within a specific pipeline, using the crm/v3/objects/tickets/searchcrm/v3/objects/tickets/search POST API (https://developers.hubspot.com/docs/api/crm/search). However, I cannot seem to get the associated company and contact details of a ticket using the API. Is there a way to do so?

 

Any advice/solutions is appreciated.

 

Many thanks,

 

Perry.

0 Upvotes
2 Replies 2
MichaelC
Guide | Partner
Hi!

If you know your ticket id you can list any associated object (contact, company, deals etc) using the api.

https://api.hubapi.com/crm/v3/objects/tickets/ticketId/associations/toObjectType

If your ticket id is 12345 and you are looking for all associated contacts it would look like
https://api.hubapi.com/crm/v3/objects/tickets/12345/associations/contacts?hapikey=yourapikeygoeshere

From this you can recieve all object ids associated to your ticket and from there get all the properties you need and create a new copy if you want to. You just need to know how to code or get anyone to so for you.


Need further help with integrations or business development?



Want to help me?

Go to the following links and read through the ideas. If you like them - give the idea an upvote

Upvote the following ideas:

PerrySmithMoss
Member

Hi Michael, 

 

Thank you for taking the time to reply. 

 

In the end I created two functions, one for getting the ticket's associated contact and the other for getting the company and passed in the ticket's id as a parameter. Within each function I first used the 

crm-associations/v1/associations/{$ticketId} GET API and inserted the ticket's id at the end of the url.
I then used the 
crm/v3/objects/contacts/search POST API, filtered the request by the object id returned from the GET request and added the properties I wanted to be returned.