Zoho Voice SDK | Details and Configuration

Zoho Voice SDK | Details and Configuration

Java SDK

Introduction


Zoho Voice is a cloud-based telephony service using which you can make and receive calls. Zoho Voice also provides SDKs for developers to integrate their app with Zoho Voice.

SDK Details and Configuration


Download Refresh Token


Step 1 : Login https://voice.zoho.com 
Step 2 : Please click the "java sdk refresh token" button under the user profile.

Step 3 : Store refresh token in DB.


ZohoVoiceSDK Structure 


Source jar for SDK

(jar needs to be copied to your lib directory)


ZohoVoiceSDK.jar

available in lib/ZohoVoiceSDK.jar


Needed lib for SDK

(Dependencies folder needs to be copied to your product zip)


httpcore-4.4.5.jar,  json,  httpclient-4.5.2.jar, commons-logging-1.1.1.jar

available in lib/thirdParty_Jars


java docs for SDK




Java SDK

SDK Object


SDK Object Creation 

(mandatory)


ZohoVoiceSDK zohoVoiceSDK = new ZohoVoiceSDK(DC dc  ,  String refreshToken);

(ZohoVoiceSDK object created only in server start)


Default DataCenter : DC.US

Allowed DataCenter : 

DC.US


Set Proxy


zohoVoiceSDK.setViaProxy(boolean)


Default value : false

Zoho Voice API Object 

Zoho Voice API Object 

API object creation 

(mandatory)


ZohoVoiceAPI zohoVoiceAPI = new ZohoVoiceAPI(zohoVoiceSDK);


zohoVoiceSDK was created in the above step.




Features of SDK

Agents

Import Agents

Import agents from your app to Zoho Voice.
  1.  // Create import object
  2.  ImportAgents importAgents = new ImportAgents();

  3.  // Create agentsinfo object 
  4.  AgentsInfo agentsInfo = new AgentsInfo();
  5.  agentsInfo.setName("ZohoVoice");
  6.  agentsInfo.setEmailId("abc@sample.com");
  7.  agentsInfo.setDepartmentName("ZVoice");
  8.  // Using the associated number api allows to associate phone numbers.  
  9.  JSONArray associatedNumber = new JSONArray(); // Collection of phone numbers
  10.  agentsInfo.setAssociatedNumbers(associatedNumber);

  11.  // Multiple agentsInfo object
  12.  ArrayList<AgentsInfo> agentsInfos = new ArrayList<AgentsInfo>();
  13.  agentsInfos.add(agentsInfo);

  14.  importAgents.setAgentsInfo(agentsInfos);

  15.  ZohoVoiceAPI zohoVoiceAPI = new ZohoVoiceAPI(zohoVoiceSDK);
  16.  ImportAgentsResponse response = zohoVoiceAPI.importAgents(importAgents);

  17.  // Response Object
  18.  String status = response.getStatus();
  19.  String statusCode = response.getStatusCode();
  20.  String errorMessage = response.getErrorMessage();
  21.  JSONObject responseInJSON = response.getJSONObject();
  22.  ArrayList<Agents> agents = response.getAgents();
  23.  Agents agent = agents.get(0);
  24.  agent.getAgentId();
  25.  agent.getAgentNumber();
  26.  agent.getDepartmentName();
  27.  agent.getEmailId();
  28.  agent.getExtension();
  29.  agent.getName();
  30.  agent.getOnlineStatus();


Get Login Details

Fetch the login details by inputting agent ID and email address.
  1.  GetAgentLoginDetail getAgentLoginDetail = new GetAgentLoginDetail();
  2.  // Set agentId or emailId .
  3.  getAgentLoginDetail.setAgentId("agentId");
  4.  getAgentLoginDetail.setEmailId("emailId");

  5.  ZohoVoiceAPI zVoiceAPI = new ZohoVoiceAPI(zohoVoiceSDK);
  6.  GetAgentLoginDetailResponse response = zVoiceAPI.getAgentLoginDetail(getAgentLoginDetail);

  7.  // Response Object
  8.  String status = response.getStatus();
  9.  String statusCode = response.getStatusCode();
  10.  String errorMessage = response.getErrorMessage();
  11.  JSONObject responseInJSON = response.getJSONObject();
  12.  JSONObject loginDetails = response.getLoginDetail();
  13. //LoginDetails has the credentials to log in to the dialer


Get Agents

