As you are navigating this section it is understood that you have following items available with you.
- Freshdesk Account
- Node version v18.13.0 or higher installed locally
- Freshworks CLI with version 9.0.0 or higher installed locally
While following these steps ensure that
- The directory must be empty.
- The directory name will be inferred as app name
Creating a new app
Create Freshdesk App using one of the below options
Open the terminal window, navigate to the directory you want to create your app and type the following command.
fdk create –-products freshdesk --template your_first_app
Alternatively, you can just run fdk create
Use the CLI prompts to choose the product as "freshdesk"
? Choose a product: ❯ freshdesk freshservice freshsales freshchat freshconnect freshcaller freshteam (Move up and down to reveal more choices)
and then the template as your_first_app.
? Choose a product: freshdesk ? Choose a template: (Use arrow keys) ❯ your_first_app your_first_serverless_app sample_crm_app advanced_iparams_app your_first_react_app your_first_vue_app your_first_vue3_app (Move up and down to reveal more choices)
Once app is created successfully you shall see the success message as below
├── README.md ├── app │ ├── index.html │ ├── scripts │ │ └── app.js │ └── styles │ ├── images │ │ └── icon.svg │ └── style.css ├── config │ └── iparams.json ├── log │ └── fdk.log └── manifest.json 6 directories, 8 files
Optionally you can read more about Freshworks CLI options
Understanding app structure and files
The following directories and files are created as a result of the fdk create command. You would see a variation of these based on template selected
Directory/File | Description |
---|---|
Important:When building an app, do not modify the default folder/file names. | |
config/ | Contains the installation parameters, request template, and OAuth configuration files. |
config/iparams.json | Contains all the installation parameters whose values are set when the app is installed. For more information, see Installation parameters. |
log/ | Contains the files in which the app debugging information is captured. |
log/fdk.log | Contains all debugging information, warnings, and errors generated when an app is created, run, packed or validated. |
manifest.json | Contains details such as the platform version the app uses, product to which the app belongs, event listeners for the app, the Node.js version, request templates that the app code uses, and FDK versions used to build, test, validate, and pack the app, and npm packages that the app uses (dependencies). |
server/ (All js files are ES6 compatible) ** | Contains files and folders related to a serverless app or the serverless component of an app. |
server/ lib** | Contains external libraries with methods that can be used in server.js. |
server/ lib/ handle-response.js** | Contains the method that can be used in server.js to handle the API responses. |
server/ server.js** | By default, contains the app logic to listen to the onTicketCreate event and from the payload, fetch the requestor’s name and print it on the app user’s terminal. When you build the app, replace the default content with your app logic. |
server/ test_data** | Includes files that contain sample payloads for the events that are simulated to test a serverless app. |
README.md | Contains additional instructions, information, and specifications. |
** - Applicable only for Serverless applications/backend applications