Creating your own connector
You can download your own connector that is tailored for your tasks.
The connector is accessible from your personal account: Process Editing -> List of Connectors -> Upload a Connector.
The connector is described with the help of a JSON structure that is configured as follows:
{
"name": "My own connector",
"image":"",
"description": "The useful connector",
"type": "custom",
"code": {
"before": "",
"after": "",
"script": "<JS code>"
},
"params": {
"type": "string",
""
}
}
| Name | Type | Description |
|---|---|---|
| name | string |
Connector name. Obligatory parameter. |
| image | string |
Connector logo in base64 format. |
| description | string |
Connector description. |
| type | string |
Connector type. "custom" should always be used. |
| code | object |
Object describing the executed connector code |
| params | object |
This section contains descriptions of parameters, the values of which will be requested of the user when editing the connector. They can be further used while executing the connector code. |
Code of connector
The code section is configured as follows:
| Name | Type | Description |
|---|---|---|
| before | string |
The code described in this section will be run before the main executed code. It is optional. |
| script | string |
Main executed code of the connector. This code is required. |
| after | string |
The code described in this section will be run after the main code executed. It is optional. |
Params of connector
Each parameter is described by a section that has the following configuration:
| Name | Type | Description |
|---|---|---|
| handler | string |
JavaScript - a code that helps validate the values of parameters transmitted while saving the connector. |
| type | string |
Parameter type that can adopt the following values: string, select, boolean, multistring, number, date, code; |
| title | string |
Parameter heading that will appear in the user interface. |
| values | array of objects |
This section is only needed for the "select" type. It inserts the values into a drop-down list. Example: values: [{title: "Man", value: "1"}, {title: "Woman", value: "2"}] |
| visible | object |
Object describing dependent parameters, where "property" stands for the name of another parameter, and "value" stands for the value at which the current field will be displayed. Example: visible:{"paramName": "value"} |
| order | integer |
Displaying the field while editing under a user name. |
| schema | object |
Not implemented yet |
| defaultValue | object |
Not implemented yet |
Example of a uploaded connector
{
"image" : "",
"name" : "Webhook",
"description" : "Webhooks allow you to accept external http requests",
"type" : "custom",
"code" : {
"before" : "",
"after" : "",
"script" : "<JS code>"
},
"params" : {
"method" : {
"values" : [
{
"value" : "POST",
"title" : "POST"
},
{
"title" : "GET",
"value" : "GET"
}
],
"handler" : "if (params[name] !== 'POST' && params[name] !== 'GET') {\n\tthrow new Error('Unknown method');\n}",
"type" : "select",
"title" : "Http method"
},
"action" : {
"handler" : "if (typeof params[name] !== 'string' || params[name].length < 5) {\n\tthrow new Error(name + ' is empty or less than 5 chars');\n}",
"type" : "string",
"title" : "Endpoint"
},
"once" : {
"handler" : "if (typeof params[name] !== 'boolean') {\n\tthrow new Error(name + ' must be boolean of type');\n}",
"type" : "boolean",
"title" : "Once"
}
}
}