Adding Attachment to Desk Ticket via Deluge
Hello,
My team has a process where some people are entering information into a workbook in Zoho Sheet, and we need to get a copy of workbook into a ticket in Desk. We currently have a 'Submit' button on the Sheet that triggers a webhook to Flow, and from there we find the appropriate Desk Ticket and run a function to download a copy of the file (Sheet file as xlsx) and attach it to the Ticket.
I'm able to get the file from Sheet just fine, but whenever I try to attach it I get an error saying Bad Request. Here is a portion of the code where I grab the file and try to attach it..
- if(targetSheetId != null)
- {
- downloadParams = Map();
- downloadParams.put("method","workbook.download");
- downloadParams.put("format","xlsx");
- downloadSheet = invokeurl
- [
- url :"https://sheet.zoho.com/api/v2/download/" + targetSheetId
- type :GET
- parameters:downloadParams
- connection:"sheetconnection"
- ];
- info "Download? " + downloadSheet;
- info "is File? " + downloadSheet.isFile();
- //
- //
- ticketAttachment = Map();
- ticketAttachment.put("file",downloadSheet);
- attachFile = invokeurl
- [
- url :"https://desk.zoho.com/api/v1/tickets/" + ticketId + "/attachments"
- type :POST
- parameters:ticketAttachment
- connection:"deskconnection"
- ];
- info attachFile;
- }
The responses I get on my info statements are:
[
"Download? Testing File.xlsx",
"is File? true",
{
"errorCode": "BAD_REQUEST",
"message": "Bad Request."
}
]
The
Create Attachment api references to types of parameters needing to be passed and I imagine that is where I'm getting tripped up, but am not sure.
Any help is appreciated!