APIs & Integrations

Not applicable

Attaching File to Company

Is it possible to upload or link a file to the attachment section of a company using the API. We have several attached files in our other CRM that I’m trying to transfer over.

0 Upvotes
8 Replies 8
adamnoureddine
Member

Attaching File to Company

I have company for vinyl flooring Toronto. Can i use it for that purpose.

0 Upvotes
Not applicable

Attaching File to Company

@seb_fairchild That works, thank you.

0 Upvotes
seb_fairchild
Member

Attaching File to Company

Hey @James_Bathgate

attachments should not be part of the associations object.

try this payload instead:

{
  "engagement": {
    "active": true,
    "type": "NOTE"
  },
  "associations": {
    "contactIds": [
      29280
    ],
    "companyIds": [],
    "dealIds": [],
    "ownerIds": [],
    "workflowIds": []
  },
  "attachments": [
    {
      "id": 4241968539
    }
  ],
  "metadata": {
    "body": "<strong>IMPORTED FROM NUTSHELL</strong>"
  }
}

Sebastian

Not applicable

Attaching File to Company

Any response to this? I’ve provided a reproducible test case.

0 Upvotes
Not applicable

Attaching File to Company

@seb_fairchild

Here’s an example curl request:

curl -v -X POST -H "Content-Type: application/json" -A "SearchSpring HubSpot API" -d '{"engagement":{"active":true,"ownerId":null,"type":"NOTE","timestamp":1469116690000},"associations":{"contactIds":[29280],"attachments":[{"id":4241968539}]},"metadata":{"body":"<strong>IMPORTED FROM NUTSHELL<\/strong>"}}' https://api.hubapi.com/engagements/v1/engagements?hapikey=my-api-key 

The response I’m getting does not have the attachments array:

{"engagement":{"id":131442414,"portalId":492396,"active":true,"createdAt":1469118333628,"lastUpdated":1469118333628,"ownerId":0,"type":"NOTE","timestamp":1469116690000},"associations":{"contactIds":[29280],"companyIds":[],"dealIds":[],"ownerIds":[],"workflowIds":[]},"metadata":{"body":"<strong>IMPORTED FROM NUTSHELL</strong>"}}
0 Upvotes
seb_fairchild
Member

Attaching File to Company

@James_Bathgate

You can only add attachments to an engagement with the parameter type:NOTE. If the engagement is a note you should get an attachments array in the response even if the engagement doesn’t have an attachment.

Sebastian

0 Upvotes
Not applicable

Attaching File to Company

@seb_fairchild I’m using type:NOTE, I’ll come up with an example just using curl.

0 Upvotes
Not applicable

Attaching File to Company

@seb_fairchild I can’t seem to get this to work, are you sure that’s the right format for the attachments? I don’t see an attachments property returned in the associations after adding the engagement.

["associations"]=>
    object(stdClass)#121768 (5) {
      ["contactIds"]=>
      array(1) {
        [0]=>
        int(29280)
      }
      ["companyIds"]=>
      array(0) {
      }
      ["dealIds"]=>
      array(0) {
      }
      ["ownerIds"]=>
      array(0) {
      }
      ["workflowIds"]=>
      array(0) {
      }
    }
0 Upvotes