Input agent ID or search key and get the agent list.
  1.  GetAgents getAgents = new GetAgents();
  2.  getAgents.setAgentId("agentId");
  3.  getAgents.setSearchKey("searchKey");
  4.  getAgents.setFromIndex(2);
  5.  getAgents.setToIndex(10);

  6.  ZohoVoiceAPI zohoVoiceAPI = new ZohoVoiceAPI(zohoVoiceSDK,);
  7.  GetAgentsResponse response =  zohoVoiceAPI.getAgents(getAgents);

  8.  // Response Object
  9.  String status = response.getStatus();
  10.  String statusCode = response.getStatusCode();
  11.  String errorMessage = response.getErrorMessage();
  12.  JSONObject responseInJSON = response.getJSONObject();
  13.  ArrayList<Agents> agents = response.getAgents();
  14.  Agents agent = agents.get(0);
  15.  agent.getAgentId();
  16.  agent.getAgentNumber();
  17.  agent.getDepartmentName();
  18.  agent.getEmailId();
  19.  agent.getExtension();
  20.  agent.getName();
  21.  agent.getOnlineStatus();


Associated Number

To get details about associated numbers and respective agents.

  1.  GetAssociatedNumbers getAssociatedNumbers = new GetAssociatedNumbers();
  2.  getAssociatedNumbers.setAgentId("agentId");

  3.  ZohoVoiceAPI zohoVoiceAPI = new ZohoVoiceAPI(zohoVoiceSDK);
  4.  GetAssociatedNumbersResponse response = zohoVoiceAPI.getAssociatedNumbers(getAssociatedNumbers);

  5.  // Response Object
  6.  String status = response.getStatus();
  7.  String statusCode = response.getStatusCode();
  8.  String errorMessage = response.getErrorMessage();
  9.  JSONObject responseInJSON = response.getJSONObject();
  10.  ArrayList<NumberInfo> outgoingNumbers = response.getOutgoingNumbers();
  11.  ArrayList<NumberInfo> incomingNumbers = response.getIncomingNumbers();
  12.  NumberInfo incomingNumber = incomingNumbers.get(0);
  13.  Long numberId = incomingNumber.getNumberId();
  14.  String displayName = incomingNumber.getDisplayName();
  15.  String telNumber = incomingNumber.getTelNumber();
  16.  String countryCode = incomingNumber.getCountryCode();
  17.  String didNumber = incomingNumber.getDidNumber();


Regenerate Key

To regenerate the agent-specific key. This key and password are used to log in to the Dialer.

  1.  RegenerateKey regenerateKey = new RegenerateKey();
  2.  regenerateKey.setAgentId("AgentId");
  3.  regenerateKey.setOldAgentKey("oldAgentPassword");

  4.  ZohoVoiceAPI zohoVoiceAPI = new ZohoVoiceAPI(zohoVoiceSDK);
  5.  RegenerateKeyResponse response = zohoVoiceAPI.regenerateKey(regenerateKey);

  6.  // Response Object
  7.  String status = response.getStatus();
  8.  String statusCode = response.getStatusCode();
  9.  String errorMessage = response.getErrorMessage();
  10.  JSONObject responseInJSON = response.getJSONObject();


Regenerate Password

To regenerate the agent-specific password.

  1.  RegeneratePassword regeneratePassword = new RegeneratePassword();
  2.  regeneratePassword.setAgentId("AgentId");
  3.  regeneratePassword.setEmailId("abc@sample.com");
  4.  regeneratePassword.setOldPassword("oldPassword");

  5.  ZohoVoiceAPI zohoVoiceAPI = new ZohoVoiceAPI(zohoVoiceSDK);
  6.  RegeneratePasswordResponse response = zohoVoiceAPI.regeneratePassword(regeneratePassword);

  7.  // Response Object
  8.  String status = response.getStatus();
  9.  String statusCode = response.getStatusCode();
  10.  String errorMessage = response.getErrorMessage();
  11.  JSONObject responseInJSON = response.getJSONObject();

Resend Mail

To resend the email that contains the regenerated password.

  1.  ResendMail resendMail = new ResendMail();
  2.  resendMail.setAgentId("AgentId");
  3.  resendMail.setEmailId("abc@sample.com");

  4.  ZohoVoiceAPI zohoVoiceAPI = new ZohoVoiceAPI(zohoVoiceSDK);
  5.  ResendMailResponse  response = zohoVoiceAPI.resendMail(resendMail);

  6.  // Response Object
  7.  String status = response.getStatus();
  8.  String statusCode = response.getStatusCode();
  9.  String errorMessage = response.getErrorMessage();
  10.  JSONObject responseInJSON = response.getJSONObject();

Call Transfer - Agent or Queue List

