Zoho Recruit API and Google Sheets OAuth2 process

Zoho Recruit API and Google Sheets OAuth2 process

Hello fellow ZR API user,

I need to use Zoho Recruit API together with Google (because our team is operating within Google Sheets already).

I use this library to support OAuth2 for Zoho in Google Sheets: 
(looks amazing and seems to work well for others)

Interesting:
* Works really well for the Zoho CRM API for me
* Does not work for Zoho Recruit API for me (always get a 400 error)

My questions:
* Do I use wrong scope or code? Does anything stand out?
* Are there other / better libraries / code I can use?

Thank you!

Before this suggestion comes up:
I contacted Zoho Recruit Support 2 weeks ago with multiple follow-ups without any answer.
This is why I am turning to the community (I would have hoped for Zoho to help me out here)

----
Google App Script Code

/**
 * This sample demonstrates how to connect to the Zoho CRM API.
 */

var CLIENT_ID = '1000.xxxxxxxxxxxxxxxxxxxx';
var CLIENT_SECRET = 'xxxxxxxxxxxxxx';

function writeToSheet(content) {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  sheet.appendRow([content]); // Write the entire content to the first cell of a new row
}
function saveToDrive(content) {
  var fileName = 'API Error Response ' + new Date().toISOString();
  DriveApp.createFile(fileName, content, MimeType.PLAIN_TEXT);
}

/**
 * Authorizes and makes a request to the Zoho CRM API.
 */
function run() {
  var service = getService_();
  if (service.hasAccess()) {
    // Retrieve the API server from the token.
    var apiServer = service.getToken().api_domain;
    // var url = apiServer + '/crm/v2/org';  // I leave them in here for troubleshooting
    var url = apiServer + '/recruit/v2/org';
    var response = UrlFetchApp.fetch(url, {
      method: 'get',
      headers: {
        'Authorization': 'Bearer ' + service.getAccessToken(),
        'Content-Type': 'application/json'
      },
      muteHttpExceptions: true
    });
    
    // writeToSheet(response.getContentText());
    // saveToDrive(response.getContentText());
    
    // Log the status code and headers to understand the response better
    Logger.log(response.getResponseCode());
    Logger.log(response.getHeaders());

    // Log the raw content of the response
    Logger.log(response.getContentText());
    
    
    // Attempt to parse the response as JSON, with error handling
    var result;
    try {
      result = JSON.parse(response.getContentText());
    } catch (e) {
      Logger.log('Failed to parse response as JSON:');
      Logger.log(response.getContentText());
      return; // Exit the function or handle the error as needed
    }

    

    // Proceed with processing the result if it's successfully parsed
    // Logger.log(JSON.stringify(result, null, 2));

  } else {
    var authorizationUrl = service.getAuthorizationUrl();
    Logger.log('Open the following URL and re-run the script: %s',
        authorizationUrl);
  }
}

/**
 * Reset the authorization state, so that it can be re-tested.
 */
function reset() {
  getService_().reset();
}

/**
 * Configures the service.
 * @param {string} optAccountServer The account server to use when requesting
 *     tokens.
 */
function getService_(optAccountServer) {
  var service = OAuth2.createService('Zoho')
      // Set the authorization base URL.
      .setAuthorizationBaseUrl('https://accounts.zoho.eu/oauth/v2/auth')

      // Set the client ID and secret.
      .setClientId(CLIENT_ID)
      .setClientSecret(CLIENT_SECRET)

      // Set scopes. See
      // I leave the scopes in here for troubleshooting
      //.setScope('ZohoRecruit.modules.READ')
      //.setScope('ZohoRECRUIT.modules.all')
      //.setScope('ZohoRECRUIT.org.all')
      .setScope('ZohoRecruit.org.all')
      //.setScope('ZohoCRM.org.all')    

      // Set the name of the callback function that should be invoked to
      // complete the OAuth flow.
      .setCallbackFunction('authCallback')

      // Set the access type to "offline" to get a refresh token.
      .setParam('access_type', 'offline')
      // Set prompt to "consent" to ensure a refresh token is retrieved.
      .setParam('prompt', 'consent')

      // Set the property store where authorized tokens should be persisted.
      .setPropertyStore(PropertiesService.getUserProperties())
      .setCache(CacheService.getUserCache());

      var token = service.getToken();
      Logger.log(token); // This will show you the structure of the token object


  // Set the token URL using the account server passed in or previously stored.
  var accountServer = optAccountServer ||
      service.getStorage().getValue('account-server');
  if (accountServer) {
    service.setTokenUrl(accountServer + '/oauth/v2/token');
  }
  return service;
}

