APIs & Integrations

olejekg
Participant

how to download attachments in ticket

SOLVE

Hi! I can`t download attaches from tickets reply via api. 

I have file_id and use method Get curl 'http://api.hubapi.com/filemanager/api/v2/files/{file_id}?hapikey={api_key}'

In responce I have some url`s: s3_url, friendly_url, alt_url, url.

But any of that url`s does not working. 

s3_url gives me a 403 error

friendly_url, alt_url and url gives me a 404 error. 

How can I get my attachments from ticket replies for other integration via hubspot-API?

 

0 Upvotes
1 Accepted solution
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

how to download attachments in ticket

SOLVE

Hey @olejekg,

 

It is currently not supported to set hidden file to false and not possible to access file with hidden: true. As Derek mentioned here:

 

The hidden flag is intended to make assets viewable only when accessed from an object record (i.e. from an app.hubspot.com/file-preview URL).

That said, I was able to locate a similar idea posted on our idea forum - HubSpot Community - Ability to access hidden files over the API - HubSpot Community and if you haven't already, I'd recommend upvoting this idea. Hopefully this will gather more interest.

View solution in original post

6 Replies 6
WendyGoh
HubSpot Employee
HubSpot Employee

how to download attachments in ticket

SOLVE

Hey @olejekg,

 

I believe this issue is similar to what has been discussed on this dev forum thread - Solved: HubSpot Community - Get attachments on a company, contact, or deal - HubSpot Community

 

The underlying issue here is that the file is set to "hidden:true" as such you wouldn't be able to accessed it via the public file URLs e.g. https://cdn2.hubspot.net/hubfs/712/image.png/image.png 

 

As per what Isaac mentioned:

 

 

Per Derek's first response to this Community post as well as @SwivelDev's response to this other Community post, files which are uploaded externally directly to a deal or contact will be hidden by default.

At this time, it is not possible to change a file from "hidden": true to "hidden": false, or vice versa, as indicated in this article. I am sorry if this comes as an unwelcome surprise.

One way to prevent files from being hidden is to upload them to HubSpot's file manager before attaching them to an engagement. See this screencast.

That said, if the following:

Use this Engagements API endpoint to retrieve engagements on a CRM object, locate file IDs in various engagements' attachments arrays, query this endpoint with the file IDs, and find that the URLs in the url fields led to 404 error pages?

 

isn't the steps you took, do you mind sharing with me more details on the steps you took? As well as the following:

1. The HubSpot portal ID

2. The ticket ID

3. The file ID

0 Upvotes
olejekg
Participant

how to download attachments in ticket

SOLVE

So Get Associated Engagements din not helps me. I posted the request to curl 'https://api.hubapi.com/engagements/v1/engagements/associated/TICKET/95493202/paged?hapikey={API-key}' and get some information about my ticket including attachments id's but not working links or files content.

Get File metadata endpoint given me not working links because "hidden:true". That is, there is no chance to get files on APA at all?

0 Upvotes
WendyGoh
HubSpot Employee
HubSpot Employee

how to download attachments in ticket

SOLVE

Hey @olejekg,

 

Thanks for sharing the details over!

 

On my end, I'm able to see that file id 26317599351 is set to hidden: true as such we wouldn't be able to access this file via the public file URL. 

 

Moving forward, if you'd like to prevent file from being hidden: true, your team would need to upload the file into your file manager first before attaching it onto your HubSpot object (e.g. ticket/contact). 

 

Let me know if you'd need further clarification on this! 

0 Upvotes
olejekg
Participant

how to download attachments in ticket

SOLVE

Thank you for clarification. Is there any other way to get such files, maybe not through the links. Can you somehow retrieve the contents of a file that is hidden: true?

0 Upvotes
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

how to download attachments in ticket

SOLVE

Hey @olejekg,

 

It is currently not supported to set hidden file to false and not possible to access file with hidden: true. As Derek mentioned here:

 

The hidden flag is intended to make assets viewable only when accessed from an object record (i.e. from an app.hubspot.com/file-preview URL).

That said, I was able to locate a similar idea posted on our idea forum - HubSpot Community - Ability to access hidden files over the API - HubSpot Community and if you haven't already, I'd recommend upvoting this idea. Hopefully this will gather more interest.

olejekg
Participant

how to download attachments in ticket

SOLVE

1. The HubSpot portal ID: 7124303

2. The ticket ID: 95493202

3. The file ID: 26317599351

0 Upvotes