mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 21:37:32 -08:00
commit
29bf80c3eb
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -9,3 +9,5 @@ package-lock.json
|
|||
yarn.lock
|
||||
google-generated-credentials.json
|
||||
_START_PACKAGE
|
||||
.env
|
||||
.vscode
|
||||
|
|
|
@ -19,6 +19,7 @@ so also used with internal tools.
|
|||
- [Securing n8n](#securing-n8n)
|
||||
- [Persist data](#persist-data)
|
||||
- [Passing Sensitive Data via File](#passing-sensitive-data-via-file)
|
||||
- [Example Setup with Lets Encrypt](#example-setup-with-lets-encrypt)
|
||||
- [What does n8n mean and how do you pronounce it](#what-does-n8n-mean-and-how-do-you-pronounce-it)
|
||||
- [Support](#support)
|
||||
- [Upgrading](#upgrading)
|
||||
|
@ -193,6 +194,12 @@ The following environment variables support file input:
|
|||
- N8N_BASIC_AUTH_USER_FILE
|
||||
|
||||
|
||||
## Example Setup with Lets Encrypt
|
||||
|
||||
A basic step by step example setup of n8n with docker-compose and Lets Encrypt is available on the
|
||||
[Server Setup](https://docs.n8n.io/#/server-setup) page.
|
||||
|
||||
|
||||
## Setting Timezone
|
||||
|
||||
To define the timezone n8n should use, the environment variable `GENERIC_TIMEZONE` can
|
||||
|
|
|
@ -13,8 +13,10 @@
|
|||
- Advanced
|
||||
|
||||
- [Configuration](configuration.md)
|
||||
- [Data Structure](data-structure.md)
|
||||
- [Database](database.md)
|
||||
- [Keyboard Shortcuts](keyboard-shortcuts.md)
|
||||
- [Node Basics](node-basics.md)
|
||||
- [Nodes](nodes.md)
|
||||
- [Security](security.md)
|
||||
- [Sensitive Data](sensitive-data.md)
|
||||
|
|
|
@ -6,6 +6,32 @@ It is possible to change some of the n8n defaults via special environment variab
|
|||
The ones that currently exist are:
|
||||
|
||||
|
||||
## Publish
|
||||
|
||||
Sets how n8n should be made available.
|
||||
|
||||
```bash
|
||||
# The port n8n should be made available on
|
||||
N8N_PORT=5678
|
||||
|
||||
# This ones are currently only important for the webhook URL creation.
|
||||
# So if "WEBHOOK_TUNNEL_URL" got set they do get ignored. It is however
|
||||
# encouraged to set them correctly anyway in case they will become
|
||||
# important in the future.
|
||||
N8N_PROTOCOL=https
|
||||
N8N_HOST=n8n.example.com
|
||||
```
|
||||
|
||||
|
||||
## Base URL
|
||||
|
||||
Tells the frontend how to reach the REST API of the backend.
|
||||
|
||||
```bash
|
||||
export VUE_APP_URL_BASE_API="https://n8n.example.com/"
|
||||
```
|
||||
|
||||
|
||||
## Execution Data Manual Runs
|
||||
|
||||
n8n creates a random encryption key automatically on the first launch and saves
|
||||
|
@ -99,3 +125,18 @@ user-folder via an environment variable.
|
|||
```bash
|
||||
export N8N_USER_FOLDER="/home/jim/n8n"
|
||||
```
|
||||
|
||||
|
||||
## Webhook URL
|
||||
|
||||
The webhook URL will normally be created automatically by combining
|
||||
`N8N_PROTOCOL`, `N8N_HOST` and `N8N_PORT`. If n8n runs, however, behind a
|
||||
reverse proxy that would not work. Because n8n does for example run internally
|
||||
on port 5678 but is exposed to the web via the reverse proxy on port 443. In
|
||||
that case, it is important to set the webhook URL manually that it can be
|
||||
displayed correctly in the Editor UI and even more important that the correct
|
||||
webhook URLs get registred with external services.
|
||||
|
||||
```bash
|
||||
export WEBHOOK_TUNNEL_URL="https://n8n.example.com/"
|
||||
```
|
||||
|
|
39
docs/data-structure.md
Normal file
39
docs/data-structure.md
Normal file
|
@ -0,0 +1,39 @@
|
|||
# Data Structure
|
||||
|
||||
For "basic usage" it is not necessarily needed to understand how the data is structured
|
||||
which gets passed from one node to another. It becomes however important if you want to:
|
||||
|
||||
- create an own node
|
||||
- write custom expressions
|
||||
- use the Function or Function Item Node
|
||||
- you want to get the most out of n8n in general
|
||||
|
||||
|
||||
In n8n all data passed between nodes is an array of objects. It has the structure below:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
// Each item has to contain a "json" property. But it can be an empty object like {}.
|
||||
// Any kind of JSON data is allowed. So arrays and the data being deeply nested is fine.
|
||||
json: { // The actual data n8n operates on (required)
|
||||
// This data is only an example it could be any kind of JSON data
|
||||
jsonKeyName: 'keyValue',
|
||||
anotherJsonKey: {
|
||||
lowerLevelJsonKey: 1
|
||||
}
|
||||
},
|
||||
// Binary data of item. The most items in n8n do not contain any (optional)
|
||||
binary: {
|
||||
// The key-name "binaryKeyName" is only an example. Any kind of key-name is possible.
|
||||
binaryKeyName: {
|
||||
data: '....', // Base64 encoded binary data (required)
|
||||
mimeType: 'image/png', // Optional but should be set if possible (optional)
|
||||
fileExtension: 'png', // Optional but should be set if possible (optional)
|
||||
fileName: 'example.png', // Optional but should be set if possible (optional)
|
||||
}
|
||||
}
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
|
@ -2,3 +2,6 @@
|
|||
|
||||
Detailed information about how to run n8n in Docker can be found in the README
|
||||
of the [Docker Image](https://github.com/n8n-io/n8n/blob/master/docker/images/n8n/README.md).
|
||||
|
||||
A basic step by step example setup of n8n with docker-compose and Lets Encrypt is available on the
|
||||
[Server Setup](server-setup.md) page.
|
||||
|
|
72
docs/node-basics.md
Normal file
72
docs/node-basics.md
Normal file
|
@ -0,0 +1,72 @@
|
|||
# Node Basics
|
||||
|
||||
|
||||
## Types
|
||||
|
||||
There are two main node types in n8n Trigger- and Regular-Nodes.
|
||||
|
||||
|
||||
### Trigger Nodes
|
||||
|
||||
The Trigger-Nodes start a workflow and supply the initial data. A workflow can contain multiple trigger nodes but with each execution, just one of them will execute as they do not have any input and they are the nodes from which the execution starts.
|
||||
|
||||
|
||||
### Regular Nodes
|
||||
|
||||
These nodes do the actual “work”. They can add, remove and edit the data in the flow, request and send data to external APIs and can do everything possible with Node.js in general.
|
||||
|
||||
|
||||
## Credentials
|
||||
|
||||
External services need a way to identify and authenticate users. That data, which can range from API key over email/password combination to a very long multi-line private key, get saved in n8n as credentials.
|
||||
|
||||
To make sure that the data is secure, it gets saved to the database encrypted. As encryption key does a random personal encryption key gets used which gets automatically generated on the first start of n8n and then saved under `~/.n8n/config`.
|
||||
|
||||
Nodes in n8n can then request that credential information. As an additional layer of security can credentials only be accessed by node types which specifically got the right to do so.
|
||||
|
||||
|
||||
## Expressions
|
||||
|
||||
With the help of expressions, it is possible to set node parameters dynamically by referencing other data. That can be data from the flow, nodes, the environment or self-generated data. They are normal text with placeholders (everything between {{...}}) that can execute JavaScript code which offers access to special variables to access data.
|
||||
|
||||
An expression could look like this:
|
||||
|
||||
My name is: `{{$node["Webhook"].data["query"]["name"]}}`
|
||||
|
||||
This one would return "My name is: " and then attach the value that the node with the name "Webhook" outputs and there select the property "query" and its key "name". So if the node would output this data:
|
||||
|
||||
```json
|
||||
{
|
||||
"query": {
|
||||
"name": "Jim"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
the value would be: "My name is: Jim"
|
||||
|
||||
The following special variables are available:
|
||||
|
||||
- **$binary**: Incoming binary data of a node
|
||||
- **$data**: Incoming JSON data of a node
|
||||
- **$env**: Environment variables
|
||||
- **$node**: Data of other nodes (output-data, parameters)
|
||||
- **$parameters**: Parameters of the current node
|
||||
|
||||
Normally it is not needed to write the JavaScript variables manually as they can be simply selected with the help of the Expression Editor.
|
||||
|
||||
|
||||
## Parameters
|
||||
|
||||
On the most nodes in n8n parameters can be set. The values that get set define what exactly a node does.
|
||||
|
||||
That values which are set are by default static and are always the same no matter what data they process. It is however also possible to set the values dynamically with the help of Expressions. With them, it is possible to make the value depending on other factors like the data of flow or parameters of other nodes.
|
||||
|
||||
More information about it can be found under [Expressions](#expressions).
|
||||
|
||||
|
||||
## Pausing Node
|
||||
|
||||
Sometimes when creating and debugging a workflow it is helpful to not execute some specific nodes. To make that as simple as possible and not having to disconnect each node, it is possible to pause them. When a node gets paused the data simple passes through the node without being changed.
|
||||
|
||||
There are two ways to pause a node. Either pressing the pause button which gets displayed above the node when hovering over it. Or by selecting the node and pressing “d”.
|
189
docs/nodes.md
189
docs/nodes.md
|
@ -1,72 +1,167 @@
|
|||
# Node
|
||||
# Nodes
|
||||
|
||||
## Function and Function Item Node
|
||||
|
||||
These are the most powerful nodes in n8n. With these, almost everything can be done if you know how to
|
||||
write JavaScript code. Both nodes work very similarly. They simply give you access to the incoming data
|
||||
and you can manipulate it.
|
||||
|
||||
|
||||
## Types
|
||||
### Difference between both nodes
|
||||
|
||||
There are two main node types in n8n Trigger- and Regular-Nodes.
|
||||
The difference is that the code of the Function-Node does get executed only once and it receives the
|
||||
full items (JSON and binary data) as an array and expects as return value again an array of items. The items
|
||||
returned can be totally different from the incoming ones. So is it not just possible to remove and edit
|
||||
existing items it is also possible to add or return totally new ones.
|
||||
|
||||
The code of the Function Item-Node on the other does get executed once for every item. It receives
|
||||
as input one item at a time and also just the JSON data. As a return value, it again expects the JSON data
|
||||
of one single item. That makes it possible to very easily add, remove and edit JSON properties of items
|
||||
but it is not possible to add new or remove existing items. Accessing and changing binary data is only
|
||||
possible via the methods `getBinaryData` and `setBinaryData`.
|
||||
|
||||
Both nodes support promises. So instead of returning the item or items directly, it is also possible to
|
||||
return a promise which resolves accordingly.
|
||||
|
||||
|
||||
### Trigger Nodes
|
||||
### Function-Node
|
||||
|
||||
The Trigger-Nodes start a workflow and supply the initial data. A workflow can contain multiple trigger nodes but with each execution, just one of them will execute as they do not have any input and they are the nodes from which the execution starts.
|
||||
#### Variable: items
|
||||
|
||||
It contains all the items the node received as input.
|
||||
|
||||
### Regular Nodes
|
||||
Information about how the data is structured can be found on the page [Data Structure](data-structure.md)
|
||||
|
||||
These nodes do the actual “work”. They can add, remove and edit the data in the flow, request and send data to external APIs and can do everything possible with Node.js in general.
|
||||
The data can be accessed and manipulated like this:
|
||||
|
||||
```typescript
|
||||
// Sets the JSON data property "myFileName" of the first item to the name of the
|
||||
// file which is set in the binary property "image" of the same item.
|
||||
items[0].json.myFileName = items[0].binary.image.fileName;
|
||||
|
||||
## Credentials
|
||||
|
||||
External services need a way to identify and authenticate users. That data, which can range from API key over email/password combination to a very long multi-line private key, get saved in n8n as credentials.
|
||||
|
||||
To make sure that the data is secure, it gets saved to the database encrypted. As encryption key does a random personal encryption key gets used which gets automatically generated on the first start of n8n and then saved under `~/.n8n/config`.
|
||||
|
||||
Nodes in n8n can then request that credential information. As an additional layer of security can credentials only be accessed by node types which specifically got the right to do so.
|
||||
|
||||
|
||||
## Expressions
|
||||
|
||||
With the help of expressions, it is possible to set node parameters dynamically by referencing other data. That can be data from the flow, nodes, the environment or self-generated data. They are normal text with placeholders (everything between {{...}}) that can execute JavaScript code which offers access to special variables to access data.
|
||||
|
||||
An expression could look like this:
|
||||
|
||||
My name is: `{{$node["Webhook"].data["query"]["name"]}}`
|
||||
|
||||
This one would return "My name is: " and then attach the value that the node with the name "Webhook" outputs and there select the property "query" and its key "name". So if the node would output this data:
|
||||
|
||||
```json
|
||||
{
|
||||
"query": {
|
||||
"name": "Jim"
|
||||
}
|
||||
}
|
||||
return items;
|
||||
```
|
||||
|
||||
the value would be: "My name is: Jim"
|
||||
This example creates 10 dummy items with the ids 0 to 9:
|
||||
|
||||
The following special variables are available:
|
||||
```typescript
|
||||
const newItems = [];
|
||||
|
||||
- **$binary**: Incoming binary data of a node
|
||||
- **$data**: Incoming JSON data of a node
|
||||
- **$env**: Environment variables
|
||||
- **$node**: Data of other nodes (output-data, parameters)
|
||||
- **$parameters**: Parameters of the current node
|
||||
for (let i=0;i<10;i++) {
|
||||
newItems.push({
|
||||
json: {
|
||||
id: i
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Normally it is not needed to write the JavaScript variables manually as they can be simply selected with the help of the Expression Editor.
|
||||
return newItems;
|
||||
```
|
||||
|
||||
|
||||
## Parameters
|
||||
#### Method: $item(index)
|
||||
|
||||
On the most nodes in n8n parameters can be set. The values that get set define what exactly a node does.
|
||||
With `$item` it is possible to access the data of parent nodes. That can be the item data but also
|
||||
the parameters. It expects as input an index of the item the data should be returned for. This is
|
||||
needed because for each item the data returned can be different. This is probably obvious for the
|
||||
item data itself but maybe less for data like parameters. The reason why it is also needed there is
|
||||
that they may contain an expression. Expressions get always executed of the context for an item.
|
||||
If that would not be the case, for example, the Email Send-Node not would be able to send multiple
|
||||
emails at once to different people. Instead, the same person would receive multiple emails.
|
||||
|
||||
That values which are set are by default static and are always the same no matter what data they process. It is however also possible to set the values dynamically with the help of Expressions. With them, it is possible to make the value depending on other factors like the data of flow or parameters of other nodes.
|
||||
The index is 0 based. So `$item(0)` will return the first item, `$item(1)` the second one, ...
|
||||
|
||||
More information about it can be found under [Expressions](#expressions).
|
||||
Example:
|
||||
|
||||
```typescript
|
||||
// Returns the value of the JSON data property "myNumber" of Node "Set" (first item)
|
||||
const myNumber = $item(0).$node["Set"].data["myNumber"];
|
||||
// Like above but data of the 6th item
|
||||
const myNumber = $item(5).$node["Set"].data["myNumber"];
|
||||
|
||||
// Returns the value of the parameter "channel" of Node "Slack".
|
||||
// If it contains an expression the value will be resolved with the
|
||||
// data of the first item.
|
||||
const channel = $item(0).$node["Slack"].parameter["channel"];
|
||||
// Like above but resolved with the value of the 10th item.
|
||||
const channel = $item(9).$node["Slack"].parameter["channel"];
|
||||
```
|
||||
|
||||
|
||||
## Pausing Node
|
||||
#### Variable: $node
|
||||
|
||||
Sometimes when creating and debugging a workflow it is helpful to not execute some specific nodes. To make that as simple as possible and not having to disconnect each node, it is possible to pause them. When a node gets paused the data simple passes through the node without being changed.
|
||||
Works exactly like `$item` with the difference that it will always return the data of the first item.
|
||||
|
||||
There are two ways to pause a node. Either pressing the pause button which gets displayed above the node when hovering over it. Or by selecting the node and pressing “d”.
|
||||
```typescript
|
||||
const myNumber = $node["Set"].data['myNumber'];
|
||||
|
||||
const channel = $node["Slack"].parameter["channel"];
|
||||
```
|
||||
|
||||
|
||||
#### Method: getWorkflowStaticData(type)
|
||||
|
||||
Gives access to the static workflow data.
|
||||
It is possible to save data directly with the workflow. This data should, however, be very small.
|
||||
A common use case is to for example to save a timestamp of the last item that got processed from
|
||||
an RSS-Feed or database. It will always return an object. Properties can then read, deleted or
|
||||
set on that object. When the workflow execution did succeed n8n will check automatically if data
|
||||
changed and will save it if necessary.
|
||||
|
||||
There are two types of static data. The "global" and the "node" one. Global static data is the
|
||||
same in the whole workflow. And every node in the workflow can access it. The node static data
|
||||
, however, is different for every node and only the node which did set it can retrieve it again.
|
||||
|
||||
Example:
|
||||
|
||||
```typescript
|
||||
// Get the global workflow static data
|
||||
const staticData = getWorkflowStaticData('global');
|
||||
// Get the static data of the node
|
||||
const staticData = getWorkflowStaticData('node');
|
||||
|
||||
// Access its data
|
||||
const lastExecution = staticData.lastExecution;
|
||||
|
||||
// Update its data
|
||||
staticData.lastExecution = new Date().getTime();
|
||||
|
||||
// Delete data
|
||||
delete staticData.lastExecution;
|
||||
```
|
||||
|
||||
It is important to know that static data can not be read and written when testing via the UI.
|
||||
The data will there always be empty and changes will not be persisted. Only when a workflow
|
||||
is active and it gets called by a Trigger or Webhook will the static data be saved.
|
||||
|
||||
|
||||
|
||||
### Function Item-Node
|
||||
|
||||
|
||||
#### Variable: item
|
||||
|
||||
It contains the "json" data of the currently processed item.
|
||||
|
||||
The data can be accessed and manipulated like this:
|
||||
|
||||
```json
|
||||
// Uses the data of an already existing key to create a new additional one
|
||||
item.newIncrementedCounter = item.existingCounter + 1;
|
||||
return item;
|
||||
```
|
||||
|
||||
|
||||
#### Method: getBinaryData()
|
||||
|
||||
Returns all the binary data (all keys) of the item which gets currently processed.
|
||||
|
||||
|
||||
#### Method: setBinaryData(binaryData)
|
||||
|
||||
Sets all the binary data (all keys) of the item which gets currently processed.
|
||||
|
||||
|
||||
#### Method: getWorkflowStaticData(type)
|
||||
|
||||
As described above for Function-Node.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "n8n",
|
||||
"version": "0.33.0",
|
||||
"version": "0.34.0",
|
||||
"description": "n8n Workflow Automation Tool",
|
||||
"license": "SEE LICENSE IN LICENSE.md",
|
||||
"homepage": "https://n8n.io",
|
||||
|
@ -90,8 +90,8 @@
|
|||
"localtunnel": "^1.9.1",
|
||||
"mongodb": "^3.2.3",
|
||||
"n8n-core": "~0.14.0",
|
||||
"n8n-editor-ui": "~0.24.0",
|
||||
"n8n-nodes-base": "~0.28.0",
|
||||
"n8n-editor-ui": "~0.25.0",
|
||||
"n8n-nodes-base": "~0.29.0",
|
||||
"n8n-workflow": "~0.15.0",
|
||||
"open": "^6.1.0",
|
||||
"pg": "^7.11.0",
|
||||
|
|
|
@ -220,7 +220,13 @@ export function getNodeParameter(workflow: Workflow, runExecutionData: IRunExecu
|
|||
throw new Error(`Could not get parameter "${parameterName}"!`);
|
||||
}
|
||||
|
||||
const returnData = workflow.getParameterValue(value, runExecutionData, runIndex, itemIndex, node.name, connectionInputData);
|
||||
let returnData;
|
||||
try {
|
||||
returnData = workflow.getParameterValue(value, runExecutionData, runIndex, itemIndex, node.name, connectionInputData);
|
||||
} catch (e) {
|
||||
e.message += ` [Error in parameter: "${parameterName}"]`;
|
||||
throw e;
|
||||
}
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
|
|
@ -159,9 +159,14 @@ export async function getUserSettings(settingsPath?: string, ignoreCache?: boole
|
|||
}
|
||||
|
||||
const settingsFile = await fsReadFile(settingsPath, 'utf8');
|
||||
settingsCache = JSON.parse(settingsFile);
|
||||
|
||||
return JSON.parse(settingsFile) as IUserSettings;
|
||||
try {
|
||||
settingsCache = JSON.parse(settingsFile);
|
||||
} catch (error) {
|
||||
throw new Error(`Error parsing n8n-config file "${settingsPath}". It does not seem to be valid JSON.`);
|
||||
}
|
||||
|
||||
return settingsCache as IUserSettings;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "n8n-editor-ui",
|
||||
"version": "0.24.0",
|
||||
"version": "0.25.0",
|
||||
"description": "Workflow Editor UI for n8n",
|
||||
"license": "SEE LICENSE IN LICENSE.md",
|
||||
"homepage": "https://n8n.io",
|
||||
|
|
25
packages/nodes-base/credentials/FreshdeskApi.credentials.ts
Normal file
25
packages/nodes-base/credentials/FreshdeskApi.credentials.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import {
|
||||
ICredentialType,
|
||||
NodePropertyTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
|
||||
export class FreshdeskApi implements ICredentialType {
|
||||
name = 'freshdeskApi';
|
||||
displayName = 'Freshdesk API';
|
||||
properties = [
|
||||
{
|
||||
displayName: 'API Key',
|
||||
name: 'apiKey',
|
||||
type: 'string' as NodePropertyTypes,
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Domain',
|
||||
name: 'domain',
|
||||
type: 'string' as NodePropertyTypes,
|
||||
placeholder: 'https://domain.freshdesk.com',
|
||||
default: ''
|
||||
}
|
||||
];
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeTypeDescription,
|
||||
|
@ -11,8 +12,39 @@ import {
|
|||
import {
|
||||
activeCampaignApiRequest,
|
||||
activeCampaignApiRequestAllItems,
|
||||
IProduct,
|
||||
} from './GenericFunctions';
|
||||
|
||||
import {
|
||||
contactOperations,
|
||||
contactFields
|
||||
} from './ContactDescription';
|
||||
|
||||
import {
|
||||
dealOperations,
|
||||
dealFields
|
||||
} from './DealDescription';
|
||||
|
||||
import {
|
||||
ecomOrderOperations,
|
||||
ecomOrderFields
|
||||
} from './EcomOrderDescription';
|
||||
|
||||
import {
|
||||
ecomCustomerOperations,
|
||||
ecomCustomerFields
|
||||
} from './EcomCustomerDescription';
|
||||
|
||||
import {
|
||||
ecomOrderProductsOperations,
|
||||
ecomOrderProductsFields
|
||||
} from './EcomOrderProductsDescription';
|
||||
|
||||
import {
|
||||
connectionOperations,
|
||||
connectionFields
|
||||
} from './ConnectionDescription';
|
||||
|
||||
interface CustomProperty {
|
||||
name: string;
|
||||
value: string;
|
||||
|
@ -59,6 +91,9 @@ export class ActiveCampaign implements INodeType {
|
|||
}
|
||||
],
|
||||
properties: [
|
||||
// ----------------------------------
|
||||
// resources
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
|
@ -68,367 +103,73 @@ export class ActiveCampaign implements INodeType {
|
|||
name: 'Contact',
|
||||
value: 'contact',
|
||||
},
|
||||
{
|
||||
name: 'Deal',
|
||||
value: 'deal',
|
||||
},
|
||||
{
|
||||
name: 'Connection',
|
||||
value: 'connection'
|
||||
},
|
||||
{
|
||||
name: 'E-commerce Order',
|
||||
value: 'ecommerceOrder',
|
||||
},
|
||||
{
|
||||
name: 'E-Commerce Customer',
|
||||
value: 'ecommerceCustomer',
|
||||
},
|
||||
{
|
||||
name: 'E-commerce Order Products',
|
||||
value: 'ecommerceOrderProducts'
|
||||
}
|
||||
],
|
||||
default: 'contact',
|
||||
description: 'The resource to operate on.',
|
||||
},
|
||||
|
||||
|
||||
|
||||
// ----------------------------------
|
||||
// operations
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a contact',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a contact',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get data of a contact',
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Get data of all contact',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a contact',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
|
||||
|
||||
...contactOperations,
|
||||
...dealOperations,
|
||||
...connectionOperations,
|
||||
...ecomOrderOperations,
|
||||
...ecomCustomerOperations,
|
||||
...ecomOrderProductsOperations,
|
||||
|
||||
// ----------------------------------
|
||||
// fields
|
||||
// ----------------------------------
|
||||
// ----------------------------------
|
||||
// contact
|
||||
// ----------------------------------
|
||||
...contactFields,
|
||||
|
||||
// ----------------------------------
|
||||
// contact:create
|
||||
// deal
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The email of the contact to create',
|
||||
},
|
||||
{
|
||||
displayName: 'Update if exists',
|
||||
name: 'updateIfExists',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Update user if it exists already. If not set and user exists it will error instead.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'firstName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The first name of the contact to create',
|
||||
},
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'lastName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The last name of the contact to create',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Phone number of the contact.',
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Properties',
|
||||
name: 'customProperties',
|
||||
placeholder: 'Add Custom Property',
|
||||
description: 'Adds a custom property to set also values which have not been predefined.',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
name: 'property',
|
||||
displayName: 'Property',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the property to set.',
|
||||
},
|
||||
{
|
||||
displayName: 'Property Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Value of the property to set.',
|
||||
},
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
...dealFields,
|
||||
|
||||
// ----------------------------------
|
||||
// contact:delete
|
||||
// connection
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 0,
|
||||
required: true,
|
||||
description: 'ID of the contact to delete.',
|
||||
},
|
||||
...connectionFields,
|
||||
|
||||
// ----------------------------------
|
||||
// person:get
|
||||
// ecommerceOrder
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 0,
|
||||
required: true,
|
||||
description: 'ID of the contact to get.',
|
||||
},
|
||||
...ecomOrderFields,
|
||||
|
||||
// ----------------------------------
|
||||
// contact:getAll
|
||||
// ecommerceCustomer
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'If all results should be returned or only up to a given limit.',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 500,
|
||||
},
|
||||
default: 100,
|
||||
description: 'How many results to return.',
|
||||
},
|
||||
...ecomCustomerFields,
|
||||
|
||||
// ----------------------------------
|
||||
// contact:update
|
||||
// ecommerceOrderProducts
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 0,
|
||||
required: true,
|
||||
description: 'ID of the contact to update.',
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
description: 'The fields to update.',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Email of the contact.',
|
||||
},
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'firstName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'First name of the contact',
|
||||
},
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'lastName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Last name of the contact',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Phone number of the contact.',
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Properties',
|
||||
name: 'customProperties',
|
||||
placeholder: 'Add Custom Property',
|
||||
description: 'Adds a custom property to set also values which have not been predefined.',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
name: 'property',
|
||||
displayName: 'Property',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the property to set.',
|
||||
},
|
||||
{
|
||||
displayName: 'Property Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Value of the property to set.',
|
||||
},
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
...ecomOrderProductsFields,
|
||||
|
||||
],
|
||||
};
|
||||
|
@ -477,9 +218,11 @@ export class ActiveCampaign implements INodeType {
|
|||
}
|
||||
|
||||
dataKey = 'contact';
|
||||
|
||||
body.contact = {
|
||||
email: this.getNodeParameter('email', i) as string,
|
||||
} as IDataObject;
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
addAdditionalFields(body.contact as IDataObject, additionalFields);
|
||||
|
||||
|
@ -505,7 +248,7 @@ export class ActiveCampaign implements INodeType {
|
|||
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// persons:getAll
|
||||
// contacts:getAll
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
@ -529,11 +272,417 @@ export class ActiveCampaign implements INodeType {
|
|||
endpoint = `/api/3/contacts/${contactId}`;
|
||||
|
||||
dataKey = 'contact';
|
||||
|
||||
body.contact = {} as IDataObject;
|
||||
|
||||
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||
addAdditionalFields(body.contact as IDataObject, updateFields);
|
||||
|
||||
} else {
|
||||
throw new Error(`The operation "${operation}" is not known`);
|
||||
}
|
||||
} else if (resource === 'deal') {
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// deal:create
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'POST';
|
||||
|
||||
endpoint = '/api/3/deals';
|
||||
|
||||
body.deal = {
|
||||
title: this.getNodeParameter('title', i) as string,
|
||||
contact: this.getNodeParameter('contact', i) as string,
|
||||
value: this.getNodeParameter('value', i) as number,
|
||||
currency: this.getNodeParameter('currency', i) as string,
|
||||
} as IDataObject;
|
||||
|
||||
const group = this.getNodeParameter('group', i) as string;
|
||||
if (group !== '') {
|
||||
addAdditionalFields(body.deal as IDataObject, { group });
|
||||
}
|
||||
|
||||
const owner = this.getNodeParameter('owner', i) as string;
|
||||
if (owner !== '') {
|
||||
addAdditionalFields(body.deal as IDataObject, { owner });
|
||||
}
|
||||
|
||||
const stage = this.getNodeParameter('stage', i) as string;
|
||||
if (stage !== '') {
|
||||
addAdditionalFields(body.deal as IDataObject, { stage });
|
||||
}
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
addAdditionalFields(body.deal as IDataObject, additionalFields);
|
||||
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// deal:update
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'PUT';
|
||||
|
||||
const dealId = this.getNodeParameter('dealId', i) as number;
|
||||
endpoint = `/api/3/deals/${dealId}`;
|
||||
|
||||
body.deal = {} as IDataObject;
|
||||
|
||||
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||
addAdditionalFields(body.deal as IDataObject, updateFields);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// deal:delete
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'DELETE';
|
||||
|
||||
const dealId = this.getNodeParameter('dealId', i) as number;
|
||||
endpoint = `/api/3/deals/${dealId}`;
|
||||
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// deal:get
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
const dealId = this.getNodeParameter('dealId', i) as number;
|
||||
endpoint = `/api/3/deals/${dealId}`;
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// deals:getAll
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
if (returnAll === false) {
|
||||
qs.limit = this.getNodeParameter('limit', i) as number;
|
||||
}
|
||||
|
||||
endpoint = `/api/3/deals`;
|
||||
|
||||
} else if (operation === 'createNote') {
|
||||
// ----------------------------------
|
||||
// deal:createNote
|
||||
// ----------------------------------
|
||||
requestMethod = 'POST';
|
||||
|
||||
body.note = {
|
||||
note: this.getNodeParameter('dealNote', i) as string,
|
||||
} as IDataObject;
|
||||
|
||||
const dealId = this.getNodeParameter('dealId', i) as number;
|
||||
endpoint = `/api/3/deals/${dealId}/notes`;
|
||||
|
||||
} else if (operation === 'updateNote') {
|
||||
// ----------------------------------
|
||||
// deal:updateNote
|
||||
// ----------------------------------
|
||||
requestMethod = 'PUT';
|
||||
|
||||
body.note = {
|
||||
note: this.getNodeParameter('dealNote', i) as string,
|
||||
} as IDataObject;
|
||||
|
||||
const dealId = this.getNodeParameter('dealId', i) as number;
|
||||
const dealNoteId = this.getNodeParameter('dealNoteId', i) as number;
|
||||
endpoint = `/api/3/deals/${dealId}/notes/${dealNoteId}`;
|
||||
|
||||
} else {
|
||||
throw new Error(`The operation "${operation}" is not known`);
|
||||
}
|
||||
} else if (resource === 'connection') {
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// connection:create
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'POST';
|
||||
|
||||
endpoint = '/api/3/connections';
|
||||
|
||||
body.connection = {
|
||||
service: this.getNodeParameter('service', i) as string,
|
||||
externalid: this.getNodeParameter('externalid', i) as string,
|
||||
name: this.getNodeParameter('name', i) as string,
|
||||
logoUrl: this.getNodeParameter('logoUrl', i) as string,
|
||||
linkUrl: this.getNodeParameter('linkUrl', i) as string,
|
||||
} as IDataObject;
|
||||
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// connection:update
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'PUT';
|
||||
|
||||
const connectionId = this.getNodeParameter('connectionId', i) as number;
|
||||
endpoint = `/api/3/connections/${connectionId}`;
|
||||
|
||||
body.connection = {} as IDataObject;
|
||||
|
||||
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||
addAdditionalFields(body.connection as IDataObject, updateFields);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// connection:delete
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'DELETE';
|
||||
|
||||
const connectionId = this.getNodeParameter('connectionId', i) as number;
|
||||
endpoint = `/api/3/connections/${connectionId}`;
|
||||
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// connection:get
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
const connectionId = this.getNodeParameter('connectionId', i) as number;
|
||||
endpoint = `/api/3/connections/${connectionId}`;
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// connections:getAll
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
if (returnAll === false) {
|
||||
qs.limit = this.getNodeParameter('limit', i) as number;
|
||||
}
|
||||
|
||||
endpoint = `/api/3/connections`;
|
||||
|
||||
} else {
|
||||
throw new Error(`The operation "${operation}" is not known`);
|
||||
}
|
||||
} else if (resource === 'ecommerceOrder') {
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// ecommerceOrder:create
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'POST';
|
||||
|
||||
endpoint = '/api/3/ecomOrders';
|
||||
|
||||
body.ecomOrder = {
|
||||
source: this.getNodeParameter('source', i) as string,
|
||||
email: this.getNodeParameter('email', i) as string,
|
||||
totalPrice: this.getNodeParameter('totalPrice', i) as number,
|
||||
currency: this.getNodeParameter('currency', i).toString().toUpperCase() as string,
|
||||
externalCreatedDate: this.getNodeParameter('externalCreatedDate', i) as string,
|
||||
connectionid: this.getNodeParameter('connectionid', i) as number,
|
||||
customerid: this.getNodeParameter('customerid', i) as number,
|
||||
} as IDataObject;
|
||||
|
||||
const externalid = this.getNodeParameter('externalid', i) as string;
|
||||
if (externalid !== '') {
|
||||
addAdditionalFields(body.ecomOrder as IDataObject, { externalid });
|
||||
}
|
||||
|
||||
const externalcheckoutid = this.getNodeParameter('externalcheckoutid', i) as string;
|
||||
if (externalcheckoutid !== '') {
|
||||
addAdditionalFields(body.ecomOrder as IDataObject, { externalcheckoutid });
|
||||
}
|
||||
|
||||
const abandonedDate = this.getNodeParameter('abandonedDate', i) as string;
|
||||
if (abandonedDate !== '') {
|
||||
addAdditionalFields(body.ecomOrder as IDataObject, { abandonedDate });
|
||||
}
|
||||
|
||||
const orderProducts = this.getNodeParameter('orderProducts', i) as unknown as IProduct[];
|
||||
addAdditionalFields(body.ecomOrder as IDataObject, { orderProducts });
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
addAdditionalFields(body.ecomOrder as IDataObject, additionalFields);
|
||||
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// ecommerceOrder:update
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'PUT';
|
||||
|
||||
const orderId = this.getNodeParameter('orderId', i) as number;
|
||||
endpoint = `/api/3/ecomOrders/${orderId}`;
|
||||
|
||||
body.ecomOrder = {} as IDataObject;
|
||||
|
||||
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||
addAdditionalFields(body.ecomOrder as IDataObject, updateFields);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// ecommerceOrder:delete
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'DELETE';
|
||||
|
||||
const orderId = this.getNodeParameter('orderId', i) as number;
|
||||
endpoint = `/api/3/ecomOrders/${orderId}`;
|
||||
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// ecommerceOrder:get
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
const orderId = this.getNodeParameter('orderId', i) as number;
|
||||
endpoint = `/api/3/ecomOrders/${orderId}`;
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// ecommerceOrders:getAll
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
if (returnAll === false) {
|
||||
qs.limit = this.getNodeParameter('limit', i) as number;
|
||||
}
|
||||
|
||||
endpoint = `/api/3/ecomOrders`;
|
||||
|
||||
} else {
|
||||
throw new Error(`The operation "${operation}" is not known`);
|
||||
}
|
||||
} else if (resource === 'ecommerceCustomer') {
|
||||
if (operation === 'create') {
|
||||
// ----------------------------------
|
||||
// ecommerceCustomer:create
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'POST';
|
||||
|
||||
endpoint = '/api/3/ecomCustomers';
|
||||
|
||||
body.ecomCustomer = {
|
||||
connectionid: this.getNodeParameter('connectionid', i) as string,
|
||||
externalid: this.getNodeParameter('externalid', i) as string,
|
||||
email: this.getNodeParameter('email', i) as string,
|
||||
} as IDataObject;
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
if (additionalFields.acceptsMarketing !== undefined) {
|
||||
if (additionalFields.acceptsMarketing === true) {
|
||||
additionalFields.acceptsMarketing = '1';
|
||||
} else {
|
||||
additionalFields.acceptsMarketing = '0';
|
||||
}
|
||||
}
|
||||
addAdditionalFields(body.ecomCustomer as IDataObject, additionalFields);
|
||||
|
||||
} else if (operation === 'update') {
|
||||
// ----------------------------------
|
||||
// ecommerceCustomer:update
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'PUT';
|
||||
|
||||
const ecommerceCustomerId = this.getNodeParameter('ecommerceCustomerId', i) as number;
|
||||
endpoint = `/api/3/ecomCustomers/${ecommerceCustomerId}`;
|
||||
|
||||
body.ecomCustomer = {} as IDataObject;
|
||||
|
||||
const updateFields = this.getNodeParameter('updateFields', i) as IDataObject;
|
||||
if (updateFields.acceptsMarketing !== undefined) {
|
||||
if (updateFields.acceptsMarketing === true) {
|
||||
updateFields.acceptsMarketing = '1';
|
||||
} else {
|
||||
updateFields.acceptsMarketing = '0';
|
||||
}
|
||||
}
|
||||
addAdditionalFields(body.ecomCustomer as IDataObject, updateFields);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// ecommerceCustomer:delete
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'DELETE';
|
||||
|
||||
const ecommerceCustomerId = this.getNodeParameter('ecommerceCustomerId', i) as number;
|
||||
endpoint = `/api/3/ecomCustomers/${ecommerceCustomerId}`;
|
||||
|
||||
} else if (operation === 'get') {
|
||||
// ----------------------------------
|
||||
// ecommerceCustomer:get
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
const ecommerceCustomerId = this.getNodeParameter('ecommerceCustomerId', i) as number;
|
||||
endpoint = `/api/3/ecomCustomers/${ecommerceCustomerId}`;
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// ecommerceCustomers:getAll
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
if (returnAll === false) {
|
||||
qs.limit = this.getNodeParameter('limit', i) as number;
|
||||
}
|
||||
|
||||
endpoint = `/api/3/ecomCustomers`;
|
||||
|
||||
} else {
|
||||
throw new Error(`The operation "${operation}" is not known`);
|
||||
}
|
||||
} else if (resource === 'ecommerceOrderProducts') {
|
||||
if (operation === 'getByProductId') {
|
||||
// ----------------------------------
|
||||
// ecommerceOrderProducts:getByProductId
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
const procuctId = this.getNodeParameter('procuctId', i) as number;
|
||||
endpoint = `/api/3/ecomOrderProducts/${procuctId}`;
|
||||
|
||||
|
||||
} else if (operation === 'getByOrderId') {
|
||||
// ----------------------------------
|
||||
// ecommerceOrderProducts:getByOrderId
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
const orderId = this.getNodeParameter('orderId', i) as number;
|
||||
endpoint = `/api/3/ecomOrders/${orderId}/orderProducts`;
|
||||
|
||||
} else if (operation === 'getAll') {
|
||||
// ----------------------------------
|
||||
// ecommerceOrderProductss:getAll
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
if (returnAll === false) {
|
||||
qs.limit = this.getNodeParameter('limit', i) as number;
|
||||
}
|
||||
|
||||
endpoint = `/api/3/ecomOrderProducts`;
|
||||
|
||||
} else {
|
||||
throw new Error(`The operation "${operation}" is not known`);
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new Error(`The resource "${resource}" is not known!`);
|
||||
}
|
||||
|
@ -554,4 +703,4 @@ export class ActiveCampaign implements INodeType {
|
|||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,322 @@
|
|||
import { INodeProperties } from "n8n-workflow";
|
||||
|
||||
export const connectionOperations = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'connection',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a connection',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a connection',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get data of a connection',
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Get data of all connections',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a connection',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
|
||||
] as INodeProperties[];
|
||||
|
||||
export const connectionFields = [
|
||||
// ----------------------------------
|
||||
// connection:create
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Service',
|
||||
name: 'service',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'connection',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The name of the service.',
|
||||
},
|
||||
{
|
||||
displayName: 'External accout ID',
|
||||
name: 'externalid',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'connection',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The id of the account in the external service.',
|
||||
},
|
||||
{
|
||||
displayName: 'Account Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'connection',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The name associated with the account in the external service. Often this will be a company name (e.g., "My Toystore, Inc.").',
|
||||
},
|
||||
{
|
||||
displayName: 'Logo URL',
|
||||
name: 'logoUrl',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'connection',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The URL to a logo image for the external service.',
|
||||
},
|
||||
{
|
||||
displayName: 'Link URL',
|
||||
name: 'linkUrl',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'connection',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The URL to a page where the integration with the external service can be managed in the third-party\'s website.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// connection:update
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Connection ID',
|
||||
name: 'connectionId',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'connection',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 0,
|
||||
required: true,
|
||||
description: 'ID of the connection to update.',
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
description: 'The fields to update.',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'connection',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Service',
|
||||
name: 'service',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The name of the service.',
|
||||
},
|
||||
{
|
||||
displayName: 'External accout ID',
|
||||
name: 'externalid',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The id of the account in the external service.',
|
||||
},
|
||||
{
|
||||
displayName: 'Account Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The name associated with the account in the external service. Often this will be a company name (e.g., "My Toystore, Inc.").',
|
||||
},
|
||||
{
|
||||
displayName: 'Logo URL',
|
||||
name: 'logoUrl',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The URL to a logo image for the external service.',
|
||||
},
|
||||
{
|
||||
displayName: 'Link URL',
|
||||
name: 'linkUrl',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The URL to a page where the integration with the external service can be managed in the third-party\'s website.',
|
||||
},
|
||||
{
|
||||
displayName: 'Status',
|
||||
name: 'status',
|
||||
type: 'number',
|
||||
default: 1,
|
||||
description: 'The status of the connection (0 = error; 1 = connected)',
|
||||
},
|
||||
{
|
||||
displayName: 'Syncronisation Status',
|
||||
name: 'syncStatus',
|
||||
type: 'number',
|
||||
default: 1,
|
||||
description: 'The status of a sync triggered on the connection (0 = sync stopped; 1 = sync running).',
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// connection:delete
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Connection ID',
|
||||
name: 'connectionId',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: [
|
||||
'connection',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 0,
|
||||
required: true,
|
||||
description: 'ID of the connection to delete.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// connection:get
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Connection ID',
|
||||
name: 'connectionId',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'connection',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 0,
|
||||
required: true,
|
||||
description: 'ID of the connection to get.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// connection:getAll
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'connection',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'If all results should be returned or only up to a given limit.',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'connection',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 500,
|
||||
},
|
||||
default: 100,
|
||||
description: 'How many results to return.',
|
||||
},
|
||||
] as INodeProperties[];
|
351
packages/nodes-base/nodes/ActiveCampaign/ContactDescription.ts
Normal file
351
packages/nodes-base/nodes/ActiveCampaign/ContactDescription.ts
Normal file
|
@ -0,0 +1,351 @@
|
|||
import { INodeProperties } from "n8n-workflow";
|
||||
|
||||
export const contactOperations = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a contact',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a contact',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get data of a contact',
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Get data of all contact',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a contact',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
||||
export const contactFields = [
|
||||
// ----------------------------------
|
||||
// contact:create
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The email of the contact to create.',
|
||||
},
|
||||
{
|
||||
displayName: 'Update if exists',
|
||||
name: 'updateIfExists',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'Update user if it exists already. If not set and user exists it will error instead.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'firstName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The first name of the contact to create.',
|
||||
},
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'lastName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The last name of the contact to create.',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Phone number of the contact.',
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Properties',
|
||||
name: 'customProperties',
|
||||
placeholder: 'Add Custom Property',
|
||||
description: 'Adds a custom property to set also values which have not been predefined.',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
name: 'property',
|
||||
displayName: 'Property',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the property to set.',
|
||||
},
|
||||
{
|
||||
displayName: 'Property Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Value of the property to set.',
|
||||
},
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// contact:update
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 0,
|
||||
required: true,
|
||||
description: 'ID of the contact to update.',
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
description: 'The fields to update.',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Email of the contact.',
|
||||
},
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'firstName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'First name of the contact.',
|
||||
},
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'lastName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Last name of the contact.',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone',
|
||||
name: 'phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Phone number of the contact.',
|
||||
},
|
||||
{
|
||||
displayName: 'Custom Properties',
|
||||
name: 'customProperties',
|
||||
placeholder: 'Add Custom Property',
|
||||
description: 'Adds a custom property to set also values which have not been predefined.',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
name: 'property',
|
||||
displayName: 'Property',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Name of the property to set.',
|
||||
},
|
||||
{
|
||||
displayName: 'Property Value',
|
||||
name: 'value',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Value of the property to set.',
|
||||
},
|
||||
]
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// contact:delete
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 0,
|
||||
required: true,
|
||||
description: 'ID of the contact to delete.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// contact:get
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Contact ID',
|
||||
name: 'contactId',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 0,
|
||||
required: true,
|
||||
description: 'ID of the contact to get.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// contact:getAll
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'If all results should be returned or only up to a given limit.',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'contact',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 500,
|
||||
},
|
||||
default: 100,
|
||||
description: 'How many results to return.',
|
||||
},
|
||||
] as INodeProperties[];
|
529
packages/nodes-base/nodes/ActiveCampaign/DealDescription.ts
Normal file
529
packages/nodes-base/nodes/ActiveCampaign/DealDescription.ts
Normal file
|
@ -0,0 +1,529 @@
|
|||
import { INodeProperties } from "n8n-workflow";
|
||||
|
||||
import { allCurrencies } from './currencies';
|
||||
|
||||
export const dealOperations = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a deal',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a deal',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get data of a deal',
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Get data of all deals',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a deal',
|
||||
},
|
||||
{
|
||||
name: 'Create Note',
|
||||
value: 'createNote',
|
||||
description: 'Create a deal note',
|
||||
},
|
||||
{
|
||||
name: 'Update deal note',
|
||||
value: 'updateNote',
|
||||
description: 'Update a deal note',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
|
||||
] as INodeProperties[];
|
||||
|
||||
export const dealFields = [
|
||||
// ----------------------------------
|
||||
// deal:create
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Title',
|
||||
name: 'title',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The title of the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal\'s contact ID',
|
||||
name: 'contact',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the deal\'s contact',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal value',
|
||||
name: 'value',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The value of the deal in cents',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'currency',
|
||||
type: 'options',
|
||||
default: 'eur',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: allCurrencies,
|
||||
description: 'The currency of the deal in 3-character ISO format',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal pipeline ID',
|
||||
name: 'group',
|
||||
type: 'string',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The pipeline ID of the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal stage ID',
|
||||
name: 'stage',
|
||||
type: 'string',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The stage ID of the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal owner ID',
|
||||
name: 'owner',
|
||||
type: 'string',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The owner ID of the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The description of the deal',
|
||||
},
|
||||
|
||||
{
|
||||
displayName: 'Deal percentage',
|
||||
name: 'percent',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The percentage of the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal status',
|
||||
name: 'status',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The status of the deal',
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// deal:update
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Deal ID',
|
||||
name: 'dealId',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 0,
|
||||
required: true,
|
||||
description: 'ID of the deal to update.',
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
description: 'The fields to update.',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Title',
|
||||
name: 'title',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The title of the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal\'s contact ID',
|
||||
name: 'contact',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The ID of the deal\'s contact',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal value',
|
||||
name: 'value',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The value of the deal in cents',
|
||||
},
|
||||
{
|
||||
displayName: 'Currency',
|
||||
name: 'currency',
|
||||
type: 'options',
|
||||
options: allCurrencies,
|
||||
default: 'eur',
|
||||
description: 'The currency of the deal in 3-character ISO format',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The description of the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal pipeline ID',
|
||||
name: 'group',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The pipeline ID of the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal stage ID',
|
||||
name: 'stage',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The stage ID of the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal owner ID',
|
||||
name: 'owner',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The owner ID of the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal percentage',
|
||||
name: 'percent',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The percentage of the deal',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal status',
|
||||
name: 'status',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The status of the deal',
|
||||
},
|
||||
]
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// deal:delete
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Deal ID',
|
||||
name: 'dealId',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the deal to delete.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// deal:get
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Deal ID',
|
||||
name: 'dealId',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the deal to get.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// deal:getAll
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'If all results should be returned or only up to a given limit.',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 500,
|
||||
},
|
||||
default: 100,
|
||||
description: 'How many results to return.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// dealNote:create
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Deal ID',
|
||||
name: 'dealId',
|
||||
type: 'number',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'createNote',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the deal note',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal Note',
|
||||
name: 'dealNote',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'createNote',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The content of the deal note',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// dealNote:update
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Deal ID',
|
||||
name: 'dealId',
|
||||
type: 'number',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'updateNote',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the deal note',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal note ID',
|
||||
name: 'dealNoteId',
|
||||
type: 'number',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'updateNote',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the deal note',
|
||||
},
|
||||
{
|
||||
displayName: 'Deal Note',
|
||||
name: 'dealNote',
|
||||
type: 'string',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'updateNote',
|
||||
],
|
||||
resource: [
|
||||
'deal',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The content of the deal note',
|
||||
},
|
||||
|
||||
] as INodeProperties[];
|
|
@ -0,0 +1,290 @@
|
|||
import { INodeProperties } from "n8n-workflow";
|
||||
|
||||
export const ecomCustomerOperations = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ecommerceCustomer',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a E-commerce Customer',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a E-commerce Customer',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get data of a E-commerce Customer',
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Get data of all E-commerce Customer',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a E-commerce Customer',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
||||
export const ecomCustomerFields = [
|
||||
// ----------------------------------
|
||||
// ecommerceCustomer:create
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Service ID',
|
||||
name: 'connectionid',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceCustomer',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The id of the connection object for the service where the customer originates.',
|
||||
},
|
||||
{
|
||||
displayName: 'Customer ID',
|
||||
name: 'externalid',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceCustomer',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The id of the customer in the external service.',
|
||||
},
|
||||
{
|
||||
displayName: 'Customer Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceCustomer',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The email address of the customer.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceCustomer',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Accepts Marketing',
|
||||
name: 'acceptsMarketing',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Indication of whether customer has opt-ed in to marketing communications.',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// ecommerceCustomer:update
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Customer ID',
|
||||
name: 'ecommerceCustomerId',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceCustomer',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 0,
|
||||
required: true,
|
||||
description: 'ID of the E-commerce customer to update.',
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
description: 'The fields to update.',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceCustomer',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Service ID',
|
||||
name: 'connectionid',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The id of the connection object for the service where the customer originates.',
|
||||
},
|
||||
{
|
||||
displayName: 'Customer ID',
|
||||
name: 'externalid',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The id of the customer in the external service.',
|
||||
},
|
||||
{
|
||||
displayName: 'Customer Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The email address of the customer.',
|
||||
},
|
||||
{
|
||||
displayName: 'Accepts Marketing',
|
||||
name: 'acceptsMarketing',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Indication of whether customer has opt-ed in to marketing communications.',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// ecommerceCustomer:delete
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Customer ID',
|
||||
name: 'ecommerceCustomerId',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceCustomer',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 0,
|
||||
required: true,
|
||||
description: 'ID of the E-commerce customer to delete.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// ecommerceCustomer:get
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Customer ID',
|
||||
name: 'ecommerceCustomerId',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceCustomer',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 0,
|
||||
required: true,
|
||||
description: 'ID of the E-commerce customer to get.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// ecommerceCustomer:getAll
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceCustomer',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'If all results should be returned or only up to a given limit.',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceCustomer',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 500,
|
||||
},
|
||||
default: 100,
|
||||
description: 'How many results to return.',
|
||||
},
|
||||
] as INodeProperties[];
|
716
packages/nodes-base/nodes/ActiveCampaign/EcomOrderDescription.ts
Normal file
716
packages/nodes-base/nodes/ActiveCampaign/EcomOrderDescription.ts
Normal file
|
@ -0,0 +1,716 @@
|
|||
import { INodeProperties } from "n8n-workflow";
|
||||
|
||||
import { allCurrencies } from './currencies';
|
||||
|
||||
export const ecomOrderOperations = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a order',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a order',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get data of a order',
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Get data of all orders',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a order',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
||||
export const ecomOrderFields = [
|
||||
// ----------------------------------
|
||||
// ecommerceOrder:create
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'External ID',
|
||||
name: 'externalid',
|
||||
type: 'string',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The id of the order in the external service. ONLY REQUIRED IF EXTERNALCHECKOUTID NOT INCLUDED',
|
||||
},
|
||||
{
|
||||
displayName: 'External checkout ID',
|
||||
name: 'externalcheckoutid',
|
||||
type: 'string',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The id of the cart in the external service. ONLY REQUIRED IF EXTERNALID IS NOT INCLUDED.',
|
||||
},
|
||||
{
|
||||
displayName: 'Order source',
|
||||
name: 'source',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The order source code (0 - will not trigger automations, 1 - will trigger automations).',
|
||||
},
|
||||
{
|
||||
displayName: 'Customer Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The email address of the customer who placed the order.',
|
||||
},
|
||||
{
|
||||
displayName: 'Total price',
|
||||
name: 'totalPrice',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The total price of the order in cents, including tax and shipping charges. (i.e. $456.78 => 45678). Must be greater than or equal to zero.',
|
||||
},
|
||||
{
|
||||
displayName: 'Order currency',
|
||||
name: 'currency',
|
||||
type: 'options',
|
||||
default: 'eur',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: allCurrencies,
|
||||
description: 'The currency of the order (3-digit ISO code, e.g., "USD").',
|
||||
},
|
||||
{
|
||||
displayName: 'Connection ID',
|
||||
name: 'connectionid',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The id of the connection from which this order originated.',
|
||||
},
|
||||
{
|
||||
displayName: 'Customer ID',
|
||||
name: 'customerid',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The id of the customer associated with this order.',
|
||||
},
|
||||
{
|
||||
displayName: 'Creation Date',
|
||||
name: 'externalCreatedDate',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The date the order was placed.',
|
||||
},
|
||||
{
|
||||
displayName: 'Abandoning Date',
|
||||
name: 'abandonedDate',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The date the cart was abandoned. REQUIRED ONLY IF INCLUDING EXTERNALCHECKOUTID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Products',
|
||||
name: 'orderProducts',
|
||||
type: 'collection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
multipleValueButtonText: 'Add product',
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create'
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
description: 'All ordered products',
|
||||
placeholder: 'Add product field',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The name of the product',
|
||||
},
|
||||
{
|
||||
displayName: 'Price',
|
||||
name: 'price',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The price of the product, in cents. (i.e. $456.78 => 45678). Must be greater than or equal to zero.',
|
||||
},
|
||||
{
|
||||
displayName: 'Product Quantity',
|
||||
name: 'quantity',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The quantity ordered.',
|
||||
},
|
||||
{
|
||||
displayName: 'Product external ID',
|
||||
name: 'externalid',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The id of the product in the external service.',
|
||||
},
|
||||
{
|
||||
displayName: 'Product Category',
|
||||
name: 'category',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The category of the product.',
|
||||
},
|
||||
{
|
||||
displayName: 'SKU',
|
||||
name: 'sku',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The SKU for the product.',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The description of the product.',
|
||||
},
|
||||
{
|
||||
displayName: 'Image URL',
|
||||
name: 'imageUrl',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'An Image URL that displays an image of the product.',
|
||||
},
|
||||
{
|
||||
displayName: 'Product URL',
|
||||
name: 'productUrl',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'A URL linking to the product in your store.',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Shipping Amount',
|
||||
name: 'shippingAmount',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The total shipping amount for the order in cents .',
|
||||
},
|
||||
|
||||
{
|
||||
displayName: 'Tax Amount',
|
||||
name: 'taxAmount',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The total tax amount for the order in cents.',
|
||||
},
|
||||
{
|
||||
displayName: 'Discount Amount',
|
||||
name: 'discountAmount',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The total discount amount for the order in cents.',
|
||||
},
|
||||
{
|
||||
displayName: 'Order URL',
|
||||
name: 'orderUrl',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The URL for the order in the external service.',
|
||||
},
|
||||
{
|
||||
displayName: 'External updated date',
|
||||
name: 'externalUpdatedDate',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'The date the order was updated.',
|
||||
},
|
||||
{
|
||||
displayName: 'Shipping Method',
|
||||
name: 'shippingMethod',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The shipping method of the order.',
|
||||
},
|
||||
{
|
||||
displayName: 'Order Number',
|
||||
name: 'orderNumber',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The order number. This can be different than the externalid.',
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// ecommerceOrder:update
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Order ID',
|
||||
name: 'orderId',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The id of the e-commerce order.',
|
||||
},
|
||||
|
||||
{
|
||||
displayName: 'Add Field',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'External ID',
|
||||
name: 'externalid',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The id of the order in the external service. ONLY REQUIRED IF EXTERNALCHECKOUTID NOT INCLUDED',
|
||||
},
|
||||
{
|
||||
displayName: 'External checkout ID',
|
||||
name: 'externalcheckoutid',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The id of the cart in the external service. ONLY REQUIRED IF EXTERNALID IS NOT INCLUDED.',
|
||||
},
|
||||
{
|
||||
displayName: 'Order source',
|
||||
name: 'source',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The order source code (0 - will not trigger automations, 1 - will trigger automations).',
|
||||
},
|
||||
{
|
||||
displayName: 'Customer Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The email address of the customer who placed the order.',
|
||||
},
|
||||
{
|
||||
displayName: 'Total price',
|
||||
name: 'totalPrice',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The total price of the order in cents, including tax and shipping charges. (i.e. $456.78 => 45678). Must be greater than or equal to zero.',
|
||||
},
|
||||
{
|
||||
displayName: 'Order currency',
|
||||
name: 'currency',
|
||||
type: 'options',
|
||||
default: 'eur',
|
||||
options: allCurrencies,
|
||||
description: 'The currency of the order (3-digit ISO code, e.g., "USD").',
|
||||
},
|
||||
{
|
||||
displayName: 'Connection ID',
|
||||
name: 'connectionid',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The id of the connection from which this order originated.',
|
||||
},
|
||||
{
|
||||
displayName: 'Customer ID',
|
||||
name: 'customerid',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The id of the customer associated with this order.',
|
||||
},
|
||||
{
|
||||
displayName: 'Creation Date',
|
||||
name: 'externalupdatedDate',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'The date the order was placed.',
|
||||
},
|
||||
{
|
||||
displayName: 'Abandoning Date',
|
||||
name: 'abandonedDate',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'The date the cart was abandoned. REQUIRED ONLY IF INCLUDING EXTERNALCHECKOUTID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Shipping Amount',
|
||||
name: 'shippingAmount',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The total shipping amount for the order in cents .',
|
||||
},
|
||||
|
||||
{
|
||||
displayName: 'Tax Amount',
|
||||
name: 'taxAmount',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The total tax amount for the order in cents.',
|
||||
},
|
||||
{
|
||||
displayName: 'Discount Amount',
|
||||
name: 'discountAmount',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The total discount amount for the order in cents.',
|
||||
},
|
||||
{
|
||||
displayName: 'Order URL',
|
||||
name: 'orderUrl',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The URL for the order in the external service.',
|
||||
},
|
||||
{
|
||||
displayName: 'External updated date',
|
||||
name: 'externalUpdatedDate',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'The date the order was updated.',
|
||||
},
|
||||
{
|
||||
displayName: 'Shipping Method',
|
||||
name: 'shippingMethod',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The shipping method of the order.',
|
||||
},
|
||||
{
|
||||
displayName: 'Order Number',
|
||||
name: 'orderNumber',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The order number. This can be different than the externalid.',
|
||||
},
|
||||
|
||||
{
|
||||
displayName: 'Products',
|
||||
name: 'orderProducts',
|
||||
type: 'collection',
|
||||
typeOptions: {
|
||||
multipleValues: true,
|
||||
multipleValueButtonText: 'Add product',
|
||||
},
|
||||
default: {},
|
||||
description: 'All ordered products',
|
||||
placeholder: 'Add product field',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The name of the product',
|
||||
},
|
||||
{
|
||||
displayName: 'Price',
|
||||
name: 'price',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The price of the product, in cents. (i.e. $456.78 => 45678). Must be greater than or equal to zero.',
|
||||
},
|
||||
{
|
||||
displayName: 'Product Quantity',
|
||||
name: 'quantity',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
description: 'The quantity ordered.',
|
||||
},
|
||||
{
|
||||
displayName: 'Product external ID',
|
||||
name: 'externalid',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The id of the product in the external service.',
|
||||
},
|
||||
{
|
||||
displayName: 'Product Category',
|
||||
name: 'category',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The category of the product.',
|
||||
},
|
||||
{
|
||||
displayName: 'SKU',
|
||||
name: 'sku',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The SKU for the product.',
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The description of the product.',
|
||||
},
|
||||
{
|
||||
displayName: 'Image URL',
|
||||
name: 'imageUrl',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'An Image URL that displays an image of the product.',
|
||||
},
|
||||
{
|
||||
displayName: 'Product URL',
|
||||
name: 'productUrl',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'A URL linking to the product in your store.',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// ecommerceOrder:delete
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Order ID',
|
||||
name: 'orderId',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The id of the e-commerce order.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// ecommerceOrder:get
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Order ID',
|
||||
name: 'orderId',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The id of the e-commerce order.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// ecommerceOrder:getAll
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'If all results should be returned or only up to a given limit.',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrder',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 500,
|
||||
},
|
||||
default: 100,
|
||||
description: 'How many results to return.',
|
||||
},
|
||||
] as INodeProperties[];
|
|
@ -0,0 +1,124 @@
|
|||
import { INodeProperties } from "n8n-workflow";
|
||||
|
||||
export const ecomOrderProductsOperations = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ecommerceOrderProducts',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Get data of all order products',
|
||||
},
|
||||
{
|
||||
name: 'Get by Product ID',
|
||||
value: 'getByProductId',
|
||||
description: 'Get data of a ordered product',
|
||||
},
|
||||
{
|
||||
name: 'Get by Order ID',
|
||||
value: 'getByOrderId',
|
||||
description: 'Get data of an order\'s products',
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
||||
export const ecomOrderProductsFields = [
|
||||
// ----------------------------------
|
||||
// ecommerceOrderProducts:getByOrderId
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Order ID',
|
||||
name: 'orderId',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getByOrderId',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrderProducts',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the order whose products you\'d like returned.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// ecommerceOrderProducts:getByProductId
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Product ID',
|
||||
name: 'procuctId',
|
||||
type: 'number',
|
||||
default: 0,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getByProductId',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrderProducts',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the product you\'d like returned.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// ecommerceOrderProducts:getAll
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrderProducts',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
description: 'If all results should be returned or only up to a given limit.',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'ecommerceOrderProducts',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 500,
|
||||
},
|
||||
default: 100,
|
||||
description: 'How many results to return.',
|
||||
},
|
||||
] as INodeProperties[];
|
|
@ -9,6 +9,12 @@ import {
|
|||
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
export interface IProduct {
|
||||
fields: {
|
||||
item?: object[];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make an API request to ActiveCampaign
|
||||
|
@ -99,10 +105,14 @@ export async function activeCampaignApiRequestAllItems(this: IHookFunctions | IE
|
|||
|
||||
if (dataKey === undefined) {
|
||||
returnData.push.apply(returnData, responseData);
|
||||
itemsReceived += returnData.length;
|
||||
if (returnData !== undefined) {
|
||||
itemsReceived += returnData.length;
|
||||
}
|
||||
} else {
|
||||
returnData.push.apply(returnData, responseData[dataKey]);
|
||||
itemsReceived += responseData[dataKey].length;
|
||||
if (responseData[dataKey] !== undefined) {
|
||||
itemsReceived += responseData[dataKey].length;
|
||||
}
|
||||
}
|
||||
|
||||
query.offset = itemsReceived;
|
||||
|
|
173
packages/nodes-base/nodes/ActiveCampaign/currencies.ts
Normal file
173
packages/nodes-base/nodes/ActiveCampaign/currencies.ts
Normal file
|
@ -0,0 +1,173 @@
|
|||
export const allCurrencies = [
|
||||
{ name: 'Euro', value: 'eur' },
|
||||
{ name: 'United States Dollar', value: 'usd' },
|
||||
{ name: 'British Pound Sterling', value: 'gbp' },
|
||||
{ name: 'Swiss Franc', value: 'chf' },
|
||||
{ name: 'Renminbi', value: 'cny' },
|
||||
{ name: '--------', value: '' },
|
||||
{ name: 'United Arab Emirates Dirham', value: 'aed' },
|
||||
{ name: 'Afghan Afghani', value: 'afn' },
|
||||
{ name: 'Albanian Lek', value: 'all' },
|
||||
{ name: 'Armenian Dram', value: 'amd' },
|
||||
{ name: 'Netherlands Antillean Guilder', value: 'ang' },
|
||||
{ name: 'Angolan Kwanza', value: 'aoa' },
|
||||
{ name: 'Argentine Peso', value: 'ars' },
|
||||
{ name: 'Australian Dollar', value: 'aud' },
|
||||
{ name: 'Aruban Florin', value: 'awg' },
|
||||
{ name: 'Azerbaijani Manat', value: 'azn' },
|
||||
{ name: 'Bosnia-Herzegovina Convertible Mark', value: 'bam' },
|
||||
{ name: 'Barbadian Dollar', value: 'bbd' },
|
||||
{ name: 'Bangladeshi Taka', value: 'bdt' },
|
||||
{ name: 'Bulgarian Lev', value: 'bgn' },
|
||||
{ name: 'Bahraini Dinar', value: 'bhd' },
|
||||
{ name: 'Burundian Franc', value: 'bif' },
|
||||
{ name: 'Bermudan Dollar', value: 'bmd' },
|
||||
{ name: 'Brunei Dollar', value: 'bnd' },
|
||||
{ name: 'Bolivian Boliviano', value: 'bob' },
|
||||
{ name: 'Brazilian Real', value: 'brl' },
|
||||
{ name: 'Bahamian Dollar', value: 'bsd' },
|
||||
{ name: 'Bitcoin', value: 'btc' },
|
||||
{ name: 'Bhutanese Ngultrum', value: 'btn' },
|
||||
{ name: 'Botswanan Pula', value: 'bwp' },
|
||||
{ name: 'Belarusian Ruble', value: 'byn' },
|
||||
{ name: 'Belize Dollar', value: 'bzd' },
|
||||
{ name: 'Canadian Dollar', value: 'cad' },
|
||||
{ name: 'Congolese Franc', value: 'cdf' },
|
||||
{ name: 'Chilean Unit of Account (UF)', value: 'clf' },
|
||||
{ name: 'Chilean Peso', value: 'clp' },
|
||||
{ name: 'Chinese Yuan (Offshore)', value: 'cnh' },
|
||||
{ name: 'Colombian Peso', value: 'cop' },
|
||||
{ name: 'Costa Rican Colón', value: 'crc' },
|
||||
{ name: 'Cuban Convertible Peso', value: 'cuc' },
|
||||
{ name: 'Cuban Peso', value: 'cup' },
|
||||
{ name: 'Cape Verdean Escudo', value: 'cve' },
|
||||
{ name: 'Czech Republic Koruna', value: 'czk' },
|
||||
{ name: 'Djiboutian Franc', value: 'djf' },
|
||||
{ name: 'Danish Krone', value: 'dkk' },
|
||||
{ name: 'Dominican Peso', value: 'dop' },
|
||||
{ name: 'Algerian Dinar', value: 'dzd' },
|
||||
{ name: 'Egyptian Pound', value: 'egp' },
|
||||
{ name: 'Eritrean Nakfa', value: 'ern' },
|
||||
{ name: 'Ethiopian Birr', value: 'etb' },
|
||||
{ name: 'Fijian Dollar', value: 'fjd' },
|
||||
{ name: 'Falkland Islands Pound', value: 'fkp' },
|
||||
{ name: 'Georgian Lari', value: 'gel' },
|
||||
{ name: 'Guernsey Pound', value: 'ggp' },
|
||||
{ name: 'Ghanaian Cedi', value: 'ghs' },
|
||||
{ name: 'Gibraltar Pound', value: 'gip' },
|
||||
{ name: 'Gambian Dalasi', value: 'gmd' },
|
||||
{ name: 'Guinean Franc', value: 'gnf' },
|
||||
{ name: 'Guatemalan Quetzal', value: 'gtq' },
|
||||
{ name: 'Guyanaese Dollar', value: 'gyd' },
|
||||
{ name: 'Hong Kong Dollar', value: 'hkd' },
|
||||
{ name: 'Honduran Lempira', value: 'hnl' },
|
||||
{ name: 'Croatian Kuna', value: 'hrk' },
|
||||
{ name: 'Haitian Gourde', value: 'htg' },
|
||||
{ name: 'Hungarian Forint', value: 'huf' },
|
||||
{ name: 'Indonesian Rupiah', value: 'idr' },
|
||||
{ name: 'Israeli New Sheqel', value: 'ils' },
|
||||
{ name: 'Manx pound', value: 'imp' },
|
||||
{ name: 'Indian Rupee', value: 'inr' },
|
||||
{ name: 'Iraqi Dinar', value: 'iqd' },
|
||||
{ name: 'Iranian Rial', value: 'irr' },
|
||||
{ name: 'Icelandic Króna', value: 'isk' },
|
||||
{ name: 'Jersey Pound', value: 'jep' },
|
||||
{ name: 'Jamaican Dollar', value: 'jmd' },
|
||||
{ name: 'Jordanian Dinar', value: 'jod' },
|
||||
{ name: 'Japanese Yen', value: 'jpy' },
|
||||
{ name: 'Kenyan Shilling', value: 'kes' },
|
||||
{ name: 'Kyrgystani Som', value: 'kgs' },
|
||||
{ name: 'Cambodian Riel', value: 'khr' },
|
||||
{ name: 'Comorian Franc', value: 'kmf' },
|
||||
{ name: 'North Korean Won', value: 'kpw' },
|
||||
{ name: 'South Korean Won', value: 'krw' },
|
||||
{ name: 'Kuwaiti Dinar', value: 'kwd' },
|
||||
{ name: 'Cayman Islands Dollar', value: 'kyd' },
|
||||
{ name: 'Kazakhstani Tenge', value: 'kzt' },
|
||||
{ name: 'Laotian Kip', value: 'lak' },
|
||||
{ name: 'Lebanese Pound', value: 'lbp' },
|
||||
{ name: 'Sri Lankan Rupee', value: 'lkr' },
|
||||
{ name: 'Liberian Dollar', value: 'lrd' },
|
||||
{ name: 'Lesotho Loti', value: 'lsl' },
|
||||
{ name: 'Libyan Dinar', value: 'lyd' },
|
||||
{ name: 'Moroccan Dirham', value: 'mad' },
|
||||
{ name: 'Moldovan Leu', value: 'mdl' },
|
||||
{ name: 'Malagasy Ariary', value: 'mga' },
|
||||
{ name: 'Macedonian Denar', value: 'mkd' },
|
||||
{ name: 'Myanma Kyat', value: 'mmk' },
|
||||
{ name: 'Mongolian Tugrik', value: 'mnt' },
|
||||
{ name: 'Macanese Pataca', value: 'mop' },
|
||||
{ name: 'Mauritanian Ouguiya (pre-2018)', value: 'mro' },
|
||||
{ name: 'Mauritanian Ouguiya', value: 'mru' },
|
||||
{ name: 'Mauritian Rupee', value: 'mur' },
|
||||
{ name: 'Maldivian Rufiyaa', value: 'mvr' },
|
||||
{ name: 'Malawian Kwacha', value: 'mwk' },
|
||||
{ name: 'Mexican Peso', value: 'mxn' },
|
||||
{ name: 'Malaysian Ringgit', value: 'myr' },
|
||||
{ name: 'Mozambican Metical', value: 'mzn' },
|
||||
{ name: 'Namibian Dollar', value: 'nad' },
|
||||
{ name: 'Nigerian Naira', value: 'ngn' },
|
||||
{ name: 'Nicaraguan Córdoba', value: 'nio' },
|
||||
{ name: 'Norwegian Krone', value: 'nok' },
|
||||
{ name: 'Nepalese Rupee', value: 'npr' },
|
||||
{ name: 'New Zealand Dollar', value: 'nzd' },
|
||||
{ name: 'Omani Rial', value: 'omr' },
|
||||
{ name: 'Panamanian Balboa', value: 'pab' },
|
||||
{ name: 'Peruvian Nuevo Sol', value: 'pen' },
|
||||
{ name: 'Papua New Guinean Kina', value: 'pgk' },
|
||||
{ name: 'Philippine Peso', value: 'php' },
|
||||
{ name: 'Pakistani Rupee', value: 'pkr' },
|
||||
{ name: 'Polish Zloty', value: 'pln' },
|
||||
{ name: 'Paraguayan Guarani', value: 'pyg' },
|
||||
{ name: 'Qatari Rial', value: 'qar' },
|
||||
{ name: 'Romanian Leu', value: 'ron' },
|
||||
{ name: 'Serbian Dinar', value: 'rsd' },
|
||||
{ name: 'Russian Ruble', value: 'rub' },
|
||||
{ name: 'Rwandan Franc', value: 'rwf' },
|
||||
{ name: 'Saudi Riyal', value: 'sar' },
|
||||
{ name: 'Solomon Islands Dollar', value: 'sbd' },
|
||||
{ name: 'Seychellois Rupee', value: 'scr' },
|
||||
{ name: 'Sudanese Pound', value: 'sdg' },
|
||||
{ name: 'Swedish Krona', value: 'sek' },
|
||||
{ name: 'Singapore Dollar', value: 'sgd' },
|
||||
{ name: 'Saint Helena Pound', value: 'shp' },
|
||||
{ name: 'Sierra Leonean Leone', value: 'sll' },
|
||||
{ name: 'Somali Shilling', value: 'sos' },
|
||||
{ name: 'Surinamese Dollar', value: 'srd' },
|
||||
{ name: 'South Sudanese Pound', value: 'ssp' },
|
||||
{ name: 'São Tomé and Príncipe Dobra (pre-2018)', value: 'std' },
|
||||
{ name: 'São Tomé and Príncipe Dobra', value: 'stn' },
|
||||
{ name: 'Salvadoran Colón', value: 'svc' },
|
||||
{ name: 'Syrian Pound', value: 'syp' },
|
||||
{ name: 'Swazi Lilangeni', value: 'szl' },
|
||||
{ name: 'Thai Baht', value: 'thb' },
|
||||
{ name: 'Tajikistani Somoni', value: 'tjs' },
|
||||
{ name: 'Turkmenistani Manat', value: 'tmt' },
|
||||
{ name: 'Tunisian Dinar', value: 'tnd' },
|
||||
{ name: "Tongan Pa'anga", value: 'top' },
|
||||
{ name: 'Turkish Lira', value: 'try' },
|
||||
{ name: 'Trinidad and Tobago Dollar', value: 'ttd' },
|
||||
{ name: 'New Taiwan Dollar', value: 'twd' },
|
||||
{ name: 'Tanzanian Shilling', value: 'tzs' },
|
||||
{ name: 'Ukrainian Hryvnia', value: 'uah' },
|
||||
{ name: 'Ugandan Shilling', value: 'ugx' },
|
||||
{ name: 'Uruguayan Peso', value: 'uyu' },
|
||||
{ name: 'Uzbekistan Som', value: 'uzs' },
|
||||
{ name: 'Venezuelan Bolívar Fuerte', value: 'vef' },
|
||||
{ name: 'Vietnamese Dong', value: 'vnd' },
|
||||
{ name: 'Vanuatu Vatu', value: 'vuv' },
|
||||
{ name: 'Samoan Tala', value: 'wst' },
|
||||
{ name: 'CFA Franc BEAC', value: 'xaf' },
|
||||
{ name: 'Silver Ounce', value: 'xag' },
|
||||
{ name: 'Gold Ounce', value: 'xau' },
|
||||
{ name: 'East Caribbean Dollar', value: 'xcd' },
|
||||
{ name: 'Special Drawing Rights', value: 'xdr' },
|
||||
{ name: 'CFA Franc BCEAO', value: 'xof' },
|
||||
{ name: 'Palladium Ounce', value: 'xpd' },
|
||||
{ name: 'CFP Franc', value: 'xpf' },
|
||||
{ name: 'Platinum Ounce', value: 'xpt' },
|
||||
{ name: 'Yemeni Rial', value: 'yer' },
|
||||
{ name: 'South African Rand', value: 'zar' },
|
||||
{ name: 'Zambian Kwacha', value: 'zmw' },
|
||||
{ name: 'Zimbabwean Dollar', value: 'zwl' }
|
||||
];
|
786
packages/nodes-base/nodes/Freshdesk/Freshdesk.node.ts
Normal file
786
packages/nodes-base/nodes/Freshdesk/Freshdesk.node.ts
Normal file
|
@ -0,0 +1,786 @@
|
|||
import {
|
||||
IExecuteSingleFunctions,
|
||||
} from 'n8n-core';
|
||||
import {
|
||||
IDataObject,
|
||||
INodeTypeDescription,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
ILoadOptionsFunctions,
|
||||
INodePropertyOptions,
|
||||
} from 'n8n-workflow';
|
||||
import {
|
||||
freshdeskApiRequest,
|
||||
validateJSON,
|
||||
capitalize
|
||||
} from './GenericFunctions';
|
||||
|
||||
enum Status {
|
||||
Open = 2,
|
||||
Pending = 3,
|
||||
Resolved = 4,
|
||||
Closed = 5,
|
||||
}
|
||||
|
||||
enum Priority {
|
||||
Low = 1,
|
||||
Medium = 2,
|
||||
High = 3,
|
||||
Urgent = 4
|
||||
}
|
||||
|
||||
enum Source {
|
||||
Email = 1,
|
||||
Portal = 2,
|
||||
Phone = 3,
|
||||
Chat = 7,
|
||||
Mobihelp = 8,
|
||||
FeedbackWidget = 9,
|
||||
OutboundEmail = 10
|
||||
}
|
||||
|
||||
interface ICreateTicketBody {
|
||||
name?: string;
|
||||
requester_id?: number;
|
||||
email?: string;
|
||||
facebook_id?: string;
|
||||
phone?: string;
|
||||
twitter_id?: string;
|
||||
unique_external_id?: string;
|
||||
subject?: string | null;
|
||||
type?: string;
|
||||
status: Status;
|
||||
priority: Priority;
|
||||
description?: string;
|
||||
responder_id?: number;
|
||||
cc_emails?: [string];
|
||||
custom_fields?: IDataObject;
|
||||
due_by?: string;
|
||||
email_config_id?: number;
|
||||
fr_due_by?: string;
|
||||
group_id?: number;
|
||||
product_id?: number;
|
||||
source: Source;
|
||||
tags?: [string];
|
||||
company_id?: number;
|
||||
}
|
||||
|
||||
export class Freshdesk implements INodeType {
|
||||
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Freshdesk',
|
||||
name: 'freshdesk',
|
||||
icon: 'file:freshdesk.png',
|
||||
group: ['output'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: 'Consume Freshdesk API',
|
||||
defaults: {
|
||||
name: 'Freshdesk',
|
||||
color: '#c02428',
|
||||
},
|
||||
inputs: ['main'],
|
||||
outputs: ['main'],
|
||||
credentials: [
|
||||
{
|
||||
name: 'freshdeskApi',
|
||||
required: true,
|
||||
}
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
required: true,
|
||||
options: [
|
||||
{
|
||||
name: 'Ticket',
|
||||
value: 'ticket',
|
||||
},
|
||||
],
|
||||
default: 'ticket',
|
||||
description: 'The resource to operate on.',
|
||||
},
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
]
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a new ticket',
|
||||
}
|
||||
],
|
||||
default: 'create',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
{
|
||||
displayName: 'Requester Identification',
|
||||
name: 'requester',
|
||||
type: 'options',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'create'
|
||||
]
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Requester Id',
|
||||
value: 'requesterId',
|
||||
description: `User ID of the requester. For existing contacts, the requester_id can be passed instead of the requester's email.`,
|
||||
},
|
||||
{
|
||||
name: 'Email',
|
||||
value: 'email',
|
||||
description: `Email address of the requester. If no contact exists with this email address in Freshdesk, it will be added as a new contact.`,
|
||||
},
|
||||
{
|
||||
name: 'Facebook Id',
|
||||
value: 'facebookId',
|
||||
description: `Facebook ID of the requester. If no contact exists with this facebook_id, then a new contact will be created.`,
|
||||
},
|
||||
{
|
||||
name: 'Phone',
|
||||
value: 'phone',
|
||||
description: `Phone number of the requester. If no contact exists with this phone number in Freshdesk, it will be added as a new contact. If the phone number is set and the email address is not, then the name attribute is mandatory.`,
|
||||
},
|
||||
{
|
||||
name: 'Twitter Id',
|
||||
value: 'twitterId',
|
||||
description: `Twitter handle of the requester. If no contact exists with this handle in Freshdesk, it will be added as a new contact.`,
|
||||
},
|
||||
{
|
||||
name: 'Unique External Id',
|
||||
value: 'uniqueExternalId',
|
||||
description: `External ID of the requester. If no contact exists with this external ID in Freshdesk, they will be added as a new contact.`,
|
||||
},
|
||||
],
|
||||
default: 'requesterId',
|
||||
description: 'Requester Identification',
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'requesterIdentificationValue',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'create'
|
||||
]
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: `Value of the identification selected `,
|
||||
},
|
||||
{
|
||||
displayName: 'Status',
|
||||
name: 'status',
|
||||
type: 'options',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'create'
|
||||
]
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Open',
|
||||
value: 'open',
|
||||
},
|
||||
{
|
||||
name: 'Pending',
|
||||
value: 'pending',
|
||||
},
|
||||
{
|
||||
name: 'Resolved',
|
||||
value: 'resolved',
|
||||
},
|
||||
{
|
||||
name: 'Closed',
|
||||
value: 'closed',
|
||||
}
|
||||
],
|
||||
default: 'pending',
|
||||
description: 'Status',
|
||||
},
|
||||
{
|
||||
displayName: 'Priority',
|
||||
name: 'priority',
|
||||
type: 'options',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'create'
|
||||
]
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Low',
|
||||
value: 'low',
|
||||
},
|
||||
{
|
||||
name: 'Medium',
|
||||
value: 'medium',
|
||||
},
|
||||
{
|
||||
name: 'High',
|
||||
value: 'high',
|
||||
},
|
||||
{
|
||||
name: 'Urgent',
|
||||
value: 'urgent',
|
||||
}
|
||||
],
|
||||
default: 'low',
|
||||
description: 'Priority',
|
||||
},
|
||||
{
|
||||
displayName: 'Source',
|
||||
name: 'source',
|
||||
type: 'options',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'create'
|
||||
]
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Email',
|
||||
value: 'email',
|
||||
},
|
||||
{
|
||||
name: 'Portal',
|
||||
value: 'portal',
|
||||
},
|
||||
{
|
||||
name: 'Phone',
|
||||
value: 'phone',
|
||||
},
|
||||
{
|
||||
name: 'Chat',
|
||||
value: 'chat',
|
||||
},
|
||||
{
|
||||
name: 'Mobihelp',
|
||||
value: 'mobileHelp',
|
||||
},
|
||||
{
|
||||
name: 'Feedback Widget',
|
||||
value: 'feedbackWidget',
|
||||
},
|
||||
{
|
||||
name: 'Outbound Email',
|
||||
value: 'OutboundEmail',
|
||||
}
|
||||
],
|
||||
default: 'portal',
|
||||
description: 'The channel through which the ticket was created.',
|
||||
},
|
||||
// {
|
||||
// displayName: 'JSON Parameters',
|
||||
// name: 'jsonParameters',
|
||||
// type: 'boolean',
|
||||
// default: false,
|
||||
// description: '',
|
||||
// displayOptions: {
|
||||
// show: {
|
||||
// resource: [
|
||||
// 'ticket'
|
||||
// ],
|
||||
// operation: [
|
||||
// 'create',
|
||||
// ]
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Option',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket'
|
||||
],
|
||||
operation: [
|
||||
'create'
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Name',
|
||||
name: 'name',
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: '',
|
||||
description: 'Name of the requester',
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: '',
|
||||
description: 'Subject of the ticket.',
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
default: 'Question',
|
||||
description: 'Helps categorize the ticket according to the different kinds of issues your support team deals with.',
|
||||
options: [
|
||||
{
|
||||
name: 'Question',
|
||||
value: 'Question'
|
||||
},
|
||||
{
|
||||
name: 'Incident',
|
||||
value: 'Incident'
|
||||
},
|
||||
{
|
||||
name: 'Problem',
|
||||
value: 'Problem'
|
||||
},
|
||||
{
|
||||
name: 'Feature Request',
|
||||
value: 'Feature Request'
|
||||
},
|
||||
{
|
||||
name: 'Refund',
|
||||
value: 'Refund'
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
displayName: 'Description',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
required: false,
|
||||
default: '',
|
||||
typeOptions: {
|
||||
rows: 5,
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
description: 'HTML content of the ticket.',
|
||||
},
|
||||
{
|
||||
displayName: 'Agent',
|
||||
name: 'agent',
|
||||
type: 'options',
|
||||
required: false,
|
||||
default: '',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getAgents'
|
||||
},
|
||||
description: 'ID of the agent to whom the ticket has been assigned',
|
||||
},
|
||||
{
|
||||
displayName: 'CC Emails',
|
||||
name: 'ccEmails',
|
||||
required: false,
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: `separated by , email addresses added in the 'cc' field of the incoming ticket email`,
|
||||
},
|
||||
{
|
||||
displayName: 'Tags',
|
||||
name: 'tags',
|
||||
required: false,
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: `separated by , tags that have been associated with the ticket`,
|
||||
},
|
||||
{
|
||||
displayName: 'Due By',
|
||||
name: 'dueBy',
|
||||
required: false,
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: `Timestamp that denotes when the ticket is due to be resolved`,
|
||||
},
|
||||
{
|
||||
displayName: 'Email config Id',
|
||||
name: 'emailConfigId',
|
||||
type: 'number',
|
||||
required: false,
|
||||
default: '',
|
||||
description: `ID of email config which is used for this ticket. (i.e., support@yourcompany.com/sales@yourcompany.com)
|
||||
If product_id is given and email_config_id is not given, product's primary email_config_id will be set`,
|
||||
},
|
||||
{
|
||||
displayName: 'FR Due By',
|
||||
name: 'frDueBy',
|
||||
type: 'dateTime',
|
||||
required: false,
|
||||
default: '',
|
||||
description: `Timestamp that denotes when the first response is due`,
|
||||
},
|
||||
{
|
||||
displayName: 'Group',
|
||||
name: 'group',
|
||||
required: false,
|
||||
type: 'options',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getGroups'
|
||||
},
|
||||
description: `ID of the group to which the ticket has been assigned. The default value is the ID of the group that is associated with the given email_config_id`,
|
||||
},
|
||||
{
|
||||
displayName: 'Product',
|
||||
name: 'product',
|
||||
required: false,
|
||||
type: 'options',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getProducts'
|
||||
},
|
||||
description: `ID of the product to which the ticket is associated.
|
||||
It will be ignored if the email_config_id attribute is set in the request.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Company',
|
||||
name: 'company',
|
||||
required: false,
|
||||
type: 'options',
|
||||
default: '',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getCompanies'
|
||||
},
|
||||
description: `Company ID of the requester. This attribute can only be set if the Multiple Companies feature is enabled (Estate plan and above)`,
|
||||
},
|
||||
]
|
||||
},
|
||||
// {
|
||||
// displayName: 'Custom Fields',
|
||||
// name: 'customFieldsUi',
|
||||
// placeholder: 'Add Custom fields',
|
||||
// type: 'fixedCollection',
|
||||
// required: false,
|
||||
// default: '',
|
||||
// typeOptions: {
|
||||
// multipleValues: true,
|
||||
// },
|
||||
// displayOptions: {
|
||||
// show: {
|
||||
// resource: [
|
||||
// 'ticket'
|
||||
// ],
|
||||
// operation: [
|
||||
// 'create'
|
||||
// ],
|
||||
// jsonParameters: [
|
||||
// false,
|
||||
// ],
|
||||
// },
|
||||
// },
|
||||
// description: 'Key value pairs containing the names and values of custom fields.',
|
||||
// options: [
|
||||
// {
|
||||
// name: 'customFieldsValues',
|
||||
// displayName: 'Custom fields',
|
||||
// values: [
|
||||
// {
|
||||
// displayName: 'Key',
|
||||
// required: false,
|
||||
// name: 'key',
|
||||
// type: 'string',
|
||||
// default: '',
|
||||
// },
|
||||
// {
|
||||
// displayName: 'Value',
|
||||
// name: 'value',
|
||||
// type: 'string',
|
||||
// required: false,
|
||||
// default: '',
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// {
|
||||
// displayName: 'Custom Fields',
|
||||
// name: 'customFieldsJson',
|
||||
// type: 'json',
|
||||
// typeOptions: {
|
||||
// alwaysOpenEditWindow: true,
|
||||
// },
|
||||
// displayOptions: {
|
||||
// show: {
|
||||
// resource: [
|
||||
// 'ticket'
|
||||
// ],
|
||||
// operation: [
|
||||
// 'create'
|
||||
// ],
|
||||
// jsonParameters: [
|
||||
// true,
|
||||
// ],
|
||||
// },
|
||||
// },
|
||||
// default: '',
|
||||
// required: false,
|
||||
// placeholder: `{
|
||||
// "gadget":"Cold Welder"
|
||||
// }`,
|
||||
// description: 'Key value pairs containing the names and values of custom fields.',
|
||||
// },
|
||||
]
|
||||
};
|
||||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
// Get all the agents to display them to user so that he can
|
||||
// select them easily
|
||||
async getAgents(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
let agents;
|
||||
try {
|
||||
agents = await freshdeskApiRequest.call(this, '/agents', 'GET');
|
||||
} catch (err) {
|
||||
throw new Error(`Freshdesk Error: ${err}`);
|
||||
}
|
||||
for (const agent of agents) {
|
||||
const agentName = agent.contact.name;
|
||||
const agentId = agent.id;
|
||||
|
||||
returnData.push({
|
||||
name: agentName,
|
||||
value: agentId,
|
||||
});
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
|
||||
// Get all the groups to display them to user so that he can
|
||||
// select them easily
|
||||
async getGroups(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
let groups;
|
||||
try {
|
||||
groups = await freshdeskApiRequest.call(this, '/groups', 'GET');
|
||||
} catch (err) {
|
||||
throw new Error(`Freshdesk Error: ${err}`);
|
||||
}
|
||||
for (const group of groups) {
|
||||
const groupName = group.name;
|
||||
const groupId = group.id;
|
||||
|
||||
returnData.push({
|
||||
name: groupName,
|
||||
value: groupId,
|
||||
});
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
|
||||
// Get all the products to display them to user so that he can
|
||||
// select them easily
|
||||
async getProducts(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
let products;
|
||||
try {
|
||||
products = await freshdeskApiRequest.call(this, '/products', 'GET');
|
||||
} catch (err) {
|
||||
throw new Error(`Freshdesk Error: ${err}`);
|
||||
}
|
||||
for (const product of products) {
|
||||
const productName = product.name;
|
||||
const productId = product.id;
|
||||
|
||||
returnData.push({
|
||||
name: productName,
|
||||
value: productId,
|
||||
});
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
|
||||
// Get all the companies to display them to user so that he can
|
||||
// select them easily
|
||||
async getCompanies(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
let companies;
|
||||
try {
|
||||
companies = await freshdeskApiRequest.call(this, '/companies', 'GET');
|
||||
} catch (err) {
|
||||
throw new Error(`Freshdesk Error: ${err}`);
|
||||
}
|
||||
for (const company of companies) {
|
||||
const companyName = company.name;
|
||||
const companyId = company.id;
|
||||
|
||||
returnData.push({
|
||||
name: companyName,
|
||||
value: companyId,
|
||||
});
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
async executeSingle(this: IExecuteSingleFunctions): Promise<INodeExecutionData> {
|
||||
const resource = this.getNodeParameter('resource') as string;
|
||||
const opeation = this.getNodeParameter('operation') as string;
|
||||
let response;
|
||||
|
||||
if (resource === 'ticket') {
|
||||
if (opeation === 'create') {
|
||||
const requester = this.getNodeParameter('requester') as string;
|
||||
const value = this.getNodeParameter('requesterIdentificationValue') as string;
|
||||
const status = this.getNodeParameter('status') as string;
|
||||
const priority = this.getNodeParameter('priority') as string;
|
||||
const source = this.getNodeParameter('source') as string;
|
||||
const options = this.getNodeParameter('options') as IDataObject;
|
||||
//const jsonActive = this.getNodeParameter('jsonParameters') as boolean;
|
||||
|
||||
const body: ICreateTicketBody = {
|
||||
// @ts-ignore
|
||||
status: Status[capitalize(status)],
|
||||
// @ts-ignore
|
||||
priority: Priority[capitalize(priority)],
|
||||
// @ts-ignore
|
||||
source: Source[capitalize(source)]
|
||||
};
|
||||
if (requester === 'requesterId') {
|
||||
// @ts-ignore
|
||||
if (isNaN(value)) {
|
||||
throw new Error('Requester Id must be a number');
|
||||
}
|
||||
body.requester_id = parseInt(value, 10);
|
||||
} else if (requester === 'email') {
|
||||
body.email = value;
|
||||
} else if (requester === 'facebookId') {
|
||||
body.facebook_id = value;
|
||||
} else if (requester === 'phone') {
|
||||
body.phone = value;
|
||||
} else if (requester === 'twitterId') {
|
||||
body.twitter_id = value;
|
||||
} else if (requester === 'uniqueExternalId') {
|
||||
body.unique_external_id = value;
|
||||
}
|
||||
|
||||
// if (!jsonActive) {
|
||||
// const customFieldsUi = this.getNodeParameter('customFieldsUi') as IDataObject;
|
||||
// if (Object.keys(customFieldsUi).length > 0) {
|
||||
// const aux: IDataObject = {};
|
||||
// // @ts-ignore
|
||||
// customFieldsUi.customFieldsValues.forEach( o => {
|
||||
// aux[`${o.key}`] = o.value;
|
||||
// return aux;
|
||||
// });
|
||||
// body.custom_fields = aux;
|
||||
// } else {
|
||||
// body.custom_fields = validateJSON(this.getNodeParameter('customFielsJson') as string);
|
||||
// }
|
||||
|
||||
if (options.name) {
|
||||
body.name = options.name as string;
|
||||
}
|
||||
|
||||
if (options.subject) {
|
||||
body.subject = options.subject as string;
|
||||
} else {
|
||||
body.subject = 'null';
|
||||
}
|
||||
|
||||
if (options.type) {
|
||||
body.type = options.type as string;
|
||||
}
|
||||
|
||||
if (options.description) {
|
||||
body.description = options.description as string;
|
||||
} else {
|
||||
body.description = 'null';
|
||||
}
|
||||
|
||||
if (options.agent) {
|
||||
body.responder_id = options.agent as number;
|
||||
}
|
||||
|
||||
if (options.company) {
|
||||
body.company_id = options.company as number;
|
||||
}
|
||||
|
||||
if (options.product) {
|
||||
body.product_id = options.product as number;
|
||||
}
|
||||
|
||||
if (options.group) {
|
||||
body.group_id = options.group as number;
|
||||
}
|
||||
|
||||
if (options.frDueBy) {
|
||||
body.fr_due_by = options.frDueBy as string;
|
||||
}
|
||||
|
||||
if (options.emailConfigId) {
|
||||
body.email_config_id = options.emailConfigId as number;
|
||||
}
|
||||
|
||||
if (options.dueBy) {
|
||||
body.due_by = options.dueBy as string;
|
||||
}
|
||||
|
||||
if (options.tags) {
|
||||
body.tags = (options.tags as string).split(',') as [string];
|
||||
}
|
||||
|
||||
if (options.ccEmails) {
|
||||
body.cc_emails = (options.ccEmails as string).split(',') as [string];
|
||||
}
|
||||
|
||||
try {
|
||||
response = await freshdeskApiRequest.call(this, '/tickets', 'POST', body);
|
||||
} catch (err) {
|
||||
throw new Error(`Freskdesk Error: ${JSON.stringify(err)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
json: response
|
||||
};
|
||||
}
|
||||
}
|
66
packages/nodes-base/nodes/Freshdesk/GenericFunctions.ts
Normal file
66
packages/nodes-base/nodes/Freshdesk/GenericFunctions.ts
Normal file
|
@ -0,0 +1,66 @@
|
|||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
BINARY_ENCODING
|
||||
} from 'n8n-core';
|
||||
|
||||
import * as _ from 'lodash';
|
||||
|
||||
export async function freshdeskApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, resource: string, method: string, body: any = {}, headers?: object): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
const credentials = this.getCredentials('freshdeskApi');
|
||||
|
||||
if (credentials === undefined) {
|
||||
throw new Error('No credentials got returned!');
|
||||
}
|
||||
|
||||
const apiKey = `${credentials.apiKey}:X`;
|
||||
|
||||
const headerWithAuthentication = Object.assign({}, headers, { Authorization: `${Buffer.from(apiKey).toString(BINARY_ENCODING)}` });
|
||||
|
||||
const endpoint = 'freshdesk.com/api/v2/';
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
headers: headerWithAuthentication,
|
||||
method,
|
||||
body,
|
||||
uri: `https://${credentials.domain}.${endpoint}${resource}`,
|
||||
json: true
|
||||
};
|
||||
|
||||
if (_.isEmpty(options.body)) {
|
||||
delete options.body;
|
||||
}
|
||||
|
||||
try {
|
||||
return await this.helpers.request!(options);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
const errorMessage = error.response.body.message || error.response.body.Message;
|
||||
|
||||
if (errorMessage !== undefined) {
|
||||
throw errorMessage;
|
||||
}
|
||||
throw error.response.body;
|
||||
}
|
||||
}
|
||||
|
||||
export function validateJSON(json: string | undefined): any { // tslint:disable-line:no-any
|
||||
let result;
|
||||
try {
|
||||
result = JSON.parse(json!);
|
||||
} catch (exception) {
|
||||
result = [];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
export function capitalize(s: string): string {
|
||||
if (typeof s !== 'string') return '';
|
||||
return s.charAt(0).toUpperCase() + s.slice(1);
|
||||
}
|
BIN
packages/nodes-base/nodes/Freshdesk/freshdesk.png
Normal file
BIN
packages/nodes-base/nodes/Freshdesk/freshdesk.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
|
@ -259,6 +259,23 @@ export class Gitlab implements INodeType {
|
|||
},
|
||||
description: 'The body of the issue.',
|
||||
},
|
||||
{
|
||||
displayName: 'Due Date',
|
||||
name: 'due_date',
|
||||
type: 'dateTime',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'issue',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Due Date for issue.',
|
||||
},
|
||||
{
|
||||
displayName: 'Labels',
|
||||
name: 'labels',
|
||||
|
@ -318,6 +335,7 @@ export class Gitlab implements INodeType {
|
|||
],
|
||||
},
|
||||
|
||||
|
||||
// ----------------------------------
|
||||
// issue:createComment
|
||||
// ----------------------------------
|
||||
|
@ -409,7 +427,7 @@ export class Gitlab implements INodeType {
|
|||
},
|
||||
{
|
||||
displayName: 'Body',
|
||||
name: 'body',
|
||||
name: 'description',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
rows: 5,
|
||||
|
@ -474,6 +492,13 @@ export class Gitlab implements INodeType {
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Due Date',
|
||||
name: 'due_date',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'Due Date for issue.',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
|
@ -829,6 +854,7 @@ export class Gitlab implements INodeType {
|
|||
|
||||
body.title = this.getNodeParameter('title', i) as string;
|
||||
body.description = this.getNodeParameter('body', i) as string;
|
||||
body.due_date = this.getNodeParameter('due_date', i) as string;
|
||||
const labels = this.getNodeParameter('labels', i) as IDataObject[];
|
||||
|
||||
const assigneeIds = this.getNodeParameter('assignee_ids', i) as IDataObject[];
|
||||
|
|
|
@ -312,7 +312,7 @@ export class GoogleSheet {
|
|||
// Property exists so add it to the data to update
|
||||
|
||||
// Get the column name in which the property data can be found
|
||||
updateColumnName = String.fromCharCode(characterCode + keyColumnOrder.indexOf(propertyName));
|
||||
updateColumnName = String.fromCharCode(rangeStart.toUpperCase().charCodeAt(0) + keyColumnOrder.indexOf(propertyName));
|
||||
|
||||
updateData.push({
|
||||
range: `${sheet ? sheet + '!' : ''}${updateColumnName}${updateRowIndex}`,
|
||||
|
|
174
packages/nodes-base/nodes/utils/allCurrencies.ts
Normal file
174
packages/nodes-base/nodes/utils/allCurrencies.ts
Normal file
|
@ -0,0 +1,174 @@
|
|||
const allCurrencies = [
|
||||
{ name: 'Euro', value: 'eur' },
|
||||
{ name: 'United States Dollar', value: 'usd' },
|
||||
{ name: 'British Pound Sterling', value: 'gbp' },
|
||||
{ name: 'Swiss Franc', value: 'chf' },
|
||||
{ name: 'Renminbi', value: 'cny' },
|
||||
{ name: '--------', value: '' },
|
||||
{ name: 'United Arab Emirates Dirham', value: 'aed' },
|
||||
{ name: 'Afghan Afghani', value: 'afn' },
|
||||
{ name: 'Albanian Lek', value: 'all' },
|
||||
{ name: 'Armenian Dram', value: 'amd' },
|
||||
{ name: 'Netherlands Antillean Guilder', value: 'ang' },
|
||||
{ name: 'Angolan Kwanza', value: 'aoa' },
|
||||
{ name: 'Argentine Peso', value: 'ars' },
|
||||
{ name: 'Australian Dollar', value: 'aud' },
|
||||
{ name: 'Aruban Florin', value: 'awg' },
|
||||
{ name: 'Azerbaijani Manat', value: 'azn' },
|
||||
{ name: 'Bosnia-Herzegovina Convertible Mark', value: 'bam' },
|
||||
{ name: 'Barbadian Dollar', value: 'bbd' },
|
||||
{ name: 'Bangladeshi Taka', value: 'bdt' },
|
||||
{ name: 'Bulgarian Lev', value: 'bgn' },
|
||||
{ name: 'Bahraini Dinar', value: 'bhd' },
|
||||
{ name: 'Burundian Franc', value: 'bif' },
|
||||
{ name: 'Bermudan Dollar', value: 'bmd' },
|
||||
{ name: 'Brunei Dollar', value: 'bnd' },
|
||||
{ name: 'Bolivian Boliviano', value: 'bob' },
|
||||
{ name: 'Brazilian Real', value: 'brl' },
|
||||
{ name: 'Bahamian Dollar', value: 'bsd' },
|
||||
{ name: 'Bitcoin', value: 'btc' },
|
||||
{ name: 'Bhutanese Ngultrum', value: 'btn' },
|
||||
{ name: 'Botswanan Pula', value: 'bwp' },
|
||||
{ name: 'Belarusian Ruble', value: 'byn' },
|
||||
{ name: 'Belize Dollar', value: 'bzd' },
|
||||
{ name: 'Canadian Dollar', value: 'cad' },
|
||||
{ name: 'Congolese Franc', value: 'cdf' },
|
||||
{ name: 'Chilean Unit of Account (UF)', value: 'clf' },
|
||||
{ name: 'Chilean Peso', value: 'clp' },
|
||||
{ name: 'Chinese Yuan (Offshore)', value: 'cnh' },
|
||||
{ name: 'Colombian Peso', value: 'cop' },
|
||||
{ name: 'Costa Rican Colón', value: 'crc' },
|
||||
{ name: 'Cuban Convertible Peso', value: 'cuc' },
|
||||
{ name: 'Cuban Peso', value: 'cup' },
|
||||
{ name: 'Cape Verdean Escudo', value: 'cve' },
|
||||
{ name: 'Czech Republic Koruna', value: 'czk' },
|
||||
{ name: 'Djiboutian Franc', value: 'djf' },
|
||||
{ name: 'Danish Krone', value: 'dkk' },
|
||||
{ name: 'Dominican Peso', value: 'dop' },
|
||||
{ name: 'Algerian Dinar', value: 'dzd' },
|
||||
{ name: 'Egyptian Pound', value: 'egp' },
|
||||
{ name: 'Eritrean Nakfa', value: 'ern' },
|
||||
{ name: 'Ethiopian Birr', value: 'etb' },
|
||||
{ name: 'Fijian Dollar', value: 'fjd' },
|
||||
{ name: 'Falkland Islands Pound', value: 'fkp' },
|
||||
{ name: 'Georgian Lari', value: 'gel' },
|
||||
{ name: 'Guernsey Pound', value: 'ggp' },
|
||||
{ name: 'Ghanaian Cedi', value: 'ghs' },
|
||||
{ name: 'Gibraltar Pound', value: 'gip' },
|
||||
{ name: 'Gambian Dalasi', value: 'gmd' },
|
||||
{ name: 'Guinean Franc', value: 'gnf' },
|
||||
{ name: 'Guatemalan Quetzal', value: 'gtq' },
|
||||
{ name: 'Guyanaese Dollar', value: 'gyd' },
|
||||
{ name: 'Hong Kong Dollar', value: 'hkd' },
|
||||
{ name: 'Honduran Lempira', value: 'hnl' },
|
||||
{ name: 'Croatian Kuna', value: 'hrk' },
|
||||
{ name: 'Haitian Gourde', value: 'htg' },
|
||||
{ name: 'Hungarian Forint', value: 'huf' },
|
||||
{ name: 'Indonesian Rupiah', value: 'idr' },
|
||||
{ name: 'Israeli New Sheqel', value: 'ils' },
|
||||
{ name: 'Manx pound', value: 'imp' },
|
||||
{ name: 'Indian Rupee', value: 'inr' },
|
||||
{ name: 'Iraqi Dinar', value: 'iqd' },
|
||||
{ name: 'Iranian Rial', value: 'irr' },
|
||||
{ name: 'Icelandic Króna', value: 'isk' },
|
||||
{ name: 'Jersey Pound', value: 'jep' },
|
||||
{ name: 'Jamaican Dollar', value: 'jmd' },
|
||||
{ name: 'Jordanian Dinar', value: 'jod' },
|
||||
{ name: 'Japanese Yen', value: 'jpy' },
|
||||
{ name: 'Kenyan Shilling', value: 'kes' },
|
||||
{ name: 'Kyrgystani Som', value: 'kgs' },
|
||||
{ name: 'Cambodian Riel', value: 'khr' },
|
||||
{ name: 'Comorian Franc', value: 'kmf' },
|
||||
{ name: 'North Korean Won', value: 'kpw' },
|
||||
{ name: 'South Korean Won', value: 'krw' },
|
||||
{ name: 'Kuwaiti Dinar', value: 'kwd' },
|
||||
{ name: 'Cayman Islands Dollar', value: 'kyd' },
|
||||
{ name: 'Kazakhstani Tenge', value: 'kzt' },
|
||||
{ name: 'Laotian Kip', value: 'lak' },
|
||||
{ name: 'Lebanese Pound', value: 'lbp' },
|
||||
{ name: 'Sri Lankan Rupee', value: 'lkr' },
|
||||
{ name: 'Liberian Dollar', value: 'lrd' },
|
||||
{ name: 'Lesotho Loti', value: 'lsl' },
|
||||
{ name: 'Libyan Dinar', value: 'lyd' },
|
||||
{ name: 'Moroccan Dirham', value: 'mad' },
|
||||
{ name: 'Moldovan Leu', value: 'mdl' },
|
||||
{ name: 'Malagasy Ariary', value: 'mga' },
|
||||
{ name: 'Macedonian Denar', value: 'mkd' },
|
||||
{ name: 'Myanma Kyat', value: 'mmk' },
|
||||
{ name: 'Mongolian Tugrik', value: 'mnt' },
|
||||
{ name: 'Macanese Pataca', value: 'mop' },
|
||||
{ name: 'Mauritanian Ouguiya (pre-2018)', value: 'mro' },
|
||||
{ name: 'Mauritanian Ouguiya', value: 'mru' },
|
||||
{ name: 'Mauritian Rupee', value: 'mur' },
|
||||
{ name: 'Maldivian Rufiyaa', value: 'mvr' },
|
||||
{ name: 'Malawian Kwacha', value: 'mwk' },
|
||||
{ name: 'Mexican Peso', value: 'mxn' },
|
||||
{ name: 'Malaysian Ringgit', value: 'myr' },
|
||||
{ name: 'Mozambican Metical', value: 'mzn' },
|
||||
{ name: 'Namibian Dollar', value: 'nad' },
|
||||
{ name: 'Nigerian Naira', value: 'ngn' },
|
||||
{ name: 'Nicaraguan Córdoba', value: 'nio' },
|
||||
{ name: 'Norwegian Krone', value: 'nok' },
|
||||
{ name: 'Nepalese Rupee', value: 'npr' },
|
||||
{ name: 'New Zealand Dollar', value: 'nzd' },
|
||||
{ name: 'Omani Rial', value: 'omr' },
|
||||
{ name: 'Panamanian Balboa', value: 'pab' },
|
||||
{ name: 'Peruvian Nuevo Sol', value: 'pen' },
|
||||
{ name: 'Papua New Guinean Kina', value: 'pgk' },
|
||||
{ name: 'Philippine Peso', value: 'php' },
|
||||
{ name: 'Pakistani Rupee', value: 'pkr' },
|
||||
{ name: 'Polish Zloty', value: 'pln' },
|
||||
{ name: 'Paraguayan Guarani', value: 'pyg' },
|
||||
{ name: 'Qatari Rial', value: 'qar' },
|
||||
{ name: 'Romanian Leu', value: 'ron' },
|
||||
{ name: 'Serbian Dinar', value: 'rsd' },
|
||||
{ name: 'Russian Ruble', value: 'rub' },
|
||||
{ name: 'Rwandan Franc', value: 'rwf' },
|
||||
{ name: 'Saudi Riyal', value: 'sar' },
|
||||
{ name: 'Solomon Islands Dollar', value: 'sbd' },
|
||||
{ name: 'Seychellois Rupee', value: 'scr' },
|
||||
{ name: 'Sudanese Pound', value: 'sdg' },
|
||||
{ name: 'Swedish Krona', value: 'sek' },
|
||||
{ name: 'Singapore Dollar', value: 'sgd' },
|
||||
{ name: 'Saint Helena Pound', value: 'shp' },
|
||||
{ name: 'Sierra Leonean Leone', value: 'sll' },
|
||||
{ name: 'Somali Shilling', value: 'sos' },
|
||||
{ name: 'Surinamese Dollar', value: 'srd' },
|
||||
{ name: 'South Sudanese Pound', value: 'ssp' },
|
||||
{ name: 'São Tomé and Príncipe Dobra (pre-2018)', value: 'std' },
|
||||
{ name: 'São Tomé and Príncipe Dobra', value: 'stn' },
|
||||
{ name: 'Salvadoran Colón', value: 'svc' },
|
||||
{ name: 'Syrian Pound', value: 'syp' },
|
||||
{ name: 'Swazi Lilangeni', value: 'szl' },
|
||||
{ name: 'Thai Baht', value: 'thb' },
|
||||
{ name: 'Tajikistani Somoni', value: 'tjs' },
|
||||
{ name: 'Turkmenistani Manat', value: 'tmt' },
|
||||
{ name: 'Tunisian Dinar', value: 'tnd' },
|
||||
{ name: "Tongan Pa'anga", value: 'top' },
|
||||
{ name: 'Turkish Lira', value: 'try' },
|
||||
{ name: 'Trinidad and Tobago Dollar', value: 'ttd' },
|
||||
{ name: 'New Taiwan Dollar', value: 'twd' },
|
||||
{ name: 'Tanzanian Shilling', value: 'tzs' },
|
||||
{ name: 'Ukrainian Hryvnia', value: 'uah' },
|
||||
{ name: 'Ugandan Shilling', value: 'ugx' },
|
||||
{ name: 'Uruguayan Peso', value: 'uyu' },
|
||||
{ name: 'Uzbekistan Som', value: 'uzs' },
|
||||
{ name: 'Venezuelan Bolívar Fuerte', value: 'vef' },
|
||||
{ name: 'Vietnamese Dong', value: 'vnd' },
|
||||
{ name: 'Vanuatu Vatu', value: 'vuv' },
|
||||
{ name: 'Samoan Tala', value: 'wst' },
|
||||
{ name: 'CFA Franc BEAC', value: 'xaf' },
|
||||
{ name: 'Silver Ounce', value: 'xag' },
|
||||
{ name: 'Gold Ounce', value: 'xau' },
|
||||
{ name: 'East Caribbean Dollar', value: 'xcd' },
|
||||
{ name: 'Special Drawing Rights', value: 'xdr' },
|
||||
{ name: 'CFA Franc BCEAO', value: 'xof' },
|
||||
{ name: 'Palladium Ounce', value: 'xpd' },
|
||||
{ name: 'CFP Franc', value: 'xpf' },
|
||||
{ name: 'Platinum Ounce', value: 'xpt' },
|
||||
{ name: 'Yemeni Rial', value: 'yer' },
|
||||
{ name: 'South African Rand', value: 'zar' },
|
||||
{ name: 'Zambian Kwacha', value: 'zmw' },
|
||||
{ name: 'Zimbabwean Dollar', value: 'zwl' }
|
||||
// tslint:disable-next-line: semicolon
|
||||
]
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "n8n-nodes-base",
|
||||
"version": "0.28.0",
|
||||
"version": "0.29.0",
|
||||
"description": "Base nodes of n8n",
|
||||
"license": "SEE LICENSE IN LICENSE.md",
|
||||
"homepage": "https://n8n.io",
|
||||
|
@ -33,6 +33,7 @@
|
|||
"dist/credentials/Aws.credentials.js",
|
||||
"dist/credentials/ChargebeeApi.credentials.js",
|
||||
"dist/credentials/DropboxApi.credentials.js",
|
||||
"dist/credentials/FreshdeskApi.credentials.js",
|
||||
"dist/credentials/GithubApi.credentials.js",
|
||||
"dist/credentials/GitlabApi.credentials.js",
|
||||
"dist/credentials/GoogleApi.credentials.js",
|
||||
|
@ -42,6 +43,7 @@
|
|||
"dist/credentials/Imap.credentials.js",
|
||||
"dist/credentials/LinkFishApi.credentials.js",
|
||||
"dist/credentials/MailgunApi.credentials.js",
|
||||
"dist/credentials/MandrillApi.credentials.js",
|
||||
"dist/credentials/MattermostApi.credentials.js",
|
||||
"dist/credentials/MongoDb.credentials.js",
|
||||
"dist/credentials/NextCloudApi.credentials.js",
|
||||
|
@ -53,11 +55,10 @@
|
|||
"dist/credentials/Smtp.credentials.js",
|
||||
"dist/credentials/StripeApi.credentials.js",
|
||||
"dist/credentials/TelegramApi.credentials.js",
|
||||
"dist/credentials/TodoistApi.credentials.js",
|
||||
"dist/credentials/TrelloApi.credentials.js",
|
||||
"dist/credentials/TwilioApi.credentials.js",
|
||||
"dist/credentials/TypeformApi.credentials.js",
|
||||
"dist/credentials/MandrillApi.credentials.js",
|
||||
"dist/credentials/TodoistApi.credentials.js"
|
||||
"dist/credentials/TypeformApi.credentials.js"
|
||||
],
|
||||
"nodes": [
|
||||
"dist/nodes/ActiveCampaign/ActiveCampaign.node.js",
|
||||
|
@ -78,6 +79,7 @@
|
|||
"dist/nodes/EmailSend.node.js",
|
||||
"dist/nodes/ErrorTrigger.node.js",
|
||||
"dist/nodes/ExecuteCommand.node.js",
|
||||
"dist/nodes/Freshdesk/Freshdesk.node.js",
|
||||
"dist/nodes/Function.node.js",
|
||||
"dist/nodes/FunctionItem.node.js",
|
||||
"dist/nodes/Github/Github.node.js",
|
||||
|
@ -92,6 +94,7 @@
|
|||
"dist/nodes/Interval.node.js",
|
||||
"dist/nodes/LinkFish/LinkFish.node.js",
|
||||
"dist/nodes/Mailgun/Mailgun.node.js",
|
||||
"dist/nodes/Mandrill/Mandrill.node.js",
|
||||
"dist/nodes/Mattermost/Mattermost.node.js",
|
||||
"dist/nodes/Merge.node.js",
|
||||
"dist/nodes/MoveBinaryData.node.js",
|
||||
|
@ -116,15 +119,14 @@
|
|||
"dist/nodes/Stripe/StripeTrigger.node.js",
|
||||
"dist/nodes/Telegram/Telegram.node.js",
|
||||
"dist/nodes/Telegram/TelegramTrigger.node.js",
|
||||
"dist/nodes/Todoist/Todoist.node.js",
|
||||
"dist/nodes/Trello/Trello.node.js",
|
||||
"dist/nodes/Trello/TrelloTrigger.node.js",
|
||||
"dist/nodes/Twilio/Twilio.node.js",
|
||||
"dist/nodes/Typeform/TypeformTrigger.node.js",
|
||||
"dist/nodes/WriteBinaryFile.node.js",
|
||||
"dist/nodes/Webhook.node.js",
|
||||
"dist/nodes/Xml.node.js",
|
||||
"dist/nodes/Mandrill/Mandrill.node.js",
|
||||
"dist/nodes/Todoist/Todoist.node.js"
|
||||
"dist/nodes/Xml.node.js"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
Loading…
Reference in a new issue