How send a ticket attachment using the Sendreply API in Zoho Desk

How send a ticket attachment using the Sendreply API in Zoho Desk

API document references : you make use of the Upload file API and gather the attachment ID. This ID is be passed with the Send email Reply API to deliver responses with the attachment intact.

Code template is as below:
  1. // ORGID
  2. ORGID = "XXXXXXX"; // Masked Org ID
  3. ApiUrl = "https://desk.zoho.com/api/v1";

  4. // Get Contact data
  5. getData = zoho.desk.getRecordById(ORGID, "tickets", TicketID);
  6. ContactID = getData.get("contactId");
  7. getContact = zoho.desk.getRecordById(ORGID, "contacts", ContactID);

  8. // update ticket with contact's phone number
  9. updateTicket = zoho.desk.update(ORGID, "tickets", TicketID, {"phone": getContact.getJSON("phone")});

  10. // Get thread attachments
  11. getthreadattachment = zoho.desk.getRelatedRecordById(ORGID, "threads", "XXXXXXX", "tickets", TicketID).getJSON("attachments");
  12. attachss = List();

  13. if(getthreadattachment != null && getthreadattachment.size() > 0)
  14. {
  15.   for each attach in getthreadattachment
  16.   {
  17.     attachid = attach.get("id");
  18.     fileName = attach.get("name");

  19.     if(isText(attach))
  20.     {
  21.       attach = attach.toFile(fileName);
  22.     }
  23.     attach = attach.toFile(fileName);
  24.     attach.setParamName("file");
  25.     
  26.     param = Map();
  27.     param.put(fileName, attach);
  28.     
  29.     uploadattachments = invokeurl
  30.     [
  31.       url : ApiUrl + "/uploads"
  32.       type : POST
  33.       parameters: param
  34.       headers: { "Content-Type": "multipart/form-data" }
  35.       connection: "XXXX" // Masked connection type
  36.     ];
  37.     
  38.     newattachid = uploadattachments.get("id");
  39.     attachss.add(newattachid);
  40.     info attachss;
  41.   }
  42. }

  43. // Prepare to render email template
  44. templateId = "XXXXXXX"; // Masked template ID
  45. Render = invokeurl
  46. [
  47.   url : ApiUrl + "/templates/" + templateId + "/render?entityId=" + TicketID
  48.   type : POST
  49.   connection: "XXXX" // Masked connection type
  50. ];
  51. contentEmail = Render.getJSON("body");
  52. Mappy = Map();
  53. Mappy.put("to", "masked_email@example.com"); // Masked recipient email
  54. Mappy.put("content", contentEmail);
  55. Mappy.put("contentType", "html");
  56. Mappy.put("fromEmailAddress", "masked_sender@example.com"); // Masked sender email
  57. Mappy.put("channel", "EMAIL");
  58. Mappy.put("isForward", "false");
  59. Mappy.put("attachmentIds", attachss);// input the attachmentid

  60. sendResponsess = invokeurl
  61. [
  62.   url : ApiUrl + "/tickets/" + TicketID + "/sendReply"
  63.   type : POST
  64.   parameters: Mappy + ""
  65.   connection: "XXXX" // Masked connection type
  66. ];

  67. info sendResponsess;

Explanation:

  1. Fetching Ticket Details: The script retrieves ticket and contact information to update the ticket’s phone number.
  2. Uploading Attachments: It gathers any attachments from the ticket's threads and uploads them to the Zoho Desk system.
  3. Sending Emails: Finally, it prepares an email using a specified template and includes any uploaded attachments before sending.

Feel free to adapt this code for your own ticket handling processes in Zoho Desk! Just remember to replace the masked values with your actual data when implementing.