Shows a list of agents or queue to whom a call needs to be transferred.

  1.  TransferAgentOrQueue transferAgentOrQueue = new TransferAgentOrQueue();
  2.  transferAgentOrQueue.setSearchText("searchText");
  3.  transferAgentOrQueue.setFromIndex(2);
  4.  transferAgentOrQueue.setToIndex(10);
  5.  transferAgentOrQueue.setIncludeQueues(true);

  6.  ZohoVoiceAPI zohoVoiceAPI = new ZohoVoiceAPI(zohoVoiceSDK);
  7.  TransferAgentOrQueueResponse response = zohoVoiceAPI.transferAgentOrQueue(transferAgentOrQueue);

  8.  // Response Object
  9.  String statusCode = response.getStatusCode();
  10.  String errorMessage = response.getErrorMessage();
  11.  JSONObject responseInJSON = response.getJSONObject();
  12.  ArrayList<Agents> agents = response.getAgents();
  13.  Agents agent = agents.get(0);
  14.  agent.getAgentId();
  15.  agent.getAgentNumber();
  16.  agent.getDepartmentName();
  17.  agent.getEmailId();
  18.  agent.getExtension();
  19.  agent.getName();
  20.  agent.getOnlineStatus();


Logs

Get Call Logs

Fetch the call logs from Zoho Voice.

  1.  GetCallLogs getCallLogs = new GetCallLogs();
  2.  getCallLogs.setFromIndex(1);
  3.  getCallLogs.setToIndex(20);
  4.  getCallLogs.setFromDate("2021-09-27");
  5.  getCallLogs.setToDate("2021-09-30");
  6.  getCallLogs.setAllCountry(true);
  7.  getCallLogs.setMinCredits(1.0);
  8.  getCallLogs.setMaxCredits(10.0);
  9.  getCallLogs.setMinDuration(20); // min duration in secs
  10.  getCallLogs.setMaxDuration(30);// max duration in secs
  11.  // agent id get from Get Agents
  12.  ArrayList<String> agnetIds = new ArrayList<String>();
  13.  agnetIds.add("615000001010123");
  14.  getCallLogs.setAgnetIds(agnetIds);
  15.  // call types
  16.  ArrayList<String> callTypes = new ArrayList<String>();
  17.  callTypes.add("incoming");
  18.  callTypes.add("outgoing");
  19.  callTypes.add("missed");
  20.  callTypes.add("forward");
  21.  callTypes.add("bridged");
  22.  getCallLogs.setCallType(callTypes);

  23.  ZohoVoiceAPI zohoVoiceAPI = new ZohoVoiceAPI(zohoVoiceSDK);
  24.  GetLogsResponse getLogsResponse = zVoiceAPI.getCallLogs(getCallLogs);

  25.  // Response 
  26.  String status = getLogsResponse.getStatus();
  27.  String statusCode = getLogsResponse.getStatusCode();
  28.  String errorMessage = getLogsResponse.getErrorMessage();
  29.  JSONObject responseInJSON = getLogsResponse.getJSONObject();
  30.  ArrayList<CallLog> logs = getLogsResponse.getCallLogs();
  31.  CallLog callLog = logs.get(0);
  32.  String agentName = callLog.getAgentName();
  33.  String callDuration = callLog.getCallDuration();
  34.  String callerIdName = callLog.getCallerIdName();
  35.  String callerIdNumber = callLog.getCallerIdNumber();
  36.  String callType = callLog.getCallType();
  37.  String destinationNumber = callLog.getDestinationNumber();
  38.  String endTime = callLog.getEndTime();
  39.  String startTime = callLog.getStartTime();

      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

                                                                                                                            • Zoho Voice vs Zoho Telephony

                                                                                                                              Zoho Voice vs Zoho Telephony: Demystified In Zoho One or apps such as Zoho CRM, Desk, Recruit, and Bigin, there are two ways to configure the calling functionality (click-to-call and call pop-up features) using Zoho Telephony. One is using an ...
                                                                                                                            • How to configure Yealink desk phones with your Zoho Voice account

                                                                                                                              Zoho Voice now enables you to connect your Zoho Voice account with any type of IP-enabled Yealink desk phones which are one of the prominent workstations in major call centers. This enables you to easily make and receive Zoho Voice calls using ...
                                                                                                                            • How to launch power dialer campaigns in Zoho Voice?

                                                                                                                              Getting started To get started with the power dialer, follow these steps: Create a new campaign. Import contacts for the campaign. Customize the campaign. Launch the campaign. 1. Create a new campaign To create a new outbound call campaign: Select ...
                                                                                                                            • How to configure Grandstream desk phones with your Zoho Voice account

                                                                                                                              Zoho Voice now enables you to connect your Zoho Voice account with any Grandstream IP-enabled hardphone which are one of the prominent workstations in major call centers. This enables you to easily make and receive Zoho Voice calls using Grandstream ...
                                                                                                                            • How to configure Poly desk phones with your Zoho Voice account

                                                                                                                              Zoho Voice now enables you to connect your Zoho Voice account with any type of IP-enabled Poly desk phones which are one of the prominent workstations in major call centers. This enables you to easily make and receive Zoho Voice calls using Poly ...
                                                                                                                              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