Snap-in developmentReferences

Functions

Using functions, you can provide custom code and link it to your event sources, automations, or snap-kit actions. Functions are written in JavaScript and can be used to transform events, send notifications, or perform any other custom logic including network calls.

In order to create a snap-in version, functions must be defined as shown in the code samples. Functions are packaged and provided as an artifact at the time of snap-in version creation and then used to deploy functions to snap-in versions. An artifact may contain multiple function definitions. The artifact is a zip file containing the following files:

$/
>├── src/
>├ ├── functions/ # Contains a folder each for the functions defined in the manifest. The folder name should match the function name in manifest.
>├ ├── functions/function-1/ # function-1 is a function defined in the manifest.
>├ ├── function-factory.ts # defines the functions to be imported. Each function to be used in the manifest should be included here. Refer to the example for the format.
>├── dist/ # Contains the transpiled code for the functions. Autogenerated but should be included in the artifact.
>├── package.json # Contains the dependencies for the functions.

Function manifest

The function manifest consists of the following fields:

1functions:
2 - name: function_1
3 description: Function 1
  • name: It is the function name that should match the corresponding function name in the folder.
  • description: It describes the function.

Refer to the function invocation for details about the exact payload of the function.