The Freshworks Command-Line Interface (CLI) enables you to build, test and package apps for publishing on the Marketplace.
The fdk commands will be available for use in the terminal as soon as you install the CLI. The format is: $ fdk COMMAND [--app-dir DIR] [command-specific-options]
Running fdk will display all the supported commands as shown below:
If you want information on a specific command, you can run the following command:
$ fdk COMMAND (-h | --help)
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]
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 this is not mentioned, it is assumed to be Freshservice. |
Example 1:
Running the following command will create a Freshservice app in the current directory:
$ fdk create --products freshservice your_first_app
The current directory should be empty.
Output
A new Freshservice app was successfully created from template your_first_app
with the following files.
1 2 3 4 5 6 7 8 9 10 | /Users/user/myfirstapp ├── README.md ├── app │ ├── app.js │ ├── freshservice_logo.png │ ├── icon.svg │ ├── logo.png │ ├── style.css │ └── template.html ├── config |
Example 2:
Running any of the following commands will create default Freshservice sample app directories and files in the myfirstapp directory. This directory should exist and be empty.
$ fdk create --app-dir ./myfirstapp
$ fdk create --app-dir /Users/user/myfirstapp
The output will be same as the Example 1.
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 the manifest.json will be automatically installed.
Example 1: Running the command from the app project directory:
Example 2:
Running the command from a different directory:
$ fdk run --app-dir /Users/user/myfirstapp
The output will be same as the Example 1.
Example 3:
Running the command for a serverless app from a different directory:
$ fdk run --app-dir /Users/user/myfirstapp
Output
$ Starting local testing server at http://*:10001/
Append "dev=true" to your reshservice support URL to start testing
e.g. https://domain.freshservice.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, dist/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | Veekay-Macbook-Pro:~ user$ tree myfirstapp/ myfirstapp/ ├── README.md ├── app │ ├── app.js │ ├── freshservice_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 |
Example 1:
Running the command from the app project directory:$ fdk pack
Output
App packed successfully at /dist/myfirstapp.zipUpload this file to the marketplace by following the instructions at
https://developers.freshservice.com/docs/marketplace-listing/ Veekay-Macbook-Pro:/ user$
Example 1:
Running the command from a different directory:$ fdk pack --app-dir /Users/user/myfirstapp
The output will be same as the Example 1.
version
This command prints the currently installed and the latest available CLI version.
$ fdk versionOutput
Installed: 4.2.3Latest: 4.3.2
To install the latest version type "npm install http://dl.freshdev.io/cli/fdk-4.3.2.tgz -g"