Transform API Responses with Formatter in Guided Conversations | Zoho Desk

Formatter (Deluge) in Webhook Block


Not all API responses come in the exact format you want to show to your users, and that’s where Formatter comes in. With Formatter, you can use Deluge scripting to transform your raw API response into clean, user-friendly content that fits your use case perfectly.
 
Let’s say your API returns a complex object or sends data with field names that aren’t helpful to your chatbot audience. Maybe the date format looks like this: 2025-06-02T10:45:00Z; but you want it to display as “2 June 2025, 10:45 AM.” Or perhaps your API returns a ticket object with ticket_subject and ticket_id, but you want to display something more readable like Issue #2034 - Payment failed.


Learn more about webhooks: Introduction to Webhook Block in GC 

What is Formatter?

Formatter is a feature inside the Webhook Block of Guided Conversations. After your webhook pulls in data from an API, Formatter lets you modify that data before passing it on in the conversation.
You can:
  1. Change field names to make them more meaningful
  2. Reformat date and time values
  3. Merge values from multiple fields
  4. Extract specific items from nested JSON
  5. Loop through lists to create summaries or readable content
 All of this is done using Deluge. Even if you’re not a professional developer, Deluge makes these transformations easy to implement. 
 


Why Formatter is useful  

Think of Formatter as your data-cleaning assistant.
Here’s why it matters:
  1. Makes API responses more readable for end users
  2. Avoids confusing terms like “ticket_id” or “cust_name”
  3. Helps structure content to match your tone or formatting
  4. Lets you show only what’s important and hide the rest
  5. Works seamlessly with other parts of the Guided Conversation flow 
 In short, Formatter helps you speak your user’s language, not your system’s. 
 

Example Use Cases   

Reformatting Date and Time

API Response:

 { 
   "order_date": "2025-06-02T10:45:00Z" 
 } 

Goal: Display it as "2 June 2025, 10:45 AM"

Formatter Code:

 formatted_date = order_date.toDateTime("yyyy-MM-dd'T'HH:mm:ss'Z'").toString("d MMMM yyyy, h:mm a"); 
 return {"formatted_date": formatted_date};   

Bot Response:

Your order was placed on 2 June 2025, 10:45 AM.

Use the return keyword to pass values to the next block. Info is for debugging only. Returning a string wraps it in a list, so return a map for cleaner handling.  
Renaming Fields

API Response:

 { 
   "cust_name": "Talaash Thedal" 
 }  

Goal: Rename "cust_name" to "Customer Name"
 

Formatter Code:

 customer_name = cust_name; 
 return {"customer_name": customer_name}; 

Bot Response:

Customer Name: Talaash Thedal
 
Renaming field keys in Formatter doesn’t affect variable names in other blocks. Only webhook-mapped variables can be referenced directly in the conversation flow. 
Merging Field Values

API Response:

 { 
   "ticket_id": "2034", 
   "ticket_subject": "Payment failed" 
 } 

Goal: Show as “Issue #2034 - Payment failed”

 

Formatter Code: 

 issue_summary = "Issue #" + ticket_id + " - " + ticket_subject; 
 return {"issue_summary": issue_summary}; 

  

Bot Response:

Issue #2034 - Payment failed

Extracting from Nested Objects

API Response: 

 { 
   "user": { 
     "details": { 
       "contact": { 
         "email": "aarav@example.com" 
       } 
     } 
   } 
 } 

Goal: Get just the user’s email

 

Formatter Code:

 email_id = user.get("details").get("contact").get("email"); 
 return {"email_id": email_id}; 

Bot Response:

Contact Email: talaash@gmail.com

Looping through Arrays

​API Response: 

 { 
   "recent_orders": [ 
     { "order_id": "123", "status": "Delivered" }, 
     { "order_id": "124", "status": "Processing" } 
   ] 
 } 

Goal: Show a list like:

  • Order #123 - Delivered

  • Order #124 - Processing

 

Formatter Code:

 orders = recent_orders; 
 summary = ""; 
 for each order in orders 
 { 
   summary += "Order #" + order.get("order_id") + " - " + order.get("status") + "\n"; 
 } 
 return {"order_summary": summary};   
 

Bot Response:

  • Order #123 - Delivered

  • Order #124 - Processing

   

Extracting specific items from Nested JSON   

Let’s say your API returns a list of departments, but you only want to display the default ones.

Extract from Nested JSON
Extract from Nested JSON
Let’s say your API returns a list of departments, but you only want to display the default ones.
 
API Response
 { 
   "data": [ 
     { 
       "name": "Support", 
       "isDefault": false 
     }, 
     { 
       "name": "Sales", 
       "isDefault": true 
     } 
   ] 
 } 

Goal: Extract only the departments where "isDefault": true

Formatter Code:
 // Create an empty collection to store departments that match our condition 

 result = Collection();   
 // Get the list of all departments from the response data 
 allDepartments = response.get("data");   
 // Go through each department one by one from the list 
 for each department in allDepartments 

 

     // Check if this department is marked as the 'default' department 
     isDefault = department.get("isDefault");   
     // If the department is the default one, add it to our result collection 
     if(isDefault == true) 
     { 
         result.insert(department); 
     } 
 }  
 
 // Return the final list of default departments 
 return result; 

Bot response
Default Department: Sales

You can use this returned result in the next block to extract a specific field-like name from the department object.
 

