Title: Integrating Zoho Books with applications using connections | Community | Zoho Finance

Title: Integrating Zoho Books with applications using connections | Community | Zoho Finance

In our last post, we looked at an overview of the key features available for creating a Zoho Books extension, including connections. In this post, we'll go over connections in depth, including their types and applications.

What are connections?

"Connections" is a component in the developer console that allows you to establish secure connections between applications. In general, a secure connection is essential for apps to work seamlessly for data transmission and synchronization. The connections functionality in the Zoho Books extension developer portal is ideal for securely connecting Zoho Books to other Zoho products or third-party applications.

Types of connections

The Zoho Books extension developer portal allows you to use both predefined and custom connections.

Predefined connections:
These are ready-to-use connections that are preconfigured for various applications to connect with Zoho Books. You can simply search for the application you want to connect to from the default list, choose it, enter some basic information (scope), and connect to Zoho Books.

Custom connections:
These are connections for apps not included in the default list. You can create a custom connection by manually setting up or configuring information about the application you want to connect to Zoho Books with—such as the authentication type and other corresponding details—and then proceeding with the connection.

Notes
Note: You can also create these custom connections for applications in the default list if you want to customize the connection with specific details.

Now, let's explore the steps to create these connections with an example for each.

Steps to create a predefined connection
  • Go to Sigma and access your workspace.
  • Enter the developer portal of the Zoho Books extension you're creating a connection for.
  • Navigate to the Build section and click Connections to view the connection details, types (predefined and custom), and support to create a new connection.

  • Click the New Connection button to create a new connection.
Notes
Note: Alternatively, you can use the View All option under a connection type to see all the services under that particular connection type and begin building connections.

  • You'll be redirected to the connections page of your extension's developer space, where you can select default or custom services to create connections.


In this post, we'll walk you through creating a predefined connection using the default services available.

For our example, let's create a connection for Wrike (a project management service) available in the default services list and integrate it with Zoho Books.
  • Choose Wrike from the default services list.

  • Click the Create Connection button.

  • Provide the connection details.
➤ Enter the connection name.
➤ Toggle and choose whether you want every user to enter their credentials during connection authorization.
➤ Choose the scopes necessary for your purposes for the connection.

  • Click Create And Connect. Proceed with the flow to accept the scopes and authorize the connection.
  • The connection is now authorized, and you'll be directed to the connection details page. This page will also contain sample code in both deluge and JSON formats that can be used to utilize this connection as part of your extension components. Depending on which component you want to invoke the connection in, you can use the appropriate sample code format.
Notes
Note: Giving the connection name in the script is critical to be able to use the connection in the extension.


  • Close the connection's detail page, and you'll be taken back to your extension's developer portal.
  • If needed, you can create multiple connections for your extension. The connections you've created will be visible in the My Connections section of the Connections page.

  • You can click on a connection to view its details or choose to revoke it, if necessary. You can reconnect a revoked connection whenever you need it.
Let's look at a simple scenario for the predefined connection we created. Assume that each time a project is created in Zoho Books, a new project is created in Wrike to handle project management in detail. In addition, if any tasks are available as part of that Zoho Books project, they'll be instantly created in Wrike alongside the project. This can be accomplished easily in an extension using workflows, custom functions, and connections.

Let's check out the steps to make this happen.
  • Create a custom function for the Projects module by selecting Automate, then Workflow Actions, then Custom Functions, then New Custom Function. Include the logic to fetch the details and its tasks from a Zoho Books project and create a matching project in Wrike.
createwrikeproject deluge function - Please find the code snippet as an attachment in the post
  • In the code above, the Zoho Books project's details, such as project name and task details, are fetched from the Project Map parameter in the custom function.
  • The retrieved project details are constructed as a Map and then passed to the invokeURL deluge task to invoke the Wrike API and create a project. Additionally, a check is made to see if the Zoho Books project has tasks associated with it. If it does, then those tasks are added to the project created in Wrike using the Wrike API to create tasks.
  • The Invoke URL task requires some basic parameters to invoke the API and provide a response.
➤ url: This is the URL of the application's API that will be invoked. In our case, it's the Wrike API URL for Create Project and Create Task.
➤ type: This is the method of the HTTP request required for the API. Since we're creating projects and tasks in Wrike, the type is POST in our example.
➤ parameters: These are data that need to be constructed and passed as the body for the API.
➤ connection: The name of the Wrike connection we created has to be supplied as the value for the connection parameter. This ensures that data transfer between Zoho Books and Wrike is authorized and secure.
  • Next, create a workflow rule for the Projects module by selecting Automate, then Workflow Rules, then New Workflow Rule.
  • Set the Action Type as "When project is created."

  • Now, associate the custom function (createwrikeproject) as a workflow action to this workflow rule. Save the workflow rule.


We've now completed our extension setup for our use case.

After testing and publishing our extension, whenever a new project is created in Zoho Books, a matching project is created in Wrike as well, along with any tasks.


This example demonstrated a seamless transfer of data from Zoho Books to Wrike with connections. This use case can be taken a step further, making sure the project and its tasks maintained in Wrike are also synchronized in Zoho Books.

In this post, we've seen how to set up a predefined connection and use it in a Zoho Books extension. In the next post, we'll look at custom connections and how to create them.

SEE ALSO