APIs & Integrations

breaking_manu
Member | Partner
Member | Partner

Create engagement with attachments

Hi everyone,

 

I'm trying to create an engagement note on a deal with an attached PDF file. I first uploaded the pdf with the File API and got its id and then created the engagement with thoses params:

 

{

  ownerId: '37813497',
  engagement: {

    type: 'NOTE',
    ownerId: '37813497',
    active: true,
    timestamp: 1563184618379

  },
  associations: { dealIds: [ 870432758 ], companyIds: [ 2201006749 ] },
  attachments: [ { id: 11269511185 } ],
  metadata: {

    body: 'File uploaded'

  }

}

 

The engagement is created but the attachments field is empty. I tried attaching the same file through the UI and it worked. Could you please help me with this ? Thanks a lot

0 Upvotes
2 Replies 2
webdew
Guide | Diamond Partner
Guide | Diamond Partner

Create engagement with attachments

HI @breaking_manu ,


Method :Patch
header contenttype : application/json

https://api.hubapi.com/engagements/v1/engagements/11899186385?hapikey=
{
"engagement": {
"id": 11899186385,
"portalId": 24890843,
"active": true
},

"attachments": [
{
"id": 45019881424
},
{
"id": 45776845557
}
]
}


Hope this helps!

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

0 Upvotes
lscanlan
HubSpot Alumni
HubSpot Alumni

Create engagement with attachments

Hi @breaking_manu,

 

Did you get this one figured out? I wonder if the ID is incorrect. When you search for the file through the CMS Files API: https://developers.hubspot.com/docs/methods/files/get_files_file_id, do you find the file with that ID? What was the field name where you got that ID from?

 

Otherwise it looks like you've got the right process for uploading a file, creating an engagement, and attaching the file to the engagement.

 

Leland Scanlan

HubSpot Developer Support
0 Upvotes