Installing the Freshworks CLI

Introduction

Freshworks allows developers to build innovative applications on its SaaS platform using a best-in-class developer platform. It enables developers by providing high-quality developer resources to build and scale applications easily. Furthermore, it allows developers to monetize the applications built on the platform, thereby building a recurring stream of revenue. In this section, you will learn how to install the Freshworks Developer CLI utility aka FDK CLI, which allows a simplified application development experience.

Getting started

If you are new to the Freshworks Developer ecosystem, this segment will help you get started. There are three significant steps

  1. Sign up as a Freshworks developer
  2. From the developer account subscribing to a Freshworks product of your choice as shown here
  3. To perform Local CLI setup

Freshworks CLI (FDK) depends on Node.js and is required to develop an application in the Freshworks developer platform. Check the last section to uninstall the existing installed prerequisites or some of them.

To install FDK, you need to install:

  1. NVM
  2. Node

Signing up a Freshworks developer

  1. If you already have an account with us skip this step
  2. By clicking the link and providing the necessary details Developer Sign up
  3. Bookmark the developer account link for future reference
  4. Refer to detailed instructions from here

From the developer account subscribing to a Freshworks product

  1. If you already have an account with us skip this step
  2. When landed on App Management Portal (AMP) you will be asked to signup for at least one product to get started with
  3. Select the product of your choice and signup
  4. Refer to detailed instructions on Product Sign Up when in doubt

Local setup

Kindly ensure you have gone through the Introductory guide to Freshworks app development if haven’t done already

How to get the necessary setup done?

If you already have Node v18.13.0 or above in your workspace, skip this step and navigate to, else follow the instructions given below as per applicability.

1. Ensure you have NVM Setup locally

The NVM installation instructions defer based on the platforms. Choose the steps for the respective operating system and follow the instructions to install the CLI. Choose the steps as per your operating system and follow the instructions given below

MacOS

  1. Install brew using the command below. Skip this step if already have brew installed locally
    # run the below command via terminal
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    # Verify the installation
    brew version
    
  2. Install NVM via brew
    # run the below command via terminal
    # install nvm
    brew install nvm
    
  3. Add nvm to your shell profile: To make nvm available every time you open a new terminal window, you will need to add the following line to your shell profile (e.g., ~/.bash_profile or ~/.zshrc):
    source $(brew --prefix nvm)/nvm.sh
    
  4. Verify the NVM version
    # verify version
    nvm --version
    # output should be v0.39.1 or higher
    

Ubuntu

  1. Patch your system with the latest software updates
    # Update your system software
    # When prompted enter the admin user credentials to execute the command
    sudo apt update && sudo apt upgrade -y
    
  2. You must have cURL installed
    # run the below command
    sudo apt install curl 
    
  3. Download and execute the installer script using the following Command
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
    
    
  4. NVM keeps all files under the $HOME/.nvm directory. Then it sets the environment in the user’s .bashrc file. You need to load this environment to set the required configuration by running the following command:
    source ~/.bashrc
    
  5. Verify the NVM version
    # verify version
    nvm --version
    # output should be v0.39.1 or higher
    

Windows

This is an optional step for Windows users if you wish to use only a single version of Node

If you wish to download and install multiple versions of Node JS for development purposes then only follow these steps

For Windows users there are multiple node installation options, choose any one of them as listed below

Install via installers

  1. Download the NVM Setup from here
  2. Complete the installation process using the steps given here

Install via Chocolatey package manager

  1. Launch the PowerShell in Admin mode
  2. Run the following command
    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
    
  3. Verify Chocolatey installation using the command given below
    choco -v
    
  4. Install NVM via Chocolatey package manager
    # install nvm
    choco install nvm
    
  5. Verify NVM installation
    nvm --version
    # output should be v0.39.1 or higher
    

Install inside Windows Subsystem for Linux

  1. Open WSL2 for Ubuntu from the start menu
  2. If you don’t already have it, install curl
    sudo apt-get install curl
    
  3. Run the NVM installation script as shown below
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
    
  4. The script clones the nvm repository to ~/.nvm, and attempts to add the source lines from the snippet below to the correct profile file (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).
    export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" 
    # This loads nvm
    

CentOS/RHEL7

  1. Patch your system with latest software updates
    # Update your system software
    sudo yum update
    
  2. You must have cURL installed
    # run below command
    sudo yum install curl -y 
    # when prompted enter the admin user credentials to execute the command
    
  3. Download and execute the installer script using the following Command
    curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
    
  4. NVM keeps all files under the $HOME/.nvm directory. Then it sets the environment in the user’s .bashrc file. You need to load this environment to set the required configuration by running the following command:
    source ~/.bashrc
    
  5. Verify the NVM version
    # verify version
    nvm --version
    # output should be v0.39.1 or higher
    

