Attachment & image from public notes is uploaded to S3 but not able to stream and attach it to ticket

We are working on a ticket to move attachment in public notes in FS to ticket created in FD. We were successfully upload attachment & image to S3 from FS but facing issues while stream and attach it to newly created FD ticket.

Here is the community topic what we referred and tried

Creating tickets with attachments using serverless apps - FAQs - Freshworks Developer Community

Here is the code

var fields = {
‘email’: ‘’,
‘subject’: ‘Ticket subject’,
‘description’: ‘Ticket description.’,
‘status’: 2,
‘priority’: 1
var headers = {
‘Authorization’: auth,
.attach(‘attachments’, ‘’)
.attach(‘attachments’, ‘’)
.attach(‘attachments’, ‘’)
// console.log(response);
console.log("Response Status : " + response.status)
// if(response.status == 201){
// console.log("Location Header : "+ response.headers[‘location’])
// }
// else{
// console.log(“X-Request-Id :” + response.headers[‘x-request-id’]);
// }

Here is the attachment moving from FS to FD

I guess, system fails reading the file path url

Note : I have modified Algorithm, Credentials and Signature, fyi.

Need your help to attach file and images from s3 to ticket.


Hi @Karuppu_Samy,

Seems like you were able to upload attachements from :freshservice: to S3 but are facing problems in adding them back to :freshdesk:.

But following screenshots suggest you were able to successfully accomplish it. Can you suggest what is the error that you are facing?

Issue in third attachment file did not mention that the file extension name.
Because this is a s3 url like end of with credentials added.

Remaining attachment file URL’s don’t have credentials because these files are added.

Thank you.

Looks like .attach() method is part of unirest library.

So Ideally it’s not the system failing in reading the path, but unirest package itself expects the file name,

So since the url given as an argument to the 3rd attachment has query params that unirest’s attach method treats it to be a filename.


Hi @Saif,
I also tried the same, the attachments are uploading but the extension type is unknown (i.e., .txt, .png, etc) as shown in the above screenshot raised by @Karuppu_Samy

and as you mentioned I have passed the name as “attachments” and path as “s3 link” but taking the name from the path. How I can specify what type of file that is uploaded?


Hi @Karuppu_Samy, @soujanya,

You can pass the filename and content type for the s3 links via a third arg like so

It is likely that the signed URL is missing Content-disposition/ content-type headers. Unirest considers it as content_type: 'application/octet-stream', by default



This topic was automatically closed after 13 days. New replies are no longer allowed.