Freshworks CLI

Freshworks Command-Line Interface (CLI) enables you to build, test, and package apps to publish them in Marketplace.

As soon as you install the CLI, type fdk to display the supported commands.

The following options are also avaliable.

  • For information about a specific command, run the following command. $ fdk COMMAND (-h | --help)
  • To obtain detailed logs, run the following command. $ NODE_DEBUG=fdk fdk COMMAND
Create

This command is used to create a new app. Before executing the create command, ensure that specified or current app directory is empty.

$ fdk create [--app-dir DIR] [--products PRODUCT] [--template TEMPLATE]

Options Usage
--app-dir Specify the absolute or relative path to the project directory.
--products Specify the product for which the app is created. If not specified, you will be prompted to select a product.
--template Specify the template. If not specified, you will be prompted as shown:

Example 1
To create a Freshdesk app in the current directory, run the following command. $ fdk create --products freshdesk --template your_first_app The current directory should be empty.

Output
A new Freshdesk app is created from the your_first_app template with the following files.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/Users/user/myfirstapp ├── README.md ├── app │ ├── app.js │ ├── freshdesk_logo.png │ ├── icon.svg │ ├── logo.png │ ├── style.css │ └── template.html ├── config │ ├── iparam_test_data.json │ └── iparams.json └── manifest.json 2 directories, 10 files
EXPAND ↓

Example 2
Run any of the following commands to create default Freshdesk sample app directories and files in the myfirstapp directory. $ fdk create --app-dir ./myfirstapp $ fdk create --app-dir /Users/user/myfirstapp The output will be the same as Example 1.

Generate

This command is used to generate an app file with a specific template for an existing app that was created using the create command.

$ fdk generate

Once you run the generate command, the following options are displayed.

File Description
oauth_config.json Contains configurations required for OAuth-based authentication.
iparams.json Contains installation parameters that you define.
iparams.html Helps you build custom installation pages.
server.js Contains event registration and callback methods.
manifest.json Contains information about your app such as the version, product, location, and so on.

Select the required file and configure the parameters, and the file is generated.

Run

This command is used to start the local server in order to test your app.

$ fdk run [--app-dir DIR]

Options Usage
--app-dir Specify the absolute or relative path to the project directory.

If you are running a serverless app that contains dependencies, the packages defined in manifest.json are automatically installed.

Once you exit testing, the CLI prints a summary of how extensive your testing was. The following coverage summary shows an example of thorough testing.

1
2
3
4
5
6
======================= Coverage summary ======================== Statements : 98.18% ( 54/55 ) Branches : 100% ( 4/4 ) Functions : 84.62% ( 22/26 ) Lines : 98.18% ( 54/55 ) =================================================================

Note:
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.

Example 1
To run the command from the app project directory, type: $ fdk run

Output

Starting local testing server at http://*:10001/
Append "dev=true" to your Freshdesk support URL to start testing
e.g. https://domain.freshdesk.com/helpdesk/tickets/1?dev=true
Quit the server with Control-C.

Example 2
To run the command from a different directory, type: $ fdk run --app-dir /Users/user/myfirstapp The output will be the same as Example 1.

Example 3
To run the command for a serverless app from a different directory, type: $ fdk run --app-dir /Users/user/myfirstapp

Output

Starting local testing server at http://*:10001/
Append "dev=true" to your Freshdesk support URL to start testing
e.g. https://domain.freshdesk.com/helpdesk/tickets/1?dev=true
Quit the server with Control-C.

To test the serverless component of your app, visit - http://localhost:10001/web/events

Validate

This command validates your app by running a corresponding test suite. $ fdk validate [--app-dir DIR]

Options Usage
--app-dir Specify the absolute or relative path to the project directory.

Pack

This command is used to pack the app project for submission.

$ fdk pack [--app-dir DIR]

Options Usage
--app-dir Specify the absolute or relative path to the project directory.

Once you execute the pack command, a dist/<appdirectory>.zip file is generated which you need to upload in the Developer portal to publish it in Marketplace.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Sauls-Macbook-Pro:~ user$ tree myfirstapp/ myfirstapp/ ├── README.md ├── app │ ├── app.js │ ├── freshdesk_logo.png │ ├── icon.svg │ ├── logo.png │ ├── style.css │ └── template.html ├── config │ ├── iparam_test_data.json │ └── iparams.json ├── dist │ └── myfirstapp.zip └── manifest.json 3 directories, 11 files
EXPAND ↓

Example 1
To run the command from the app project directory, type: $ fdk pack

Output

App packed successfully at /dist/myfirstapp.zip
Upload this file to the marketplace by following the instructions at https://developers.freshdesk.com/docs/marketplace-listing/
Sauls-Macbook-Pro:/ user$

Example 2
To run the command from a different directory, type: $ fdk pack --app-dir /Users/user/myfirstapp The output will be the same as Example 1.

Version

This command prints the installed and latest CLI versions. $ fdk version

Output

Installed: 4.9.5
Latest: 5.0.9
To install the latest version type "npm install http://dl.freshdev.io/cli/fdk-5.0.9.tgz -g"