/**
 * Handles the OAuth callback.
 */
function authCallback(request) {
  var accountServer = request.parameter['accounts-server'];
  var service = getService_(accountServer);
  var authorized = service.handleCallback(request);
  if (authorized) {
    // Save the account server in the service's storage.
    service.getStorage().setValue('account-server', accountServer);
    return HtmlService.createHtmlOutput('Success!');
  } else {
    return HtmlService.createHtmlOutput('Denied.');
  }
}

/**
 * Logs the redict URI to register.
 */
function logRedirectUri() {
  Logger.log(OAuth2.getRedirectUri());
}

----

Error log from Google App Script log:


2:03:46 PM Notice Execution started
2:03:46 PM Info {expiresAt=1.708956218E9, expires_in=3600.0, scope=ZohoRecruit.org.all, access_token=1000.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, api_domain=https://www.zohoapis.eu, token_type=Bearer, refresh_token=1000.xxxxxxxxxxxxxxxxxxxxxx}
2:03:47 PM Info 400.0
2:03:47 PM Info {X-Content-Type-Options=nosniff, Date=Mon, 26 Feb 2024 13:03:46 GMT, Vary=accept-encoding, Server=ZGS, Content-Language=en-US, Content-Type=text/html;charset=UTF-8, Referrer-Policy=strict-origin, Content-Encoding=gzip, Connection=keep-alive, Transfer-Encoding=chunked, X-XSS-Protection=1, Set-Cookie=JSESSIONID=9CA8ABA2234F11A3F94B5AA4D7AC8CC0; Path=/; Secure; HttpOnly, Content-Security-Policy-Report-Only=script-src  'self' 'unsafe-eval' 'unsafe-inline' blob: https://*.zoho.com https://*.zoho.in https://*.zoho.com.au https://*.zoho.com.cn https://*.zoho.eu https://*.zohocdn.com https://*.stratuscdn.com  https://*.zohocdn.com.cn  https://*.zappsusercontent.com https://*.zappsusercontent.sa https://*.zappsusercontent.ca https://*.zappsusercontent.jp https://*.zappsusercontent.eu https://*.zappsusercontent.in https://*.zappsusercontent.com.au https://*.zappsusercontent.com.cn https://*.localzappscontents.com https://*.zohostatic.eu https://*.zohostatic.jp  https://js.skydeskstatic.jp https://*.zoho.eu https://media.twiliocdn.com/sdk/js/client/releases/1.7.7/twilio.min.js https://media.twiliocdn.com/sdk/js/client/v1.7/twilio.min.js https://cdn.pagesense.io https://s.ytimg.com/yts/jsbin/ https://ssl.google-analytics.com/ga.js https://www.youtube.com/iframe_api https://dyjgaef5vuq51.cloudfront.net https://dtzpfzv31buvf.cloudfront.net https://d22czkv2r5ogmg.cloudfront.net https://d12h6dzwzn4m10.cloudfront.net https://d17nz991552y2g.cloudfront.net  chrome-extension://*  https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/  https://cdn.pagesense.io https://zohotagmanager.cdn.pagesense.io https://www.zohowebstatic.com/ https://scripts.zohospotlight.com https://widgets.zohosalesiq.com https://js.stripe.com https://connect.facebook.net; report-uri https://logsapi.zoho.com/csplog?service=crm, X-Frame-Options=SAMEORIGIN}
2:03:47 PM Info Logging output too large. Truncating output. <html><head><title>Zoho CRM - Error</title><link rel="SHORTCUT ICON" href="https&#x3a;&#x2f;&#x2f;static.zohocdn.com&#x2f;crm&#x2f;images&#x2f;favicon_cbfca4856ba4bfb37be615b152f95251_.ico" /><link href="https://static.zohocdn.com/crm/CRMClient/css/default_theme_b61f5f53b945c996ec11acc6fc077962_.css" rel="stylesheet" type="text/css"/><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="Pragma" content="no-cache"><style>
/******new error page style******/

I always get a generic Zoho error landing page which does not explain the error.


      Zoho Campaigns Resources


        • Desk Community Learning Series


        • Digest


        • Functions


        • Meetups


        • Kbase


        • Resources


        • Glossary


        • Desk Marketplace


        • MVP Corner


        • Word of the Day


        • Ask the Experts


          • Topic Participants

          • Jens

          Zoho CRM Plus Resources

            Zoho Books Resources


              Zoho Subscriptions Resources

                Zoho Projects Resources


                  Zoho Sprints Resources


                    Zoho Orchestly Resources


                      Zoho Creator Resources


                        Zoho WorkDrive 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




                            Zoho Writer Writer

                            Get Started. Write Away!

                            Writer is a powerful online word processor, designed for collaborative work.

                              Zoho CRM コンテンツ








                                ご検討中の方

                                  • Recent Topics

                                  • Adding Folders in Android App

                                    Is it possible to create a new email folder within the Zoho Mail Android app?  Or can this only be done from the desktop version of Zoho Mail? Cheers!
                                  • Schedule Exports for Regular Project Updates

                                    Tracking project data often means exporting data at regular intervals. Instead of manually exporting data every time, users can schedule exports for Phases, Tasks, and Tasks in Zoho Projects. These exports can be set to run once, daily, weekly, or monthly
                                  • Question about custom fields using Pivot Tables.

                                    I have created a pivot table showing annual revenue of a client and how much payment that client is paying my company. Is there a way using pivot table to add an additional field that subtracts those to fields / shows me a percentage of that difference?
                                  • Request for Light/Dark Mode

                                    Would love the ability to switch between Light and Dark mode similar to Zoho CRM. https://help.zoho.com/portal/en/community/topic/introducing-dark-mode-light-mode-a-new-look-for-your-crm
                                  • Signature field is showing black

                                    Hello, When customer signed the service form, it is showing as below picture Phone model: iPhone 16 Pro We tried delete and install application, but it not solved. This has on phone of a few person. There is any advice to solve this?
                                  • Journey Email - Ignored Contacts

                                    I have a journey setup which simply sends a string of emails over time. For some reason I am getting large amounts of the contacts who enter the first email being ignored and I can't find anywhere in reports or audit logs why these contacts are not
                                  • Involved account types are not applicable when create journals

                                    { "journal_date": "2016-01-31", "reference_number": "20160131", "notes": "SimplePay Payroll", "line_items": [{ "account_id": "538624000000035003", "description": "Net Pay", "amount": 26690.09, "debit_or_credit": "credit" }, { "account_id": "538624000000000403", "description": "Gross", "amount": 32000, "debit_or_credit": "debit" }, { "account_id": "538624000000000427", "description": "CPP", "amount": 1295.64, "debit_or_credit": "debit" }, { "account_id": "538624000000000376", "description":
                                  • Zoho Books - Include Payment Terms as a Custom View filter

                                    It would be great if you could created a custom view based on Payment Terms. This would be really handy for seeing a list of customers who have credit terms. A workaround is not required. I could do something with a creditor checkbox, but it would be
                                  • How to update changed purchase account of item in invoice

                                    I have selected the wrong purchase account for various articles and created invoices. I had to adjust the purchase account in the article afterwards, but the old purchase account is still posted in the transaction-journal of the invoice. To adjust the
                                  • Help - Zoho CRM notification on mobile (IOS/Android)

                                    Hello Community! Can I get the IOS/Andoid CRM app to notify me of events, calls, etc. due as I can with MANY other apps?   I am running the free Zoho I would like this to be native to the Zoho CRM app. I do not want to write a sep. mobile app
                                  • Zoho Books Idea - Include another field in Bank Details for Address

                                    Hi Books team, Currently use the Description field in the Bank Details to store the bank's address. This works fine but it would be great if you could add another field for Bank Address, so that other notes about the bank account could be stored in the
                                  • a question about the COQL API v8

                                    When I specify eight or more values in a WHERE IN clause and execute it, an error occurs. Is there a limit to the number of values that can be specified in a WHERE IN clause? ↓Error select * FROM Vendors WHERE (id in (1, 2, 3, 4, 5, 6, 7, 8, 9)) ↓Success
                                  • Zoho Books Idea - Bank Details Button on Banking

                                    Hi Books team, Sometimes I'm asked to share bank details with a customer or a colleague. So I go to the Banking Module, find the correct bank account, click Setting > Edit, then copy and paste the bank details. Wouldn't it be great if there was a button
                                  • JS SDK 8.0 – TypeError: Cannot read properties of undefined (reading 'getCacheStore') with sample code

                                    Hello Zoho Support Team, I’m integrating the Zoho CRM JavaScript SDK v8.0 and I’m getting the error below when running your official sample. I tested directly from: https://github.com/zoho/zohocrm-javascript-sdk-8.0/blob/main/samples/create_records_sample/create_records.js
                                  • Function #55: Convert multiple quotes to single SO using Custom Button

                                    Hello everyone, and welcome back to our series! In Zoho Books, after a quote is accepted by your customer, it can be converted into a sales order or an invoice. Often, a customer might have multiple quotes, and for easier billing or upon the customer's
                                  • Zoho One - Syncing Merchants and Vendors Between Zoho Expense and Zoho Books

                                    Hi, I'm exploring the features of Zoho One under the trial subscription and have encountered an issue with syncing Merchant information between Zoho Expense and Zoho Books. While utilizing Zoho Expense to capture receipts, I noticed that when I submit
                                  • Rich Text For Notes in Zoho CRM

                                    Hello everyone, As you know, notes are essential for recording information and ensuring smooth communication across your records. With our latest update, you can now use Rich Text formatting to organize and structure your notes more efficiently. By using
                                  • Time based workflow without edit/action

                                    Hello I need help solving this problem if possible. We have Deals come into the CRM via Live Transfer which have the field properties: Stage = New Channel = Inbound Some of them don't get answered so we want these to automatically go into our Outbound
                                  • What's New - August 2025 | Zoho Backstage

                                    Every month, Zoho Backstage grows with you. These updates aren't just features and fixes, they're about making your workday smoother, your events more impactful, and your attendees happier. We’ve listened, learned, and shaped this release to keep things
                                  • prevent selling expired items

                                    Hello. I need to make a constraint on expired batch items not to be sold. Is it possible in Zoho Inventory? if so, then how? Thanks for further help.
                                  • Product details removed during update from other system

                                    We maintain our product details in an other system. These details are synchronized with Zoho at the end of each day, through an API. This has worked perfectly sofar. But last Monday, all product codes and some other product data have been wiped during
                                  • Client Customer

                                    I purchased a customer user license, but we cannot see the project I added in the customer account. I would like to ask for support on what we should do.
                                  • Add Ability to Use Zoho Finance Tags

                                    For Zoho Finance (Books and Inventory), the current actions do not allow us to affect the tags associated with the entities in question (customers, vendors, items, etc.). Please consider adding this functionality into the actions.
                                  • Embeded Signing doesn't work on Safari Browser

                                    We have implemented Zoho Sign in our website by using embeded signing, It works perfectly on Chrome. But it fails on Safari, We get stuck on Zoho Sign Page during redirection from Zoho Sign to our website after signing the document, Please let us know
                                  • Dataprep Webhook Limits and Cannot update column with Dataprep

                                    I have two problems : 1 - I am using Airflow to trigger my pipeline, and when I tested it, it worked fine a couple of times. However, after that, I received an error: {"code":429,"message":"Request rate limited"}. I didn’t send too many requests — maybe
                                  • Power of Automation :: Automatic removal of project users once the project status is changed.

                                    A custom function is a software code that can be used to automate a process and this allows you to automate a notification, call a webhook, or perform logic immediately after a workflow rule is triggered. This feature helps to automate complex tasks and
                                  • New in Zoho Forms: Google reCAPTCHA v3 for smarter spam protection

                                    Hello form builders, Spam submissions are one of the biggest challenges when you share your forms online. They not only clutter your data but can also waste valuable time. To help you combat this without making life harder for genuine respondents, we’re
                                  • Project Management Bulletin: August, 2025

                                    We’ve touched a grand 19 years since we started pioneering project management solutions with Zoho Projects. What started as a simple one-page interface is now a suite of products with Zoho BugTracker, Zoho Sprints, and our new debut Zoho Projects Plus,
                                  • Zoho Sign and Zoho Workdrive Integration

                                    Hello, there. I want to know if it's possible to save a signed document from Zoho Sign in an specific folder for each signer in Zoho Workdrive.  For example: If John Doe signs the document in Zoho Sign I want to save it automatically in a folder named
                                  • Office 365 and CRM mail integration: permission required

                                    Has anyone run into this weird problem? My email server is Office 365. When I try to configure Zoho CRM to use this server, a Microsoft popup window opens requesting user and password. After entering that, I get a message in the Microsoft window saying
                                  • Empowered Custom Views: Cross-Module Criteria Now Supported in Zoho CRM

                                    Hello everyone, We’re excited to introduce cross-module criteria support in custom views! Custom views provide personalized perspectives on your data and that you can save for future use. You can share these views with all users or specific individuals
                                  • How do you list multiple contacts for a lead?

                                    My sales team wants to be able to add additional contacts for leads, how do we do that? Is there a different way we should be using the lead / contact functionality? Moderation update (9th September 2025): Our developers have built an extension to achieve
                                  • Modifying Three Dot Menu Options

                                    Is there a way to modify the three dot menu options that display in a Report header? They currently display: Show As (List, Calendar, Timeline), Print, Import, Export. I'd like to remove the Show As and Print options, since they aren't applicable for
                                  • Field Not Updating in FSM Script - Service and Parts module.

                                    Dear Team, I am reaching out regarding a script I have implemented in Zoho FSM to automate the calculation of the End of Service date based on the End of Sale date in the Service and Parts module. Overview of the script: Fetches the End_of_Sale__C and
                                  • Zadarma + Zoho CRM Integration – Missed Calls Saved as Contacts Instead of Leads

                                    Hello everyone, I’m looking for input from anyone with experience using the Zadarma + Zoho CRM integration. Currently, I’m seeing that missed calls are automatically being created as Contacts instead of Leads. From a CRM perspective, this doesn’t make
                                  • Zoho Books | Product updates | September 2025

                                    Hello users, We’ve rolled out new features and enhancements in Zoho Books. From PayNow payment method to applying journal credits to invoices and bills in other locations, explore the updates designed to enhance your bookkeeping experience. Integrate
                                  • How to update Multiple Users field in Quote Module from Deal Module

                                    Scenario : Deal Module having Multiple User Field (Presales Engineer) which having more than 1 User and through Deluge Script I need to get that Users Details and need to put into Multiple User Field (Presales Engineer) of Quote Module. Note: Both Module
                                  • Auto-sync field of lookup value

                                    This feature has been requested many times in the discussion Field of Lookup Announcement and this post aims to track it separately. At the moment the value of a 'field of lookup' is a snapshot but once the parent lookup field is updated the values diverge.
                                  • Clone a Module??

                                    I am giong to repurpose the Vendors module but would like to have a separate but very similar module for another group of contacts called Buyers. I have already repurposed Contacts to Sellers. Is it possible to clone (make a duplicate) module of Vendors
                                  • Advance PDF creation from CRM data

                                    I'm trying to create a PDF export of data in the CRM. My problem is I want a pretty complicated format for the data. I'm trying to export multiple modules worth of data, with nested one-to-many relationships between the modules. Along with that, I want
                                  • Next Page