Tips


  1. Always check the structure of your API’s JSON response; it helps to know what you’re working with.
  2. Use the info statement in Deluge to debug your code and preview values.
  3. Use Formatter right after the Webhook block so the response is ready for the next message block.
  4. Combine Formatter with Conditions and Variables to build powerful, dynamic conversations.


Learn more about webhooks: Introduction to Webhook Block in GC 

      Create. Review. Publish.

      Write, edit, collaborate on, and publish documents to different content management platforms.

      Get Started Now


        Access your files securely from anywhere

          Zoho CRM Training Programs

          Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

          Zoho CRM Training
            Redefine the way you work
            with Zoho Workplace

              Zoho DataPrep Personalized Demo

              If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

              Zoho CRM Training

                Create, share, and deliver

                beautiful slides from anywhere.

                Get Started Now


                  Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                  BOOK A SESSION







                              Quick LinksWorkflow AutomationData Collection
                              Web FormsRetailOnline Data Collection Tool
                              Embeddable FormsBankingBegin Data Collection
                              Interactive FormsWorkplaceData Collection App
                              CRM FormsCustomer ServiceForms for Solopreneurs
                              Digital FormsMarketingForms for Small Business
                              HTML FormsEducationForms for Enterprise
                              Contact FormsE-commerceForms for any business
                              Lead Generation FormsHealthcareForms for Startups
                              Wordpress FormsCustomer onboardingForms for Small Business
                              No Code FormsConstructionRSVP tool for holidays
                              Free FormsTravelFeatures for Order Forms
                              Prefill FormsNon-Profit
                              Forms for Government
                              Intake FormsLegal
                              Mobile App
                              Form DesignerHR
                              Mobile Forms
                              Card FormsFoodOffline Forms
                              Assign FormsPhotographyMobile Forms Features
                              Translate FormsReal EstateKiosk in Mobile Forms
                              Electronic FormsInsurance
                              Drag & drop form builder

                              Notification Emails for FormsAlternativesSecurity & Compliance
                              Holiday FormsGoogle Forms alternative GDPR
                              Form to PDFJotform alternativeHIPAA Forms
                              Email FormsWufoo alternativeEncrypted Forms
                              Accessible FormsTypeform alternativeSecure Forms

                              WCAG

                                          Create. Review. Publish.

                                          Write, edit, collaborate on, and publish documents to different content management platforms.

                                          Get Started Now






                                                            You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                                Manage your brands on social media

                                                                  Use cases

                                                                  Make the most of Zoho Desk with the use cases.

                                                                   
                                                                    

                                                                  eBooks

                                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho Desk.

                                                                   
                                                                    

                                                                  Videos

                                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho Desk.

                                                                   
                                                                    

                                                                  Webinar

                                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                                   
                                                                    
                                                                  • Desk Community Learning Series


                                                                  • Meetups


                                                                  • Ask the Experts


                                                                  • Kbase


                                                                  • Resources


                                                                  • Glossary


                                                                  • Desk Marketplace


                                                                  • MVP Corner



                                                                    Zoho Sheet Resources

                                                                     

                                                                        Zoho Forms Resources


                                                                          Secure your business
                                                                          communication with Zoho Mail


                                                                          Mail on the move with
                                                                          Zoho Mail mobile application

                                                                            Stay on top of your schedule
                                                                            at all times


                                                                            Carry your calendar with you
                                                                            Anytime, anywhere




                                                                                  Zoho Sign Resources

                                                                                    Sign, Paperless!

                                                                                    Sign and send business documents on the go!

                                                                                    Get Started Now




                                                                                            Zoho TeamInbox Resources





                                                                                                      Zoho DataPrep Demo

                                                                                                      Get a personalized demo or POC

                                                                                                      REGISTER NOW


                                                                                                        Design. Discuss. Deliver.

                                                                                                        Create visually engaging stories with Zoho Show.

                                                                                                        Get Started Now










                                                                                                                            • Related Articles

                                                                                                                            • Response in Webhook Block

                                                                                                                              Once your webhook sends a request to an external API, it often receives a response. This is where the Response List in the webhook block becomes incredibly useful. It lets you capture and use the data that comes back from the API, right inside your ...
                                                                                                                            • Connections in Webhook Block

                                                                                                                              When you’re working with webhooks in a bot flow, whether you’re retrieving data, updating a record, or triggering a third-party service, you often need to establish a secure connection with an external application. That’s where Connections come into ...
                                                                                                                            • Query Params in Webhook Block

                                                                                                                              When you want to pass extra information along with your API request, like a ticket ID, customer email, or a specific status, query parameters come in handy. These small but powerful additions to your API URL help external systems understand exactly ...
                                                                                                                            • PATCH Method in Webhook Block

                                                                                                                              Do you need to update just one or two pieces of information in another system, such as changing a ticket’s priority or updating a user’s phone number, without touching anything else? Use the PATCH method in your Webhook block to make precise, partial ...
                                                                                                                            • DELETE Method in Webhook Block

                                                                                                                              Do you need to remove a support ticket, delete a user, or clean up records in another system? The DELETE method in the Webhook block helps you do just that from within your bot flow. It allows you to directly remove data from external platforms like ...
                                                                                                                              Wherever you are is as good as
                                                                                                                              your workplace

                                                                                                                                Resources

                                                                                                                                Videos

                                                                                                                                Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                                eBooks

                                                                                                                                Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                                Webinars

                                                                                                                                Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                                CRM Tips

                                                                                                                                Make the most of Zoho CRM with these useful tips.



                                                                                                                                  Zoho Show Resources