Hello, everyone! Welcome to another Kaizen week. In this post, we will discuss how third-party applications can integrate with Zoho CRM using
Java SDK 5.0.
Use case
Zylker is a real-estate app which can integrate with any CRM vendor and uses that data for it's use-cases. Zylker uses Java for the backend server code. Now they want to integrate with Zoho CRM. How will they do it? Those users could be in different Zoho data centers like Europe (.eu), USA(.com), India(.in), Australia(.com.au) etc. With Zoho CRM's Java SDK 5.0, which consumes Zoho CRM v5 APIs, we can to do authorization and establish this integration. Zylker will write one common code and it should be usable for any CRM orgs across all DCs.
Java SDK Project dependency
Include the Java dependency using either Maven or Gradle. The maven dependency is as below:
<repositories>
<repository> <id>zohocrmsdk-5-0</id> </repository> </repositories> <dependencies> <dependency> <groupId>com.zoho.crm</groupId> <artifactId>zohocrmsdk-5-0</artifactId> <version>4.0.0</version> </dependency> </dependencies>
|
If you are not using Maven or Gradle, please include the Zoho CRM
Java SDK JAR and
dependant JARs directly into the Java build path.
Setting up the OAuth client
Create a
Server-based Application in the corresponding API console page (
https://www.zohoapis.{com/in/eu/com.au}). Enable "
Multi-DC" under Settings of the app. Choose "
Use the same OAuth credentials for all data centers". With this, you can use the same client ID, client secret, and redirect URI to authorize any Zoho account in any data center. Please refer to our previous posts to know more about domains and environments [
Part -1] and [
Part - 2].
Integrating the client with your application
In Zylker's web UI, there will be an option to integrate with Zoho CRM. The integration can be initiated from a link or a button containing the
authorization URL, along with the corresponding client ID, state, redirect URI, and OAuth scopes. Once the user clicks on this link/button and completes the OAuth authorization process on Zoho, they will be redirected to the specified redirect URI with HTTP parameters
location,
code,
accounts server, and
state. These parameters can be utilized within the Java code logic of the redirect URI to begin using the Zoho CRM Java SDK.
The codes used in this post are hosted
here for reference. We will focus on two distinct steps as mentioned below, for Zylker integration with Zoho CRM using Java SDK.
1. Authorize with Zoho CRM
2. Fetching data from Zoho CRM
1. Authorize with Zoho CRM
The aim of this step is to connect with the user's Zoho CRM and store the token details such as refresh token, access token and expiry time in the preferred datastore like MySQL, pgSQL etc. Once the user lands on the redirect URI after the OAuth2.0 authorization, we can extract the email of the logged-in user from zylker.com cookies. We also obtain the grant token and location from the redirect_uri of the authorization request. We pass these three values to the below integrateZohoCRM() function. This function takes care of creating a token for the connected Zoho CRM account and persisting it in the preferred datastore.
public static Boolean integrateZohoCRM(String location, String grant_token, String user_email)
{ Boolean integrationStatus = Boolean.FALSE; try { Environment environment = DataCenter.get(location); OAuthToken userToken = new OAuthToken.Builder() .clientID(OAuthClientDetails.CLIENT_ID) .clientSecret(OAuthClientDetails.CLIENT_SECRET) .grantToken(grant_token) .redirectURL(OAuthClientDetails.REDIRECT_URL) .userSignature(new UserSignature(user_email)) //email of the user who is trying to integrate with Zoho CRM
.build();
new Initializer.Builder().environment(environment).token(userToken).initialize(); integrationStatus = Boolean.TRUE; } catch (SDKException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return integrationStatus; }
|
Refer
here for the exact code section.
OAuthToken.Builder() creates a new instance of the builder for the OAuthToken class. It allows you to conveniently set up the necessary details for creating an OAuth token for authentication purposes. On passing the client ID, client secret, grant token, redirect URL, and user signature to the OAuthToken.Builder() method, we get the userToken object. One more important thing to note is that we have set the user signature as .userSignature(new UserSignature(user_email)) . This means that we are referring to the token uniquely by the email id of the logged-in Zylker user. The same signature should be used for any further operation to be done in Zoho CRM on behalf of this user.
Now that we have the OAuthToken object, we can send it to the Initializer class (as shown below) to create the refresh/access tokens and persist it.
new Initializer.Builder().environment(environment).token(userToken).initialize();
|
As we haven't mentioned anything about where to do the persistence, by default the token details are persisted in a file named 'sdk_tokens.txt' using
File Persistence. The content of the file would look like the following:
"id","user_name","client_id","client_secret","refresh_token","access_token","grant_token","expiry_time","redirect_url","api_domain" //Do not clear this default format, or else you will need to generate a grant token again in order to run the program. "1","patricia@gmail.com","1000.xxxxx","xxxxxx","1000.xxxxxx.xxxx","1000.xxxxxxxxx.xxxxxxx","1000.xxxxxxxxx.xxxxxxx","1697370902510","https://www.zoho.com","https://www.zohoapis.com"
|
Apart from File Persistence, tokens can be persisted using
Database persistence or
Custom persistence.
Note
When Zoho introduces a new DC in future, it will be enough to update the project with the latest version of Zoho CRM Java SDK 5.0 and no further code change will be required.
2. Fetching data from ZohoCRM
Once the integration is done, we can create OAuthToken with the user's email as UserSignature and call Zoho CRM Java SDK function. This will fetch the data specific to the user. The following fetchCRMData() function is a sample to fetch data from Zoho CRM.
public static void fetchCRMData(String email) throws Exception {
OAuthToken userToken1 = new OAuthToken.Builder() .userSignature(new UserSignature(email)) .build(); new Initializer.Builder().token(userToken1).initialize(); RecordOperations ro = new RecordOperations(); ParameterMap paramInstance = new ParameterMap(); List < String > fieldNames = new ArrayList < > (Arrays.asList("Company", "Email"));
paramInstance.add(RecordOperations.GetRecordsParam.FIELDS, String.join(",", fieldNames));
@SuppressWarnings("rawtypes")
APIResponse response = ro.getRecords("Leads", paramInstance, null);
.
.
.
} |
Refer here for the exact code section.
In this example, we use the SDK's RecordOperations() for retrieving records from the Leads module. This is done in the following steps:
- A new instance of RecordOperations is being created and assigned to the variable ro. This object handles operations related to records in Zoho CRM.
- ParameterMap instance is used to specify request parameters for the API calls. We can fetch the Company and the Email fields from the Leads module by passing them as the FIELDS parameter.
- We use the getRecords() method to make the API request via SDK, which fetches the respective CRM data.
We hope you found this post useful and interesting. Stay tuned for more exciting posts.
For more topics on Kaizen, please refer to our
Kaizen collection here.
Recent Topics
Serial Numbers.
I generated serial numbers for items and there is no way to generate more serial numbers that the number of items being "sold" or created. This is annoying as how does one know what serial number they left off with when they go to receive or sell this
Calculate Hours Minutes Sec in Zoho Creator Using Deluge
check_In = "8-Aug-2023 10:00:00".toDateTime().toLong(); checkout = "8-Aug-2023 18:00:00".toDateTime().toLong(); //difference = start.timeBetween(end); check_In = "8-Aug-2023 17:56:50".toDateTime().toLong(); checkout = "8-Aug-2023 18:00:00".toDateTime().toLong();
Build Smarter Apps with AI in Zoho Creator
Build Smarter Apps with AI in Zoho Creator This is truly the era of AI, and businesses that adapt now will lead tomorrow. Zoho is already moving ahead in this direction, continuously evolving its platform with powerful AI capabilities. With Zoho Creator,
Zia Dashboard Insights : turn your dashboard into decisions
When you look at a chart or KPI in a dashboard, you would possibly see something like: Revenue: $2.4M ↓ 18% vs last month. It can be a positive growth or a negative one, or a dip in revenue, a spike in deals, a slowdown in renewals—all you usually see
Tickets without registration
Hi, would it be possible to give customers the opportunity to be able to read their tickets without registration?
Zoho Desk Answer Bot vs. Zia Agents – Knowledge Base & Ticket Access
Hi everyone, I’m currently evaluating AI options in Zoho Desk and ran into some limitations with the Answer Bot: Answer Bot limitations Only uses Knowledge Base articles No access to tickets Limited control over sources: Either one Help Center or all
Como estruturar automações eficientes no Zoho Creator
Como estruturar automações eficientes no Zoho Creator Introdução No contexto de aplicações empresariais, automação não é apenas uma conveniência, é um fator crítico para ganho de produtividade, redução de erros e escalabilidade operacional. O Zoho Creator
Changing the status of a work-order
Is there a way to change the status of a work-order?
Online Payment Fees
We don't take many online credit card payments so the merchant service provider (PayPal) charges us the 2.9% fee for processing the amount. I would like the ability for the fee to be automatically added to the total amount for "ease of payment". We'd
What is a realistic turnaround time for account review for ZeptoMail?
On signing up it said 2-3 business days. I am on business-day 6 and have had zero contact of any kind. No follow-up questions, no approval or decline. Attempts to "leave a message" or use the "Contact Us" form have just vanished without a trace. It still
Zia Agents in Zoho CRM: a better way to set up digital employees
Hello everyone, If you've been using Zia Agents in Zoho CRM, so far using Connections was the only deployment method you're familiar with. You create an agent in Zia Agents (define its objective, write instructions, use tools, add knowledge base) and
Bank Feeds
Since Friday my bank feeds wont work. I have refreshed feeds, deactivate and reactivate and nothing is working
Logged out
Hi, just been working on a sheet when a pop up box appeared telling me I'm going to be logged out in x number of seconds and if I reload I may lose any edits, or words to that effect. It did indeed log me out and I did indeed lose my last edits. Any idea
Zoho API
I have little experience with API. I'm trying to get a Custom API working with Zoho creator. I have created a Custom API and created an Endpoint URL, but i get a 9400 error code "The provided HTTP method is not valid for this custom API". Based off the
#157127950
Where did my initial question go?
Zoho writer unable to merge documents to PDF with basic fonts in Hebrew or fonts from my computer
I created several forms that will be merged into PDF files through Zoho Writer and I am unable to receive the PDF in the basic fonts of the Hebrew language or in the fonts I have on my computer. The writer exports to PDF an exchange font that looks very
How I Implemented Subscription-Based Access Control and Expiry Handling in Zoho Creator
I recently worked on a use case where users come into the application to request a service, but they should only be able to continue the process after completing a subscription. The challenge was not just controlling access, but also making sure that
Zoho Forms API
Is there any way to get all form entry list using API? Looking forward to hear from you
Zoho Projects : Task should auto-update to 'In Progress' if timer started
Namaskaram. Right now, if a Task's timer is started, the Task stays in 'Not Started' status. One has to manually update it to 'In Progress'. From a #uxdesign standpoint, it is an unnecessarily two step process to start working on a task. It would be better that, if I start the timer on a task, it should automatically change to 'In Progress' status. Crafted with ❤️ Zoho Gurus | Zoho One Practice Team @ CubeYogi Zoho Authorised Partner | 7+ Yrs | 200+ Projects | 100+ Customers
Laatste facturen en betalingen niet zichtbaar in mijn account
Wij gebruiken ZOHO invoice al jaren, maar sinds afgelopen week is mijn laatst verzonden factuur niet zichtbaar in mijn account, en tevens de laatst betaalde facturen zie ik niet. Hoe kan dit? Ik heb de pagina al diverse keren gerefreshed.
Undelivered Mail uncategorized-bounce errors when sending invoices
Recently we have been getting Undelivered Mail bounce notification when sending invoices. Reason: uncategorized-bounce Some go through no problem some bounce back. We recently sent 10 invoices, 6 received bounce notifications. After reaching out to the
Can I import MSG files into Microsoft 365 without Outlook?
Yes, absolutely. You do not need Outlook installed to import MSG files into Microsoft 365. Aryson MSG file Converter is a dedicated tool that eliminates the Outlook dependency entirely, making the migration process simple and efficient for all users.
Feature Request - A Way To Search Item Groups
Hi Inventory Team, I can't find any way to filter or search by fields of Item Groups. It would be great to see that functionality added. I have a use case where a single product might come from 5 or more suppliers and each supplier's item is an Item in
Zoho Books/Inventory - Update Marketplace Sales Order via API
Hi everyone, Does anyone know if there is a way to update Sales Orders created from a marketplace intigration (Shopify in this case) via API? I'm trying to cover a scenario where an order is changed on the Shopify end and the changes must be reflected
Ticket id issues
When I reply a ticket from desktop, it doesn't have ticket id in the subject and it's great. When I reply a ticket from Zoho desk mobile, Zoho adds ticket id in the subject and I don't want that. Please help in this matter.
Advanced email configuration - agent's name vs. department name
We currently have all four Advanced Configuration options turned ON at the Global-level (Channels > Email > Advanced Configuration) - including the "Show Agent name in Ticket replies and outgoing emails" option. We also had that same option turned ON
Add Bounced as an Email Action / Notification for Bounced Emails
This is one of the hard requirements for the clients we're servicing. They want to get an internal email notification whenever the email they sent to their contacts have bounced, so that they can look into it and update the email address. Currently, the
not able to convert pdf to jpg and other forms and vice versa.
i want to change my pdf to jpg, word, etc and some times jpg to pdf. i don't know how to do in this.
What’s New in Zoho Analytics - March 2026
Hello Users! In this month's update, we bring improvements across integrations, security, reporting, and analytics capabilities to help you work with your data more efficiently and with greater control. Explore what’s new and see how these enhancements
Zoho People > Performance Management > Appraisal cycle
Hello All I am using this 2 users to test out how it work on Performance Management User 1 - Reportee User 2 - Reporting Manager : Li Ting Haley User 1 : Self Appraisal Error How do i fix this error?
SalesIQ Tip for Admins: Guide Operators in Real-time Without Interrupting the Chat
Consider this. You're a supervisor and you're looking through the active conversations. An associate is mid-chat with a high-value prospect. The prospect asks something unexpected, maybe about a tailor-made subscription plan or a bulk discount that’s
Early Access: Check Printing in Zoho Books
Hello Everyone, Are you constantly writing checks to pay your vendors? We've got a great news to share with you! You can now pay your vendors by writing and printing a check directly from Zoho Books. The feature is ready and we'll be rolling it out to our customers in phases. It is available in the US Edition of Zoho Books and also in the Global edition, where the country is selected as USA and the currency is USD. Here’s a summary of what’s possible: 1. Write and print a check. 2. Make
Connecting Zoho Inventory to ShipStation
we are looking for someone to help connect via API shipStation with Zoho inventory. Any ideas? Thanks. Uri
Syncing zoho books into zoho crm
I was wondering how I can use zoho books in crm as I have been using them separately and would like to sync the two. Is this possible and if so, how? Thanks
Zoho no support response.
Problem is Zoho support seems to be just a concept. Just completing my trial, am ready to purchae 3 user subscriptions pending answer to a question, submitted two suport request during my trial that weren't responded to. Gave up trying the 888 line. Hard to imagine my production data in hosting environment with no support response.
Updating transaction number series for fiscal year 2026-2027 in Zoho POS
A fiscal year or financial year is a 12-month period that businesses follow to manage and track their financial activities such as expenses, revenue, and taxes. This doesn't need to match the calendar year (JAN-DEC) and varies based on region, and tax
Lack of Looping and Carry-Forward Functionality in Zoho Survey
Zoho Survey currently does not support looping or carry-forward functionality, meaning it is not possible to dynamically generate follow-up questions based on each option selected in a previous question or to pipe selected responses (such as {Looping
Forecast in Zoho CRM Just Got Smarter with an upgraded Zia Intelligence
Hello Everyone, We are here with an interesting enhancement to Forecasts in Zoho CRM — Enhanced Zia Insights for your sales Forecast. Imagine a regional sales manager reviewing their team’s performance using forecasts in Zoho CRM. Instead of switching
Update TDS and TCS rates for Income Tax Act, 2025 (effective April 1, 2026)
Hello everyone, The Income-tax Rules, 2026 (G.S.R. 198(E), dated March 20, 2026) have been notified, marking a significant structural shift in India’s direct tax framework. From April 1, 2026, the Income Tax Act, 2025 replaces the Income Tax Act, 1961.
Service line items
Hello Latha, Could you please let me know the maximum number of service line items that can be added to a single work order? Thanks, Chethiya.
Next Page