The flowmate.io platform supports Node.js programming language for building connectors.
To help you create a component in Node.js we have created a simple My SaaS connector which connects to the described below API and demonstrates multiple features of the platform.
To help you create a component in Node.js, we have prepared a simple MySaaS component that connects to the MySaaS API and demonstrates various features of the platform.
Let's take a look at the structure of the MySaaS Component in Node.js:
mysaas-component-nodejs
├── component.json (1)
├── lib
│ ├── actions (2)
│ │ ├── createContact.js
│ ├── lookups (3)
│ │ ├── lookup.js
│ ├── schemas (4)
│ │ ├── createContact.in.json
│ │ ├── createContact.out.json
│ │ └── getAllContacts.in.json
│ │ └── getAllContacts.out.json
│ └── triggers (5)
│ ├── getAllContacts.js
├── package.json (6)
The Flowmate.io platform utilizes Node.js components built using the NPM run-script. This script first examines the package.json (6) configuration file to set up the node and npm versions and then initiates the build process. It subsequently downloads and constructs all necessary dependencies. For all Node.js components, the following dependency is mandatory:
"dependencies": {
"@openintegrationhub/ferryman": "2.4.4",
}
*Ferryman version 2.4.4 is the most current at the time of writing the documentation. Please always use the latest version.
Ferryman serves as the Node.js SDK for the Flowmate.io platform, facilitating component integration by providing a straightforward programming model and ensuring effective communication with the platform.
The component.json file (1) acts as the descriptor for the component, used by the platform to collect all necessary information for displaying it in the user interface (UI). This descriptor exclusively lists the component’s functionality, including triggers and actions.
The lib directory contains subdirectories actions(2), lookups(3), schemas(4), and triggers(5), as defined in the component.json file. The source files for Node.js are located in lib/actions and lib/triggers, while the JSON schemas that define the component’s metadata are stored in lib/schemas.
The component.json file acts as the component descriptor, which the platform uses to gather all necessary information about the component. Let's examine the descriptor for the MySaaS component:
{
"title": "My SaaS Connector", (1)
"description": "Connector for the MySaaS API", (2)
"triggers": { (3)
...
},
"actions": { (4)
...
}
}
In this descriptor, the component title (1) and description (2) are specified.
The triggers (3) and actions (4) properties outline the component's available triggers and actions.