Attach images are broken in agent's portal

2 Comments

  • Bryan - Community Manager
    Zendesk Developer Support

    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!

    0
  • Bryan - Community Manager
    Zendesk Developer Support

    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);
    })

     

    0

Please sign in to leave a comment.

Powered by Zendesk