How I can fetch all notes from each contact using API?

engagements

#1

Hi Guys,

I am able to fetch each contacts, but I couldn't fetch notes from each contact using php with curl. Please share me if you have any help link or code.

Regards,
Krishna


#2

Hi @krishna,

Notes are a type of engagement, so you can use the Engagements API to pull a record's associated engagements:


#3

I tried to fetch an engagement and it returns empty results. Do I need to add any parameter while requesting data?

array (size=3)
'results' =>
array (size=0)
empty
'hasMore' => boolean false
'offset' => int 0


#4

Hi @krishna,

Can you post the full request URL (except the api key) and the full response body so I can take a look? Are you sure you're using the correct hapikey?


#5

I am using URL as:
https://api.hubapi.com/engagements/v1/engagements/associated/COMPANY/78451/paged?limit=2&hapikey=xxxxxx';

Output:
array (size=3)
'results' =>
array (size=0)
empty
'hasMore' => boolean false
'offset' => int 0

I couldn't find COMPANY ID in the contacts list output.

Yes, I am using correct hapikey as I can retrieve contact list without any issue. Only problem in retrieving engagement.


#6

Hi @krishna,

Ok so based on that, it looks like you're trying to pull all the engagements associated with a given company record? Is that right? If so, you'll need to get the companyId from the contact's associatedCompanyId field. If instead you're trying to pull the engagements associated with a particular contact record, you'll need to hit change COMPANY to CONTACT in your request URL.


#7

Yes, I am trying to fetch engagements in a contact. I'm still unable to fetch the engagement. Is there any special permission is needed? In below url 110454 is vid.

$url = 'https://api.hubapi.com/engagements/v1/engagements/associated/contact/110454/paged?limit=20&hapikey=xxxx';


#8

Do you have any sample code to fetch contacts + engagements. I want to export contacts and engagements into csv format. If I get data from api, I can write code to generate csv file. I'm stuck at getting data from hubspot using api.


#9

Hi @krishna,

There aren't any additional permissions needed to fetch engagements. Can you give me an example contact in your portal that you're currently experiencing issues with?