Zoho Extension Toolkit (ZET) is used to create extensions offline in your machine. Once the extensions are created, you'll need to upload the extension as a zip file in Sigma and publish the extension. This can be tedious when you make changes to the extensions quite often. With ZET online support, you can now easily upload the changes made to an extension in your machine to cloud Sigma.
ZET online support helps sync your ZET offline extensions with Sigma cloud directly. Whenever you modify an extension, the changes made to the extension can be pushed or pulled to or from cloud just by using ZET commands in the developer's machine.
Currently ZET online support is only available for Zoho Mail service.
Benefits of ZET online support
- Push your extension changes from your machine to cloud
- Pull your extension from cloud to your machine
- Minimize data loss in case of machine corruption
- Run your extension in real time using the Cloud run option
Step 1: Install Node.js and ZET CLI
To build your extension online, you need to install Node.js and ZET CLI to access the CLI commands.
- Install node.js.
- Execute the following command: $ node -v to verify the node.js version (7.1.0 and above are supported).
The Zoho Extension Toolkit is a Command Line Interface tool used to build, test, and pack your extension. Execute the command that is mapped to your OS to install the tool.
For Mac/Unix system
sudo: npm install -g zoho-extension-toolkit
For Microsoft Windows
system: npm install -g zoho-extension-toolkit
-g denotes global installation. When ZET is installed globally, you will be able to execute commands from anywhere on the terminal. Otherwise, you will have to navigate to the path where ZET is installed, then execute commands.
Step 2: Build an extension
You can build extensions using your preferred code editor. To start with, log in to Sigma from your machine using the following command:
ZET login
Case 1: If you have already logged in to your account, you'll be automatically redirected to the Zoho accounts login page on your browser window. If aren't automatically redirected, please copy and paste the URL displayed after using the ZET login command.
Case 2: If you haven't logged in to your account, sign in to your account on the
Zoho Accounts login page. You will be redirected to a page where ZET CLI requests permission to access the data. Click
Accept to provide these permissions to ZET CLI.
Enter the below command to choose the service in which you would like to create an extension:
ZET init
Below steps will be executed if you choose Zoho Mail service, as it supports ZET online:
A default workspace needs to be selected for the extension.
- When no Workspace is created yet, you'll be prompted to create a Workspace in Sigma ( sigma.zoho.com).
- When you only have one Workspace, the same will be set as the default Workspace for the extension.
- When you are a part of multiple Workspaces, you'll be prompted to choose between the Workspaces. The selected Workspace will be set as the default Workspace.
Once done, you will be prompted to enter the Extension Name and Description (minimum 25 characters). Upon doing so, your extension will be created in Sigma (
sigma.zoho.com).
Now, a project directory with necessary folders, dependency node packages, and files will be created. app is the folder where you create the source and resource files for your extension.
You can verify if your extension is created in the selected Workspace in
Sigma.
plugin-manifest.json file
A default plugin-manifest file is generated as a part of the project template directory. This is a crucial file, where the JSON parameters of your extension have to be configured before hosting. This file contains meta information about the extension such as widget details, locations, and connectors.
Learn more on how to configure the parameters in this file.
JS SDK
Develop your extension using client-side technologies like HTML, JS, and CSS. Learn more about JS SDK methods supported by different services.
Step 3: Validate the extension
Once the extension is built, we can validate it. To validate the extension, execute the following command in the terminal.
ZET validate
If there are any errors while validating the extension, the respective error will be displayed in the terminal. Validate the extension again after resolving the errors.
Step 4: Run an extension
After validation, you can run and test the extension in Sigma cloud using the below command:
ZET cloud_run
On providing the run command, you'll be prompted to choose a Workspace in which the extension is to be run. If you only have one Workspace, then the same will be automatically selected as default Workspace.
To stop running the extension, use the below command:
ZET cloud_ stop
You'll be notified once the extension has stopped.
In case you would like to run the extension only on your machine, you can use the below command:
ZET run
This command starts a local server and runs the extension locally.
Your extension will run on the port 5000. Ensure it is available before you execute this command.
Enable developer mode while testing your extension.
Step 5: Pack the extension
The same steps that are carried out while validating the extension will be applicable on packing the extension too. The extension will be zipped and will be available under the dist folder in project root directory.
To pack the extension, use the following command:
ZET pack
Step 6: Push the extension from your machine to Sigma cloud
You can push the changes made in your machine to cloud using the following command:
ZET push
The command will compare the machine version and the cloud version of your file and display all the changes made to it.
If the extension is already published in Sigma, a new version of the extension will be created. If the latest version is in draft, the changes will be overwritten in draft.
Your extension will be saved as draft. Publish your extension in Sigma when it is ready to go live.
Other commands
Fetch extension from Sigma cloud to your machine
When you want an extension added in Sigma to be available in your machine, you can use the following command:
ZET pull
Case 1: Zet Pull command used in Sigma extension directory
When you use the ZET pull command under Sigma extension directory, the changes in your machine will be permanently lost and the most recent version of the extension available on Sigma cloud is downloaded to your machine.
Case 2: Zet Pull command used in other directories
If the extension is only present on Sigma cloud and not on your machine, you will be prompted to select the workspace and service where the extension is present when you execute the ZET pull command. Select the extension that must be in the machine then.
The extension will now be created in your machine under project name directory.
Switch between Workspaces
Use the below command to switch between the Workspaces:
ZET list_workspace
On using this command, all your Workspaces will be listed and you can select the Workspace in which you would like to work.
If you only have one Workspace, then the same will be selected as the default Workspace.
If you do not have any Workspace, you will be prompted to create a Workspace in Sigma.
Know your login details
Get your login and Workspace details using the following command:
ZET whoami
ZET update notification
When an update is available for ZET, a notification will be displayed in the machine. You can either update it immediately or do it later.
ZET migration
When the extension is available only in Sigma, executing ZET pull command will get the extension folder along with the extension information to your machine.
If the extension is only present on Sigma cloud and not on your machine, you will be prompted to select the workspace and service where the extension is present when you execute the ZET pull command. Select the extension that must be in the machine then.
When the old extension is present only in your machine and not in Sigma, follow the below steps:
- Zip the extension using the ZET pack command.
- Copy the packed extension available under dist folder.
- Upload the extension in Sigma.
- Use ZET pull command to fetch the details back to your machine.
- Your extension is now migrated to ZET online.
ZET logout
You can log out of your extension using ZET logout command. The Command Line Interface will display a confirmation message that you are logged out.