Create Internal Widget or Web tab Packages Using Zet-CLI Tool - Zoho People

Create Internal Widget or Web tab Packages Using Zet-CLI Tool - Zoho People

The Zoho Extension Toolkit (ZET) is a command-line interface designed to assist developers in creating application packages for Widgets or Web tab for integration with Zoho People.

Prerequisites 

  • Use the following command to verify the installation:

Quote
node -v
npm -v

Install CLI

  1. Run the following command to install the zapps cli node package
Quote
npm install -g zoho-extension-toolkit

      2. Run the following command to ensure that the installation is successful:
Quote
zet
Help information about 'zet' command will be shown. 

Create a project

      1. Run the following command to specify your project directory:
Quote
cd {directory} 
           Eg: cd desktop

      2. Run the following command to create a new project:
Quote
zet init 
           The list of Zoho Services for which the project template can be created will appear. 

       3. Select Zoho People from the list, and provide the Project Name.    
           A sample project with the basic necessary files and folder structure will appear on the specified directory.



Info
A default plugin-manifest file is generated as part of the project template directory. This file is crucial, as it's where the JSON parameters of your extension must be configured before hosting. It contains metadata about the extension, such as widget or web tab details, locations, and connectors. For more information about plugin-manifest file, Click here.

Develop a project

  1. Navigate to the project folder you have created. You can find the HTML file in the app folder, named "widget.html" by default.
  2. The widget.html file contains the structure, design and components of the widget or web tab. You can create your widget or web tab from the HTML file.
  3. You can enhance the widget or web tab by adding additional designs and functionality through the creation of necessary java script files and stylesheets. (optional)
    Idea
    You can combine multiple HTML files into a single Widget or Web Tab package and use them in supported interfaces of Zoho People. To make this work, you need to correctly set the location identifiers in the plugin-manifest.json file.
  4.  To use the Zoho People APIs in the widget or web tab, you can utilize the JS SDK API helpers provided in the JS SDK Library.
  5. Configure plugin-manifest.json file, refer to the following topic.

Configure plugin-manifest.json file

  1. Once you have developed your Widget or Web tab from your project folder, open the plugin-manifest.json file with your text editor and specify your widget or Web tab location identifiers. 
  2.  Add the domains that are to be whitelisted.
    Info
    Internal Widgets or Web tabs are restricted to access within Zoho People servers, with all other URLs being blocked by default. To grant widgets or web tabs permission to retrieve data from designated sources, whitelist specific URLs.
  3. Save plugin-manifest.json file.
Widget Location Identifiers

Widget Position in Zoho People
Location Identifiers
Dashboard
people.dashboard
Custom Button
people.custombutton
Related List
people.form.relatedlist

Web tab Location Identifiers

Web Tab Position in Zoho People
Location Identifiers
Home
people.home
Service 
people.service
            


Plugin-manifest.json File Setup for  Multiple HTML File Support in a Single ZIP File

  1. {
  2.   "locale": [
  3.     "en"
  4.   ],
  5.   "service": "PEOPLE",
  6.   "whiteListedDomains": [],
  7.   "modules": {
  8.     "widgets": [
  9.       {
  10.         "location": "people.home",
  11.         "name": "Zoho People Extension",
  12.         "url": "/app/widget.html",
  13.         "logo": ""
  14.       },
  15.       {
  16.         "location": "people.dashboard",
  17.         "name": "Zoho People Extension",
  18.         "url": "/app/time.html",
  19.         "logo": ""
  20.       },
  21.       {
  22.         "location": "people.custombutton",
  23.         "name": "Zoho People Extension",
  24.         "url": "/app/leave.html",
  25.         "logo": ""
  26.       }
  27.     ]
  28.   },
  29.   "config": [],
  30.   "connectors": [],
  31.   "cspDomains": {
  32.     "connect-src": []
  33.   }
  34. }

Test Widget or Web tab

  1. Navigate to the project directory using the following command:
Quote
cd {project directory}
  1. Run the following command to start a local HTTP server that allows you to run your widget or Web tab locally to test it in your sandbox instance:
Quote
zet run
      


      3. 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.
      4. To verify the server, enable developer mode while testing your extension.


Validate and pack

  1. Navigate to the project directory using the following command:
Quote
cd {project directory}
  1. Run the following command to validate your application:
Quote
zet validate
This will validate your app package and identify any violations, which should be corrected before updating the zip file in the developer console.



      3. Run the following command to generate a zip of your widget or web tab which can be uploaded in Zoho People.
Quote
zet pack


     
A zip file of the widget or web tab will be created in the "dist" folder of your project directory. Use this file to upload into your Zoho People application.
Info
Once you have created an internal widget or web tab zip file, you can upload them in Zoho People and use them as widgets or Web tab in applicable interfaces.
To upload widget, refer to Using Widgets in Zoho People.
To upload a web tab, refer to Using Web tab in Zoho People.

Points to remember

  1. The widget or web tab ZIP folder contains the widget.html file inside the App folder by default. This is the index file, which will be incorporated as the widget in your page.
  2. If you've created another folder inside the App folder and moved the widget.html file inside the new folder, then you need to specify the index file name in the following format when adding widgets to your Zoho People account.
Quote
/<folder-name>/<filename>.html
  1. The widget ZIP folder must be packed only using the zet pack command to be considered a valid ZIP file. Uploading the widget file using other commands will result in failure.
Quote
zet pack