Quick Start

In this section, you will learn to build a simple Freshsales app using the following steps.

Step 1: Install NVM

Step 2: Install Node

Step 3: Install the CLI

Step 4: Create your First App

Step 5: Test your App

Step 6: Validate and Pack

Apps built on the Freshworks platform are compatible with the latest two versions of the following browsers.

  • Google Chrome
  • Firefox
  • Edge
  • Safari
  • Internet Explorer - Not supported

Install NVM

It is recommended to use Node Version Manager (NVM) to install Node.js as it enables you to install and work with multiple versions of Node easily.

Note:
Check if Node exists in your computer by running the following command: node --version and uninstall any existing Node version on your computer and remove all folders related to Node and NPM.

You can skip step 1 if you have already installed NVM.

  1. To install NVM:
    1. For Mac/Linux, refer to the steps given here.
    2. For Windows, click here to download and extract the installer from nvm-setup.zip listed under Assets.
  2. To verify the installed nvm version, run the following command. $ nvm --version
Install Node

Next, to install Node.js, follow the given steps.

  1. To install Node (recommended version is 8.10.x) using NVM, run the following command. $ nvm install 8.10

    Note:
    We support only Node 8.10.x. For more information, see Moving on to Node.js 8.

  2. To verify the installed node version, type the following command. $ node --version

    Note:
    For Windows, if the node version is not displayed, you may need to enable nvm by running the command: nvm on

  3. To set the default node version with NVM, run the following command: $ nvm alias default 8.10
  4. For Windows, you need to install a few required tools and configurations by using the following command. $ npm install --global --production windows-build-tools For further reference, click here.
Install the CLI

Now, you need to install the Freshworks CLI on your machine to build, test, and publish apps in Freshsales Marketplace.

Note:
By installing the CLI, you agree to these Terms and Conditions.

  • To install the CLI, run the following command.
  • Copied Copy
    1
    npm install https://dl.freshdev.io/cli/fdk-5.2.6.tgz -g
  • To verify the version, run the following command.
  • Copied Copy
    1
    fdk version
Create your First App

In this section, you will learn to create a simple app to display the Freshsales logo and sample text on the Lead Details page.

Open the terminal window, navigate to an empty directory in which you want to create your app, and follow the given steps.

  1. At the prompt, type fdk create
  2. From the product list, select a product and press Enter.
  3. From the template list, select your_first_app and press Enter.

The following app files appear in the directory.

Directory/File Description
app/ This directory contains all the files (HTML, JS, CSS, images, library) required for the front-end component of your app. The JS files must follow the ES5 standard.
app/icon.svg This is the product icon file in the app directory created as part of the sample project. You can replace it with your own assets while building your app.
Note: The icon file should be of SVG type with a resolution of 64 x 64 pixels.
app/template.html This file contains the HTML required for the app’s UI which is rendered in an IFrame.
config/ This directory contains the installation parameters and OAuth configuration files.
config/iparams.json This file contains all the installation parameters which you will have to specify/set when you install the app. For more information on installation parameters and related APIs, see Installation Parameters.
config/iparam_test_data.json This file contains the installation parameter values which you will specify to test the app on your machine.
manifest.json This file contains details about your app and its characteristics.
README.md This file contains any additional instructions or specifications which you might want to outline.


Note:
If you use React, Ember, Vue, or any other front-end framework, include the source files of your app in the src directory. This will ensure quick app reviews.

For a detailed walkthrough of the app, see Code Walkthrough.

Test your App

For testing, we recommend that you use the latest version of Chrome browser. To test your app on your machine, follow the given steps.

  1. Open your console, navigate to your project folder, and execute the following command. $ fdk run
  2. Log in to your Freshsales account (if you do not have a Freshsales account, sign up here).
  3. Go to the Lead Details page and in the the address bar, append the URL with ?dev=true. For example, the URL should look like this: https://subdomain.freshsales.io/leads/1 ?dev=true.
  4. When testing the app on your machine, you may see a shield icon in the browser address bar. Clicking the icon will display a warning message as the Support portal runs on HTTPS while the server used for testing runs on HTTP.
  5. Click Load Unsafe Scripts to continue testing.
  6. On the Home page, from the left global sidebar, select the Leads tab and click any lead. The rendered app is displayed at the bottom of the page as shown below.
  7. Note:
    1. Each component in the coverage summary should be at least 80% for apps to be submitted in Freshworks Marketplace. See Code coverage for more information.
    2. While testing your app, if you have any issues that require the Support team, attach detailed logs of the output along with your support ticket for a quick resolution.

Validate and Pack

To check if the app is error-free and package it for submission, follow the given steps.

  1. Navigate to your project folder and validate the code by using the following command. $ fdk validate [--app-dir DIR] Here, DIR is the relative or absolute path to the project directory.
  2. Once validation is successful, you can pack the project by running the following command. $ fdk pack [--app-dir DIR] The pack command generates the dist/sampleapp.zip file which you need to upload in the Developer portal to be published in Freshsales Marketplace. For information on the submission process, see the Types of Apps section in Marketplace Listing.