Happy coding!

    • Recent Topics

    • Cliq iOS can't see shared screen

      Hello, I had this morning a video call with a colleague. She is using Cliq Desktop MacOS and wanted to share her screen with me. I'm on iPad. I noticed, while she shared her screen, I could only see her video, but not the shared screen... Does Cliq iOS is able to display shared screen, or is it somewhere else to be found ? Regards
    • Tabular View Report | Scale To Fit Screen

      Please add the option to scale Tabular View reports to fit the screen. I constantly have to adjust the column size of Tabular View reports to fit various screen sizes and it just looks messy. You can see in the screenshot below there is a blank gap after
    • What's New in Zoho POS - May 2026

      Hello everyone, Welcome to Zoho POS’s monthly update, where we share our latest feature updates, enhancements, events, and more. Let’s take a look at how May went. Introducing the new Settings page with enhanced search The Settings page has been revamped
    • Mapbox map embed in Zoho webpage

      The mapbox map is not showing in Zoho webpage. the code was running fine other webpage.
    • DYK 6 - Task Assignment from the Workload Report

      Did You Know tasks can be assigned from the Workload Report? As projects evolve, tasks pile up and distributing them equally among team members becomes a balancing act. Identifying over-allocated and underutilised members gets complicated when task assignment
    • Mise à jour de Zoho Books – France

      Chers clients, Merci pour votre patience et votre soutien continu. Avec les évolutions réglementaires à venir en France nous introduisons de nouvelles fonctionnalités dans Zoho Books pour les clients français. Ces mises à jour ont été conçues pour répondre
    • Building extensions #3: Zoho Sprints developer platform features and capabilities

      Hello all! We're thrilled to connect with you in another post in our Building extensions series. We've explored concepts in building, testing, publishing, and sharing extensions for Zoho Sprints. If you missed any of this, take a look at our other posts.
    • How do create a validation rule / function to check datetime field is within Business Hours?

      I've got a field called Scheduled_Time. People keep accidently inputting 2am when they mean 2pm. Realistically this field is never going to be before 7am or after 9pm. I'd like to add validation rule to the field (which is a datetime field). Using the
    • Experience effortless record management in CRM For Everyone with the all-new Grid View!

      Hello Everyone, Hope you are well! As part of our ongoing series of feature announcements for Zoho CRM For Everyone, we’re excited to bring you another type of module view : Grid View. In addition to Kanban view, List view, Canvas view, Chart view and
    • Schedule from AI with Zoho Bookings MCP Server

      Greetings from the Zoho Bookings team! We’re excited to introduce the Zoho Bookings MCP (Model Context Protocol) Server integration, a powerful new way to bring AI-driven automation into your scheduling workflows. With MCP, you can connect Zoho Bookings
    • Zoho Projects > Zoho Analytics - where are 'Work Hours' ?

      I'm trying to replicate the forecasting calculations and need to find 'Work Hours' as a key component. Such as: Planned Cost - The product of work hours and its cost per hour I've been able to track Work Hours to the Task screen and when you expand it
    • Automate pushing Zoho CRM backups into Zoho WorkDrive

      Through our Zoho One subscription we have both Zoho CRM and Zoho WorkDrive. We have regular backups setup in Zoho CRM. Once the backup is created, we are notified. Since we want to keep these backups for more than 7 days, we manually download them. They
    • Free Webinar Alert! Cliq in Zoho Workplace: Collaborate and Communicate Smarter

      Hello Zoho Community! Looking for a better way to keep your teams connected and conversations organized? We’ve got a webinar you won’t want to miss. Join our webinar on "Zoho Cliq in Zoho Workplace" and discover how smarter communication can improve collaboration
    • Upcoming webinar: Getting started with Zoho LandingPage

      Building your first landing page? We’ll help you get started. A landing page is more than just a place to send your visitors—it’s where your campaigns generate leads, drive actions, and create meaningful customer interactions. Join our monthly Getting
    • Native QuickBooks integration for Zoho CRM: Connecting sales and finance

      Greetings, I hope all of you are doing well. We're excited to announce Zoho CRM's integration with QuickBooks Web, which is designed to synchronize your CRM data with your QuickBooks accounting records and bridge the gap between sales and finance. This
    • Restoring deleted files

      Hi I have been using zoho writer app personal account from last 7 months and made number of documents for educational purposes. I deleted the writer app by mistake and I lost all the documents.I reinstalled the app but the documents are not restored even
    • Unable to mass update a specific field

      Hi there, I want to mass update a field on zoho crm but im not able to as it doesnt show up. procurement list is a lookup field
    • Introducing Databridge | Securely connect your private systems with Creator apps

      Hello everyone, Enterprises today rely on a mix of privately hosted databases and cloud applications to run their everyday operations. But connecting these two worlds has always been a challenge - one that often forces teams to choose between accessibility
    • Folders for CRM Dashboards

      Implement ability to create folders to store dashboards within. Example useful for case such as individual sales persons dashboards grouped by year into folders.
    • [Webinar] Solving business challenges: Customizing Writer for your business requirements

      Hi Zoho Writer users, Every organization has unique branding, formatting standards, and workflow requirements. Yet most teams work with default settings, manually applying fonts, recreating templates, and adjusting preferences for every document—wasting
    • The latest enhancements to Bigin

      Greetings, I hope all of you are doing well. We're happy to announce three recent enhancements we've made to Bigin. We'll go over each one in detail. Bigin integration with Zoho LandingPage You now have the ability to connect Bigin with Zoho LandingPage.
    • Best practice for tracking the sending of samples or catalogues

      Hi,  My company sells leather and fabric for interiors- sofas, chairs, curtains etc. Our clients are all interior designers, architects or furniture manufacturers. What is the best way to track what samples/catalogues we have sent? If the project is fairly certain, for example, for a specific hotel renovation, then we'll track this as an opportunity, as the project has a definite date, budget and is sure to happen (we may of course lose the project, but we want to bid for it). If the designer just
    • AIRPORT TRANSFER BOOKING SYSTHEM

      Hi guys i just start using zoho creator to manage my transportation booking management company. I have built two booking forms, one that i'll embeded in the website and one for the registered companies. 1st problem: don't know how to auto fill corporate customers details from contacts list to the booking companies booking form . need help!!
    • Marketer's Space: Re-engage your Audience with WhatsApp Journeys

      Hello Marketers, Welcome back to another post in Marketers' Space! We’re continuing our WhatsApp Journeys series, diving into strategies that ensure your marketing efforts don’t go unnoticed. So, you drafted an email with personalization, a compelling
    • Using assigned value from a dropdown list to populate a field

      Hello, I use a dropdown with a global list that has assigned values. The value is a name, the assigned value is the corresponding email. When selecting my name from the drop down, I want the "Save for later" template to use the assigned email as recipient.
    • Inventory Barcode Creation - Add Picture of Item

      Hi I am trying to set up bar code labels and include a picture of the item on the label - any idea on how to add that field to the barcode generator?
    • Form in ticket reply

      Good day, I know I can use Snip to reply, but is there a way to create a web form to request specific additional information for a ticket? e.g., When a ticket is resolved for a telephone or printer issue, is there a way to reply via a web form to request
    • SalesIQ operators will not receive any messages if customers do not answer the Pre-Chat questions in Flow Controls.

      Hi Zoho SalesIQ Team, I am reaching out to report a issue regarding the Brands > Flow Controls SalesIQ operators will not receive any messages if customers do not answer the Pre-Chat questions in Flow Controls and continue sending messages without completing
    • Zoho Inventory Feature Roadmap Visible To All

      Hello, please consider making your feature roadmap visible to us users so that we know what to expect in future. This may appease current users who are seeking clarification on feature implementation dates, so that they can make an informed decision whether
    • Cannot Access Subform Display Order in Deluge

      As highlighted in this community post, we still have to deal with the significant limitation of not being able to access the user-sorted order of subform rows through Deluge. This creates a major disconnect between the UI capabilities and backend automation,
    • Delete Tags - Maximum for Module

      Hello, I have just received the message that I have reached the maximum tags for a module. We'd like to consolidate tags so some deletion is required. Can you please advise how we can do this? Thanks / Stephanie
    • I need targets and actuals achieved data to be visible in zoho. It might be calls revenue emails or whatever how do i make it visible in analytics?

      I need targets and actuals achieved data to be visible in zoho. It might be calls revenue emails or whatever how do i make it visible in analytics?
    • Reporting phishing emails to Zoho?

      I came across a few threads after searching for info about reporting phishing emails to Zoho. From what I read, it appears that Zoho doesn't want to hear about phishing. You suggest marking such messages as Spam. Phishing and spam are separate issues, and I believe that phishing is the more dangerous. A user who is not paying close attention is in danger of giving away important data - usernames, passwords, email addresses, SSNs, etc. - to people who are happy to misuse such data and victimize email
    • Deploy or update Zoho CRM custom functions via curl

      How can I deploy/modify/update my custom deluge functions using curl? Can't find related API endpoints in CRM documentation Provide me with examples I need it for making autodeploy process from git repo Thank you
    • SEO recommendation of H1 tag for website tittle

      The exact words are “ It is good practice to place the page title inside the H1tag.” Now I already have one H1 tag on my website but it is not website tittle. In the SEO recommendation that is clear too that I have h1 tag on my page. Now I don’t know
    • Store WorkDrive Recordings Locally Until Upload Completes

      Hi, Hope you are doing well. We would like to submit a feature request regarding the video recording functionality in Zoho WorkDrive. Currently, when a user records a video through WorkDrive and the upload process fails or gets stuck, the recording may
    • Functional URLs and Environments

      I am developing my creator application with my application in an environment. I have a Page that has two buttons and an embedded section. When I first developed this page, each of the buttons had functional URLs to export the page as a PDF and one to
    • Zoho CRM to Google Calendar time synchronization

      Hello Enterprise Support Community, Our developers have identified an ongoing issue with the Zoho CRM and Google Meeting sync. Currently, there is a delay in syncing meetings/events between the two applications. Additionally, when a meeting is created
    • Allow Zia Agents using Zoho One Account

      When I went to try Zia Agents, it forced the creation of a new, separate account. This seems counter-intuitive to me. I don't want to manage a separate account. Plus, aren't Zoho One users the ones most likely to adopt Zia Agents most quickly? It seems
    • Zoho Flow needs a comprehensive public API — the foundation for agentic flow building, self-healing flows, and MCP

      Zoho is going all-in on agentic AI: Zia LLM, 25+ prebuilt Zia Agents, the no-code Zia Agent Studio, and an MCP server that opens up the action libraries of 15+ Zoho apps to any MCP client. That direction is exactly right. But there is a structural gap
    • Next Page