Get All Notes for a ticket

Hey all,

I am currently trying to get a list of all the notes, along with their hs__note_body, or the body_preview (to pull the note message into our internal systems). I’ve been been looking over/sending requests to the Ticket/Notes/Engagements API’s. So far I’ve only been able to do this by:
1) hitting https://api.hubapi.com/crm/v3/objects/tickets/{{ticketId}}?hapikey={{KEY_HERE}}&associations=engagments

to pull ticket Details and its associations to notes, example response below:

{
 "id": "...",
 "properties": {
....
 },
 "associations": {
 "engagements": {
 "results": [
 {
 "id": "engagementId1",
 "type": "ticket_to_engagement"
 },
 {
 "id": "engagementId2",
 "type": "ticket_to_engagement"
 },
 {
 "id": "engagementId3",
 "type": "ticket_to_engagement"
 },
 {
 "id": "engagementId4",
 "type": "ticket_to_engagement"
 }
 ]
 }
 }
}

then using the engagementIds from the above response to hit:

2)https://api.hubapi.com/engagements/v1/engagements/{{EngagmeentID}}?hapikey={{KEY_HERE}} to pull data for that 1 note (based on its engagementID) to get its bodyPreview. Example Below:

{
 "engagement": {
......
 "source": "CRM_UI",
 "allAccessibleTeamIds": [],
 "bodyPreview": "hi",
 "queueMembershipIds": [],
 "bodyPreviewIsTruncated": false,
 "bodyPreviewHtml": "<html>\n <head></head>\n <body>\n <p>hi</p>\n </body>\n</html>"
 },
 "associations": {
 "contactIds": [],
 "companyIds": [],
 "dealIds": [],
 "ownerIds": [],
 "workflowIds": [],
 "ticketIds": [
 1234
 ],
 "contentIds": [],
 "quoteIds": []
 },
 "attachments": [],
 "metadata": {
 "body": "<p>hi</p>"
 }
}

I would have to do this call several times, for every unique ticketId I wanted to gather Note body information from.
I haven’t seen a batch “get all notes and their details, given a ticketId” endpoint - there’s got to be a better way to do the above? this is the closest thing that I’ve seen in the forums, but it doesn’t appear to be what we’re looking for
https://community.hubspot.com/t5/APIs-Integrations/Getting-Latest-Notes-In-Tickets/m-p/571049#M50703

hi vplatform

You can directly get the notes using notes engaments API i.e. GET/crm/v3/objects/notes

refer to = https://developers.hubspot.com/docs/api/crm/notes, it already have the params hs__note_body which you want , you dont have to calll a seperate API to achieve this

Hope this helps! If we were able to answer your query, kindly help the community by marking it as a solution. Thanks and Regards.

``

@ChehakWadhdwa
I don’t want to get a random list of all the notes possible (say we have 1,000 tickets created in our dashboard, then your above solution to just hit GET/crm/v3/objects/notes would retrieve a paginated dump of all notes that exist, regardless of a specific ticketId). I want to specifiy a ticketId in the request above, and get a list of all notes for that ticketId

No response either? Everyone just points to the API docs. Trying to do this with contacts/deals. I want to get all notes associated with a contact_id.

@jaysonb just curious, did the solution @aaylsworth outlined work for your use case?

@laurabren no.

I recently used the /crm/v3/objects/notes/search endpoint to get a lost of notes associated with a certain custom objectId. Should be able to modify it for your use case.

// /crm/v3/objects/notes/search
{
 "filterGroups": [
 {
 "filters": [
 {
 "propertyName": "hs_attachment_ids",
 "operator": "EQ",
 "value": "<<ticketId>>"
 }
 ]
 }
 ],
 "properties": [
 "hs_note_body"
 ]
}

@aaylsworth what will be the propertyName?

returning

{

"total": 0,

"results": \[]

}

even the data is there

Try this works my end

//https://api.hubapi.com/crm/v3/objects/notes/search

{
 "filterGroups": [
 {
 "filters": [
 {
 "propertyName": "associations.ticket",
 "operator": "EQ",
 "value":"YOUR TICKET ID"
 }
 ]
 }
 ],
 "properties": ["hs_note_body"]
}

Thanks @psymon25 . It worked

This worked!!!