Want to send attachements to Telepin Zendesk.

AkashYen007
Tera Guru

Hi Team,

 

I'm newbie to the attachement sending part in Servicenow. I saw few solutions and tried to follow it but not working for me as Zendesk expecting below paramets in the API 

AkashYen007_0-1698042969176.png

I managed to send this till now 

var attachment = new GlideRecord('sys_attachment');
    attachment.addQuery('table_name', current.getTableName());
    attachment.addQuery('table_sys_id', current.sys_id);
    attachment.query();
    while (attachment.next()) {
        sysid = attachment.sys_id;
        size = attachment.size_bytes;
        height = attachment.image_height;
        width = attachment.image_width;
        filename = attachment.file_name;
        contentType = attachment.content_type;
        gs.info('File Name: ' +filename +'\nSize: ' +size +'\nWidth: '+width +'\nHeight:'+height +'\nContent Type:'+contentType);
        try {
            var r1 = new sn_ws.RESTMessageV2('Telepin', 'Post Attachment');
            //r1.setQueryParameter("table_name", attachment.table_name);
            //r1.setQueryParameter("table_sys_id",sysid);
            r1.setQueryParameter('size', size);
            r1.setQueryParameter('height', height);
            r1.setQueryParameter('width', width);
            r1.setQueryParameter("file_name", filename);
            r1.setQueryParameter('id', sysid);
            r1.setRequestHeader("content_type", contentType);
            var response1 = r1.execute();
            var responseBody1 = response1.getBody();
            var httpStatus1 = response1.getStatusCode();
            gs.info('Response Body:' + responseBody1 + '\n Status Code:' + httpStatus1);
            gs.info();
        } catch (ex1) {
            var message1 = ex1.message1;
        }
    }
for above code I'm getting error 422 'Unparsable Attachment error in Servicenow'AkashYen007_1-1698043279649.png

 

I may be wrong understanding this and I'm not able to understand how to send content in base64 to zendesk or send this attachment as a file to zendesk ?
 
1 ACCEPTED SOLUTION

Yes checking with Zendesk community also but was checking if anyone from our community had this same issue or know the solution for this.

Thanks Peter for the help.

View solution in original post

5 REPLIES 5

You're welcome.

 

Zendesk is not an easy tool to integrate with unfortunately. That's why a lot of Zendesk customers use a tool like Exalate to integrate with it. This works nice together with ServiceNow as well.

If this has helped you in any way, please close the thread by marking my answer as correct.


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.