2. Install Node

If you already have Node version installed locally with v18.13.0 or higher, skip this step and navigate to 6.4

There are multiple options to install Node, choose any one of the following.

Installation Using NVM

  1. Check if you have an existing NVM installation and is pointing to the right version
    nvm -v
    # output should be v0.39.1 or higher
    
  2. Use NVM to install Node 18
    nvm install 18
    # output should be similar to "Downloading and Installing node v18.13.0 or higher"
    # Towards completion you should see similar to "Now using node v18.13.0 (npm v9.5.0)"
    
  3. Verify the Node version
    node -v
    # output should be higher than v18.13.0
    
  4. Set default alias for Node 18
    nvm alias default 18
    # default -> 18 (v18.13.0) or higher
    

Installation Using Installers

  1. Download the setup for Node from here as applicability
  2. Follow the installation steps in the installer when prompted

Installation using other package managers

  1. For CentOS
    dnf module install nodejs:18/common
    
  2. For Windows
    winget install OpenJS.NodeJS
    

3. Install build tools

 ```sh
 # for first-time users, using Node JS on Mac
 xcode-select --install
 # verify you have xcode cli installed
 xcode-select -p
 ```

4. Install the latest version of FDK

If you are already using FDK version 9.0.0 or higher, skip this step.
If you are installing FDK for the first time, follow the instructions under the “Fresh installation” section
If you are using an FDK version lower than 9.0.0, follow the instructions under the “Upgrade the existing version of FDK CLI” section

Fresh installation

  1. Use Node Package Manager (NPM) to install the latest Freshworks CLI
    npm install https://cdn.freshdev.io/fdk/latest.tgz -g
    
  2. Verify the installation using the command below
    fdk -v
    

Upgrade the existing version of FDK CLI

  1. For existing Users of FDK CLI with version <9.0.0, remove the existing version of FDK using the command given below
    npm uninstall fdk -g
    
  2. Remove the ~./fdk folder manually using the command given below
    # remove the ~/.fdk folder
    rm -r ~/.fdk
    
  3. Use Node Package Manager (NPM) to install the latest Freshworks CLI
    npm install https://cdn.freshdev.io/fdk/latest.tgz -g
    
  4. Verify the installation using the command below
    fdk -v
    

Installation summary

Towards the end of it, your output should be the same or higher than the listed versions

#for nvm -v
0.39.3
# for node -v
v18.16.0
# for npm -v
9.6.3
# for fdk -v
9.0.2

Once completed create your first Freshworks application using app development guide

Uninstall the dev environment

For removing the existing environment to start afresh, proceed with the following steps.

Uninstall FDK

  • Run command, npm uninstall fdk -g
  • To remove FDK-related files, run the command, rm -rf ~/.fdk

Uninstall Node

  • If installed through NVM:
    • Uninstalling NVM will remove all the Node versions installed with it. Check out the next section to uninstall NVM.
  • If installed directly using the source or another tool, remove the Node manually from the installed folder where it is installed and remove the Node path variable.
    • For Windows, it would be easy to uninstall Node on GUI provided by the OS.

Uninstall NVM

Furthermore, we have a lot of developer resources, do check them out.

4 Likes

Node version 10.x.x does not work. So above mentioned version is wrong developers should not use it.

2 Likes

Hi @pavan-amplifli,

We have updated the Node version to replicate the official Documentation. The steps should work fine now.
Thanks for notifying us.

This post needs to be updated. The latest FDK needs Node version 18 as per the official Freshworks developer documentation.

Hi @sainathr ,

Thanks for calling this out, I shall do the needful.

Regards,
Thakur

1 Like

Please forgive me if I am missing something… I tried installing FDK but this fails every time giving “Warning Deprecated” errors on several packages. How do I get this to install successfully?

npm install https://cdn.freshdev.io/fdk/latest.tgz -g

Hi @Bryce_Kulasxa ,

To install FDK you need to have Node 18 with NPM 9.5 or above installed locally with Node 18 being your active Node version. Once the prerequisites are met it shall install properly. If you face any errors after following these steps, please add the error log or screenshot here.

Regards,
Thakur

Forgive me also… I’m trying to install the FDK and I’m seeing deprecation warnings and other install errors.

NPM 9.6.7
Node 18.7.1

Screenshot and log file attached as requested.


2023-08-25T04_50_05_709Z-debug-0.log (455.6 KB)

GBTC02FJ0QSQ05N:~ sramir$ (echo; echo ‘eval “$(/opt/homebrew/bin/brew shellenv)”’) >> /Users/sramir/.bash_profile

-bash: /Users/sramir/.bash_profile: Permission denied

i get the above error