Creating Your First Freshdesk App

Info:

As you are navigating this section it is understood that you have following items available with you.

  1. Freshdesk Account
  2. Node version v18.13.0 or higher installed locally
  3. Freshworks CLI with version 9.0.0 or higher installed locally
Note:

While following these steps ensure that

  1. The directory must be empty.
  2. The directory name will be inferred as app name

Creating a new app

  1. Create Freshdesk App using one of the below options

    1. 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
    2. Alternatively, you can just run fdk create

      1. 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)
      2. 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)
  2. 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/FileDescription
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.jsonContains 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.logContains all debugging information, warnings, and errors generated when an app is created, run, packed or validated.
manifest.jsonContains 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.mdContains additional instructions, information, and specifications.
Info:

** - Applicable only for Serverless applications/backend applications