Plug Sample: Fetch ticket status from Zoho Desk on Codeless bot builder | Zoho SalesIQ

Plug Sample: Fetch ticket status from Zoho Desk on Codeless bot builder | Zoho SalesIQ

Hi everyone, Good to see you. 

Are you using the Codeless bot platform for building your bot? Did you know that plugs are exclusively made for performing customized actions on Codeless bot? 
Here is a simple plug for fetching the status of the ticket from Zoho Desk. This plug can get the ticket number from the visitor and update them with the status of their ticket. You can do slight customization to the script and use it. Let's know how to create and use this plug in real time. 

How to Create this Plugs?
  • In your SalesIQ Dashboard, navigate to Settings>Developers>Plugs> Click on Add .
  • Provide your Plug a name, description, select the Platform as SalesIQ Scripts , and click on Create Plug
  • Click on Parameters, provide the following. 
Input Parameters :
  • Name: ticketnumber | Data Type: String
Output Parameters :
  • Name: priority | Data Type: String
  • Name: subject | Data Type: String
  • Name: description | Data Type: String
  • Name: days | Data Type: String
  • Name: CreatedTime | Data Type: String

  • Copy, paste the below code and change your Zoho Desk Organisation ID and Connection name. 
Create a Connection with Zoho Desk with the below scopes and use the connection name in the code. 

Scope for this Plug code:
  • Desk.tickets.ALL
  • Desk.search.READ
  1. //Change your Zoho Desk organization ID
  2. orgId = "1234";
  3. //Get ticket number from the parameters
  4. if(session.containsKey("ticketnumber"))
  5. {
  6. ticket_number = session.get("ticketnumber").get("value");
  7. }
  8. searchQuery = Map();
  9. searchQuery.put("ticketNumber",ticket_number);
  10. //zohodesk - Connection name
  11. get_ticket = zoho.desk.searchRecords(orgId,"tickets",searchQuery,0,1,"zohodesk");
  12. info get_ticket;
  13. //get ticket details from "get_ticket"
  14. modified_time = get_ticket.get("data").getJSON("modifiedTime").toDate();
  15. created_time = get_ticket.get("data").getJSON("createdTime").toDate();
  16. ticket_number = get_ticket.get("data").getJSON("ticketNumber");
  17. priority = get_ticket.get("data").getJSON("priority");
  18. status = get_ticket.get("data").getJSON("statusType");
  19. raw_description = get_ticket.get("data").getJSON("description");
  20. raw_subject = get_ticket.get("data").getJSON("subject");
  21. subject = raw_subject + "- (" + status + ")";
  22. description = raw_description.replaceAll("<[^>]*>","");
  23. description = description.replaceAll("&nbsp;"," ");
  24. time_now = today;
  25. numberOfDays = daysBetween(modified_time,time_now);
  26. if(numberOfDays == 0)
  27. {
  28. time_interval = "Today";
  29. }
  30. else if(numberOfDays == 1)
  31. {
  32. time_interval = "1 day ago";
  33. }
  34. else
  35. {
  36. time_interval = numberOfDays.toString() + " days ago";
  37. }
  38. info time_interval;
  39. info description;
  40. info priority;
  41. info created_time;
  42. response = Map();
  43. response.put("CreatedTime",created_time);
  44. response.put("days",time_interval);
  45. response.put("description",description);
  46. response.put("priority",priority);
  47. response.put("subject",subject);
  48. return response;
  • Then, click Save, preview the plug and Publish it.
How to add Plugs in Codeless bot?
  • Navigate to Settings>Bot>Add and give the necessary informations and select Codeless Bot as bot platform or open an existing bot.
  • Select the Plugs card under Action Cards and select the required Plug (Only published plugs will be listed here)
  • Provide the Plug inputs (values to be obtained from the visitors) and outputs (value to be given for the visitors). 

  • In the plug input, the ticket_number is the bot context variable that stores ticket number obtained from the visitors fields card.

Note: 
  • Create a visitors fields to get ticket number from the visitor and save the values in context variable for plugs input. 

Related Links:

To know more about the features of zobot, kindly visit our Resources Section

    Zoho Developer Community






                              Zoho Desk Resources

                              • Desk Community Learning Series


                              • Digest


                              • Functions


                              • Meetups


                              • Kbase


                              • Resources


                              • Glossary


                              • Desk Marketplace


                              • MVP Corner


                              • Word of the Day



                                  Zoho Marketing Automation


                                          Manage your brands on social media



                                                Zoho TeamInbox Resources

                                                  Zoho DataPrep Resources



                                                    Zoho CRM Plus Resources

                                                      Zoho Books Resources


                                                        Zoho Subscriptions Resources

                                                          Zoho Projects Resources


                                                            Zoho Sprints Resources


                                                              Qntrl Resources


                                                                Zoho Creator Resources


                                                                  Zoho WorkDrive Resources



                                                                    Zoho Campaigns Resources

                                                                      Zoho CRM Resources

                                                                      • CRM Community Learning Series

                                                                        CRM Community Learning Series


                                                                      • Tips

                                                                        Tips

                                                                      • Functions

                                                                        Functions

                                                                      • Meetups

                                                                        Meetups

                                                                      • Kbase

                                                                        Kbase

                                                                      • Resources

                                                                        Resources

                                                                      • Digest

                                                                        Digest

                                                                      • CRM Marketplace

                                                                        CRM Marketplace

                                                                      • MVP Corner

                                                                        MVP Corner







                                                                          Design. Discuss. Deliver.

                                                                          Create visually engaging stories with Zoho Show.

                                                                          Get Started Now