Attach images are broken in agent's portal | Community
Skip to main content

Attach images are broken in agent's portal

  • December 28, 2019
  • 2 replies
  • 0 views

I am trying to upload image with request API through proxy server. Image is uploaded successfully and I receive token and then I make new request with the received token in uploads as comment object. It makes a new open request with the corrupted image. The problem is when I want to see that picture on zendesk portal it is blank, it seems like a corrupted image.

2 replies

  • January 9, 2020

Pulling into here the conversation from https://support.zendesk.com/hc/en-us/articles/223137947-Attaching-files-to-tickets-via-API#comment_360003761454....

Hi @raghees -- I don't have any Node.js sample code for this particular scenario. If you're using Node and using the Upload and Ticket Update APIs, this should work to attach a file to a ticket. If you're still having issues, please post a simplified version of your Node code here that reproduces the problem. If you got it working and don't mind, please share what ended up working. Thanks!


  • January 24, 2020

FYI @raghees - Possibly related for anyone using this Node.js library to upload images -- see post https://develop.zendesk.com/hc/en-us/community/posts/360038436714

There is a "binary" parameter that needs to be set to "false" when passing in a string to indicate the file location of a binary file. Example:

var zendesk = require('node-zendesk');

var client = zendesk.createClient({
username: 'john@example.com',
password: 'mypassword',
remoteUri: 'https://your_subdomain.zendesk.com/api/v2'
});

client.attachments.upload("./myBinaryFile.jpg", {binary: false, filename: 'myBinaryFile.jpg'}, function(err, req, result) {
if (err) {
console.log("error:", err);
return;
}
console.log("result:", result);
console.log("req:", req);
})