Zoho CRM – Deluge and REST, part 1

Recently I needed to solve what seemed like a tiny problem, and after I was done experimenting and over complicating it – it was small.  (More on the over complication in part 2).

We needed an outside application to get data from our CRM, a simple lookup/return as quick as possible.  That kind of ruled out using Zoho Flow as sort of an API gateway since it’s performance can be slow.  While Flow could have accepted the call as a webhook trigger, it can’t cleanly reply back to the caller that initiated this.  Time to dump that idea.

Enter Deluge!  Since we aren’t using things like Zoho Catalyst and wanted to keep this simple, making a CRM function and enabling REST was going to be the simplest path.

The app we wanted to call the function from is able to securely store an API key, so in the end the solution was pretty easy.

– Build a CRM function and enable REST

– Generate an API key on the function

– Pass my args to the function in the body of the API call as JSON

– Once the function fires, drill into the request to get the value I needed

The bit of calling this function from the other app or Postman was pretty straightforward.  After looking at some of the limitations Deluge has, it ended up being a simple solution.

Ultimately, the function just has to convert the request to a map, then get to the body, and then the field you need.  

string standalone.restAPI_test(String apiRequest)
{
	request_map = apiRequest.toMap();
	request_body = request_map.get("body").toMap();
	testVal = request_body.get("test_data");
	info "Received arguments: " + request_map.toString();
	return testVal;
}

We can then pass JSON like this in the API call:

{
  "test_data": "ABC123"
}

Once I did this, my Postman test worked fine, and the app I called the function from was good to go.

So a little thing, but given all the articles, posts and docs out there – it’s a bit opaque seeing what Deluge wants sometimes.

A shout out to Shane Fausett and his short video on this.  Ran across this as part of reading docs, forums, etc to learn how Deluge wants to work with the Request in a CRM function.  The test code above is from his example and solved my issue – letting me get onto the rest of the function work.

Scroll to Top