The Freshworks app development platform includes a serverless environment to enable you to create apps that run in response to events such as Freshservice product, app setup, and external events. Serverless computing involves servers, but they are abstracted away from developers.

To use this feature, all you need to do is configure an event listener and the callback method. When the event occurs, the callback method is executed on a server. This is in contrast to front-end apps which run in response to events, such as a ticket page load or a button click, which are executed on the client’s browser (UI).

1. You need to have CLI v5.0.0 to use this feature. For more information on how to install the latest version, click here.
2. We support Node 8.10.x only. For more information, see Moving on to Node.js 8.

Use Cases

Custom Automations

Freshservice enables automations through workflow automator, which you can enhance in a variety of ways:

  • You can obtain data from external sources to customize your workflow. For instance, when a ticket is created, an app can check if the ticket raised is related to a security issue and set the priority accordingly.
  • Automation rules in Freshservice are limited to ticket events. You can now build workflows for app installation and external events.

Bi-directional Synchronization

Events, such as ticket creation and updation, can be used to synchronize data across multiple products. For example, every time a ticket with certain ticket property is created or updated in Freshdesk, the ticket will be created or updated in your Freshservice instance in real time. Alerts and Notifications

This feature can also be used to apply custom logic to alerts and notifications. You can receive notifications through the desired channel (email, chat, SMS) when product, app, or external events occur.

Server Method Invocation

The server method invocation allows code in server.js to be executed in response to front-end events. This feature enables you to use node libraries (that only run on the backend) or hide sensitive information.

1. The serverless component of the app is executed in sandbox mode where some methods, such as setTimeout and setInterval, cannot be used.
2. The app must complete its execution within 20 seconds or it will timeout.


To create a new serverless app, run the following command. $ fdk create --products freshservice --template your_first_serverless_app The current directory should be empty.

A new Freshservice app is successfully created from the your_first_serverless_app template with the following files.

├── README.md ├── config │   ├── iparam_test_data.json │   └── iparams.json ├── manifest.json └── server ├── lib │ └── handle-response.js ├── server.js └── test_data ├──onConversationCreate.json ├── onTicketCreate.json └── onTicketUpdate.json 4 directories, 9 files

Folder/File Description
README.md Developers can outline additional instructions or specifications here.
server/ Contains files and folders related to the serverless component of the app. JS files in this folder must follow the ES6 standard.
server/lib Contains an external library with methods that can be used in server.js. require("./lib/handle-response"); Here, handle-response is a lib file in the project-folder/server/lib/ directory.
server/server.js Contains the event registration and callback methods.
server/test_data Includes files that contain a sample payload for each event which will be used during local testing.
config/ Contains the installation parameters files.
config/iparams.json Contains all the parameters that users need to specify/set when they install the app. For more information on the installation parameters and related APIs, see Installation Parameters.
config/iparam_test_data.json Developers can specify parameter values here to test the app in their local setup.
manifest.json Contains details about the app and its configuration.


These are npm packages that can be used in the server.js file and server/lib folder files as per your requirement. For example, you can use the utility methods in the underscore package or easily make HTTP calls with the request package.

1. If you are using a Windows machine, see the prerequisites to ensure that your machine is set up correctly.
2. All popular npm packages (at least 50 downloads) are supported.

To use npm packages, follow these steps.

  1. List the packages in the manifest file with their corresponding versions as shown.
  2. manifest.json Copied Copy
    "dependencies": { "underscore": "1.8.3" },
  3. You can now load the dependencies by including the require() method in the server.js file. Use this method in the first call and not inside functions.
  4. Copied Copy
    var _ = require("underscore"); _.first([5, 4, 3, 2, 1]);

    Here, underscore is the package that is loaded when this method is invoked from server.js.

    Local Libraries

    You can use local libraries which contain helper methods in your server.js file to make your code modular and maintainable. You can load the local library from the server/lib directory by using the require() method in the server.js file.

    server.js Copied Copy
    var handler = require("./lib/handle-response");

    Here, handle-response is a library file in the server/lib directory.