mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-29 21:31:07 -08:00
🔀 Merge branch 'master' into Postmark-trigger
This commit is contained in:
commit
4ec9952524
28
.github/workflows/docker-images-rpi.yml
vendored
Normal file
28
.github/workflows/docker-images-rpi.yml
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
name: Docker Image CI - Rpi
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- n8n@*
|
||||
|
||||
jobs:
|
||||
armv7_job:
|
||||
runs-on: ubuntu-18.04
|
||||
name: Build on ARMv7 (Rpi)
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Get the version
|
||||
id: vars
|
||||
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:14})
|
||||
|
||||
- name: Log in to Docker registry
|
||||
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: crazy-max/ghaction-docker-buildx@v1
|
||||
with:
|
||||
version: latest
|
||||
- name: Run Buildx (push image)
|
||||
if: success()
|
||||
run: |
|
||||
docker buildx build --platform linux/arm/v7 --build-arg N8N_VERSION=${{steps.vars.outputs.tag}} -t n8nio/n8n:${{steps.vars.outputs.tag}}-rpi --output type=image,push=true docker/images/n8n-rpi
|
|
@ -42,3 +42,5 @@ COPY --from=builder /data ./
|
|||
|
||||
COPY docker/images/n8n-custom/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
|
||||
|
||||
EXPOSE 5678/tcp
|
||||
|
|
49
docker/images/n8n-custom/Dockerfile copy
Normal file
49
docker/images/n8n-custom/Dockerfile copy
Normal file
|
@ -0,0 +1,49 @@
|
|||
FROM node:12.16-alpine as builder
|
||||
# FROM node:12.16-alpine
|
||||
|
||||
# Update everything and install needed dependencies
|
||||
RUN apk add --update graphicsmagick tzdata git tini su-exec
|
||||
|
||||
USER root
|
||||
|
||||
# Install all needed dependencies
|
||||
RUN apk --update add --virtual build-dependencies python build-base ca-certificates && \
|
||||
npm_config_user=root npm install -g full-icu lerna
|
||||
|
||||
ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
COPY lerna.json .
|
||||
COPY package.json .
|
||||
COPY packages/cli/ ./packages/cli/
|
||||
COPY packages/core/ ./packages/core/
|
||||
COPY packages/editor-ui/ ./packages/editor-ui/
|
||||
COPY packages/nodes-base/ ./packages/nodes-base/
|
||||
COPY packages/workflow/ ./packages/workflow/
|
||||
RUN rm -rf node_modules packages/*/node_modules packages/*/dist
|
||||
|
||||
RUN npm install --loglevel notice
|
||||
RUN lerna bootstrap --hoist
|
||||
RUN npm run build
|
||||
|
||||
|
||||
FROM node:12.16-alpine
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
# Install all needed dependencies
|
||||
RUN npm_config_user=root npm install -g full-icu
|
||||
|
||||
USER root
|
||||
|
||||
ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu
|
||||
|
||||
COPY --from=builder /data ./
|
||||
|
||||
RUN apk add --update graphicsmagick tzdata git tini su-exec
|
||||
|
||||
COPY docker/images/n8n-dev/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
|
||||
|
||||
EXPOSE 5678/tcp
|
23
docker/images/n8n-rhel7/Dockerfile
Normal file
23
docker/images/n8n-rhel7/Dockerfile
Normal file
|
@ -0,0 +1,23 @@
|
|||
FROM richxsl/rhel7
|
||||
|
||||
ARG N8N_VERSION
|
||||
|
||||
RUN if [ -z "$N8N_VERSION" ] ; then echo "The N8N_VERSION argument is missing!" ; exit 1; fi
|
||||
|
||||
RUN \
|
||||
yum install -y gcc-c++ make
|
||||
|
||||
RUN \
|
||||
curl -sL https://rpm.nodesource.com/setup_12.x | sudo -E bash -
|
||||
|
||||
RUN \
|
||||
sudo yum install nodejs
|
||||
|
||||
# Set a custom user to not have n8n run as root
|
||||
USER root
|
||||
|
||||
RUN npm_config_user=root npm install -g n8n@${N8N_VERSION}
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
CMD "n8n"
|
16
docker/images/n8n-rhel7/README.md
Normal file
16
docker/images/n8n-rhel7/README.md
Normal file
|
@ -0,0 +1,16 @@
|
|||
## Build Docker-Image
|
||||
|
||||
```
|
||||
docker build --build-arg N8N_VERSION=<VERSION> -t n8nio/n8n:<VERSION> .
|
||||
|
||||
# For example:
|
||||
docker build --build-arg N8N_VERSION=0.36.1 -t n8nio/n8n:0.36.1-rhel7 .
|
||||
```
|
||||
|
||||
|
||||
```
|
||||
docker run -it --rm \
|
||||
--name n8n \
|
||||
-p 5678:5678 \
|
||||
n8nio/n8n:0.25.0-ubuntu
|
||||
```
|
20
docker/images/n8n-rpi/Dockerfile
Normal file
20
docker/images/n8n-rpi/Dockerfile
Normal file
|
@ -0,0 +1,20 @@
|
|||
FROM arm32v7/node:12.16
|
||||
|
||||
ARG N8N_VERSION
|
||||
|
||||
RUN if [ -z "$N8N_VERSION" ] ; then echo "The N8N_VERSION argument is missing!" ; exit 1; fi
|
||||
|
||||
RUN \
|
||||
apt-get update && \
|
||||
apt-get -y install graphicsmagick gosu
|
||||
|
||||
RUN npm_config_user=root npm install -g full-icu n8n@${N8N_VERSION}
|
||||
|
||||
ENV NODE_ICU_DATA /usr/local/lib/node_modules/full-icu
|
||||
ENV NODE_ENV production
|
||||
|
||||
WORKDIR /data
|
||||
|
||||
USER node
|
||||
|
||||
CMD n8n
|
21
docker/images/n8n-rpi/README.md
Normal file
21
docker/images/n8n-rpi/README.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
## n8n - Raspberry PI Docker Image
|
||||
|
||||
Dockerfile to build n8n for Raspberry PI.
|
||||
|
||||
For information about how to run n8n with Docker check the generic
|
||||
[Docker-Readme](https://github.com/n8n-io/n8n/tree/master/docker/images/n8n/README.md)
|
||||
|
||||
|
||||
```
|
||||
docker build --build-arg N8N_VERSION=<VERSION> -t n8nio/n8n:<VERSION> .
|
||||
|
||||
# For example:
|
||||
docker build --build-arg N8N_VERSION=0.43.0 -t n8nio/n8n:0.43.0-rpi .
|
||||
```
|
||||
|
||||
```
|
||||
docker run -it --rm \
|
||||
--name n8n \
|
||||
-p 5678:5678 \
|
||||
n8nio/n8n:0.70.0-rpi
|
||||
```
|
|
@ -19,3 +19,5 @@ WORKDIR /data
|
|||
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
||||
EXPOSE 5678/tcp
|
||||
|
|
|
@ -22,3 +22,5 @@ WORKDIR /data
|
|||
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
ENTRYPOINT ["tini", "--", "/docker-entrypoint.sh"]
|
||||
|
||||
EXPOSE 5678/tcp
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
docs.n8n.io
|
|
@ -1,10 +0,0 @@
|
|||
# n8n Documentation
|
||||
|
||||
This is the documentation of n8n, a free and open [fair-code](http://faircode.io) licensed node-based Workflow Automation Tool.
|
||||
|
||||
It covers everything from setup to usage and development. It is still a work in progress and all contributions are welcome.
|
||||
|
||||
|
||||
## What is n8n?
|
||||
|
||||
n8n (pronounced nodemation) helps you to interconnect every app with an API in the world with each other to share and manipulate its data without a single line of code. It is an easy to use, user-friendly and highly customizable service, which uses an intuitive user interface for you to design your unique workflows very fast. Hosted on your server and not based in the cloud, it keeps your sensible data very secure in your own trusted database.
|
|
@ -1,43 +0,0 @@
|
|||
- Home
|
||||
|
||||
- [Welcome](/)
|
||||
|
||||
- Getting started
|
||||
|
||||
- [Key Components](key-components.md)
|
||||
- [Quick Start](quick-start.md)
|
||||
- [Setup](setup.md)
|
||||
- [Tutorials](tutorials.md)
|
||||
- [Docker](docker.md)
|
||||
|
||||
- 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)
|
||||
- [Server Setup](server-setup.md)
|
||||
- [Start Workflows via CLI](start-workflows-via-cli.md)
|
||||
- [Workflow](workflow.md)
|
||||
|
||||
- Development
|
||||
|
||||
- [Create Node](create-node.md)
|
||||
- [Development](development.md)
|
||||
|
||||
|
||||
- Other
|
||||
|
||||
- [FAQ](faq.md)
|
||||
- [License](license.md)
|
||||
- [Troubleshooting](troubleshooting.md)
|
||||
|
||||
|
||||
- Links
|
||||
|
||||
- [![Jobs](https://n8n.io/favicon.ico ':size=16')Jobs](https://jobs.n8n.io)
|
||||
- [![Website](https://n8n.io/favicon.ico ':size=16')n8n.io](https://n8n.io)
|
|
@ -1,244 +0,0 @@
|
|||
|
||||
|
||||
# Configuration
|
||||
|
||||
It is possible to change some of the n8n defaults via special environment variables.
|
||||
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
|
||||
|
||||
# The IP address n8n should listen on
|
||||
N8N_LISTEN_ADDRESS=0.0.0.0
|
||||
|
||||
# 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
|
||||
it in the `~/.n8n` folder. That key is used to encrypt the credentials before
|
||||
they get saved to the database. It is also possible to overwrite that key and
|
||||
set it via an environment variable.
|
||||
|
||||
```bash
|
||||
export N8N_ENCRYPTION_KEY="<SOME RANDOM STRING>"
|
||||
```
|
||||
|
||||
|
||||
## Execution Data Manual Runs
|
||||
|
||||
Normally executions which got started via the Editor UI will not be saved as
|
||||
they are normally only for testing and debugging. That default can be changed
|
||||
with this environment variable.
|
||||
|
||||
```bash
|
||||
export EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=true
|
||||
```
|
||||
|
||||
This setting can also be overwritten on a per workflow basis in the workflow
|
||||
settings in the Editor UI.
|
||||
|
||||
|
||||
## Execution Data Error/Success
|
||||
|
||||
When a workflow gets executed, it will save the result in the database. That's
|
||||
the case for executions that succeeded and for the ones that failed. The
|
||||
default behavior can be changed like this:
|
||||
|
||||
```bash
|
||||
export EXECUTIONS_DATA_SAVE_ON_ERROR=none
|
||||
export EXECUTIONS_DATA_SAVE_ON_SUCCESS=none
|
||||
```
|
||||
|
||||
Possible values are:
|
||||
- **all**: Saves all data
|
||||
- **none**: Does not save anything (recommended if a workflow runs very often and/or processes a lot of data, set up "Error Workflow" instead)
|
||||
|
||||
These settings can also be overwritten on a per workflow basis in the workflow
|
||||
settings in the Editor UI.
|
||||
|
||||
|
||||
## Execute In Same Process
|
||||
|
||||
All workflows get executed in their own separate process. This ensures that all CPU cores
|
||||
get used and that they do not block each other on CPU intensive tasks. Additionally, this makes sure that
|
||||
the crash of one execution does not take down the whole application. The disadvantage is, however,
|
||||
that it slows down the start-time considerably and uses much more memory. So in case the
|
||||
workflows are not CPU intensive and they have to start very fast, it is possible to run them
|
||||
all directly in the main-process with this setting.
|
||||
|
||||
```bash
|
||||
export EXECUTIONS_PROCESS=main
|
||||
```
|
||||
|
||||
|
||||
## Exclude Nodes
|
||||
|
||||
It is possible to not allow users to use nodes of a specific node type. For example, if you
|
||||
do not want that people can write data to the disk with the "n8n-nodes-base.writeBinaryFile"
|
||||
node and that they cannot execute commands with the "n8n-nodes-base.executeCommand" node, you can
|
||||
set the following:
|
||||
|
||||
```bash
|
||||
export NODES_EXCLUDE="[\"n8n-nodes-base.executeCommand\",\"n8n-nodes-base.writeBinaryFile\"]"
|
||||
```
|
||||
|
||||
|
||||
## Custom Nodes Location
|
||||
|
||||
Every user can add custom nodes that get loaded by n8n on startup. The default
|
||||
location is in the subfolder `.n8n/custom` of the user who started n8n.
|
||||
Additional folders can be defined with an environment variable.
|
||||
|
||||
```bash
|
||||
export N8N_CUSTOM_EXTENSIONS="/home/jim/n8n/custom-nodes;/data/n8n/nodes"
|
||||
```
|
||||
|
||||
|
||||
## Use built-in and external modules in Function-Nodes
|
||||
|
||||
For security reasons, importing modules is restricted by default in the Function-Nodes.
|
||||
It is, however, possible to lift that restriction for built-in and external modules by
|
||||
setting the following environment variables:
|
||||
- `NODE_FUNCTION_ALLOW_BUILTIN`: For builtin modules
|
||||
- `NODE_FUNCTION_ALLOW_EXTERNAL`: For external modules sourced from n8n/node_modules directory. External module support is disabled when env variable is not set.
|
||||
|
||||
```bash
|
||||
# Allows usage of all builtin modules
|
||||
export NODE_FUNCTION_ALLOW_BUILTIN=*
|
||||
|
||||
# Allows usage of only crypto
|
||||
export NODE_FUNCTION_ALLOW_BUILTIN=crypto
|
||||
|
||||
# Allows usage of only crypto and fs
|
||||
export NODE_FUNCTION_ALLOW_BUILTIN=crypto,fs
|
||||
|
||||
# Allow usage of external npm modules. Wildcard matching is not supported.
|
||||
export NODE_FUNCTION_ALLOW_EXTERNAL=moment,lodash
|
||||
```
|
||||
|
||||
|
||||
## SSL
|
||||
|
||||
It is possible to start n8n with SSL enabled by supplying a certificate to use:
|
||||
|
||||
|
||||
```bash
|
||||
export N8N_PROTOCOL=https
|
||||
export N8N_SSL_KEY=/data/certs/server.key
|
||||
export N8N_SSL_CERT=/data/certs/server.pem
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Timezone
|
||||
|
||||
The timezone is set by default to "America/New_York". For instance, it is used by the
|
||||
Cron node to know at what time the workflow should be started. To set a different
|
||||
default timezone simply set `GENERIC_TIMEZONE` to the appropriate value. For example,
|
||||
if you want to set the timezone to Berlin (Germany):
|
||||
|
||||
```bash
|
||||
export GENERIC_TIMEZONE="Europe/Berlin"
|
||||
```
|
||||
|
||||
You can find the name of your timezone here:
|
||||
[https://momentjs.com/timezone/](https://momentjs.com/timezone/)
|
||||
|
||||
|
||||
## User Folder
|
||||
|
||||
User-specific data like the encryption key, SQLite database file, and
|
||||
the ID of the tunnel (if used) gets saved by default in the subfolder
|
||||
`.n8n` of the user who started n8n. It is possible to overwrite the
|
||||
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`. However, if n8n runs behind a
|
||||
reverse proxy that would not work. That's because n8n runs 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 so that it can be
|
||||
displayed correctly in the Editor UI and even more important is that the correct
|
||||
webhook URLs get registred with the external services.
|
||||
|
||||
```bash
|
||||
export WEBHOOK_TUNNEL_URL="https://n8n.example.com/"
|
||||
```
|
||||
|
||||
|
||||
## Configuration via file
|
||||
|
||||
It is also possible to configure n8n using a configuration file.
|
||||
|
||||
It is not necessary to define all values but only the ones that should be
|
||||
different from the defaults.
|
||||
|
||||
If needed multiple files can also be supplied to. For example, have generic
|
||||
base settings and some specific ones depending on the environment.
|
||||
|
||||
The path to the JSON configuration file to use can be set using the environment
|
||||
variable `N8N_CONFIG_FILES`.
|
||||
|
||||
```bash
|
||||
# Single file
|
||||
export N8N_CONFIG_FILES=/folder/my-config.json
|
||||
|
||||
# Multiple files can be comma-separated
|
||||
export N8N_CONFIG_FILES=/folder/my-config.json,/folder/production.json
|
||||
```
|
||||
|
||||
A possible configuration file could look like this:
|
||||
```json
|
||||
{
|
||||
"executions": {
|
||||
"process": "main",
|
||||
"saveDataOnSuccess": "none"
|
||||
},
|
||||
"generic": {
|
||||
"timezone": "Europe/Berlin"
|
||||
},
|
||||
"security": {
|
||||
"basicAuth": {
|
||||
"active": true,
|
||||
"user": "frank",
|
||||
"password": "some-secure-password"
|
||||
}
|
||||
},
|
||||
"nodes": {
|
||||
"exclude": "[\"n8n-nodes-base.executeCommand\",\"n8n-nodes-base.writeBinaryFile\"]"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
All possible values which can be set and their defaults can be found here:
|
||||
|
||||
[https://github.com/n8n-io/n8n/blob/master/packages/cli/config/index.ts](https://github.com/n8n-io/n8n/blob/master/packages/cli/config/index.ts)
|
|
@ -1,145 +0,0 @@
|
|||
# Create Node
|
||||
|
||||
It is quite easy to create your own nodes in n8n. Mainly three things have to be defined:
|
||||
|
||||
1. Generic information like name, description, image/icon
|
||||
1. The parameters to display via which the user can interact with it
|
||||
1. The code to run once the node gets executed
|
||||
|
||||
To simplify the development process, we created a very basic CLI which creates boilerplate code to get started, builds the node (as they are written in TypeScript), and copies it to the correct location.
|
||||
|
||||
|
||||
## Create the first basic node
|
||||
|
||||
1. Install the n8n-node-dev CLI: `npm install -g n8n-node-dev`
|
||||
1. Create and go into the newly created folder in which you want to keep the code of the node
|
||||
1. Use CLI to create boilerplate node code: `n8n-node-dev new`
|
||||
1. Answer the questions (the “Execute” node type is the regular node type that you probably want to create).
|
||||
It will then create the node in the current folder.
|
||||
1. Program… Add the functionality to the node
|
||||
1. Build the node and copy to correct location: `n8n-node-dev build`
|
||||
That command will build the JavaScript version of the node from the TypeScript code and copy it to the user folder where custom nodes get read from `~/.n8n/custom/`
|
||||
1. Restart n8n and refresh the window so that the new node gets displayed
|
||||
|
||||
|
||||
## Create own custom n8n-nodes-module
|
||||
|
||||
If you want to create multiple custom nodes which are either:
|
||||
|
||||
- Only for yourself/your company
|
||||
- Are only useful for a small number of people
|
||||
- Require many or large dependencies
|
||||
|
||||
It is best to create your own `n8n-nodes-module` which can be installed separately.
|
||||
That is a simple npm package that contains the nodes and is set up in a way
|
||||
that n8n can automatically find and load them on startup.
|
||||
|
||||
When creating such a module the following rules have to be followed that n8n
|
||||
can automatically find the nodes in the module:
|
||||
|
||||
- The name of the module has to start with `n8n-nodes-`
|
||||
- The `package.json` file has to contain a key `n8n` with the paths to nodes and credentials
|
||||
- The module has to be installed alongside n8n
|
||||
|
||||
An example starter module which contains one node and credentials and implements
|
||||
the above can be found here:
|
||||
|
||||
[https://github.com/n8n-io/n8n-nodes-starter](https://github.com/n8n-io/n8n-nodes-starter)
|
||||
|
||||
|
||||
### Setup to use n8n-nodes-module
|
||||
|
||||
To use a custom `n8n-nodes-module`, it simply has to be installed alongside n8n.
|
||||
For example like this:
|
||||
|
||||
```bash
|
||||
# Create folder for n8n installation
|
||||
mkdir my-n8n
|
||||
cd my-n8n
|
||||
|
||||
# Install n8n
|
||||
npm install n8n
|
||||
|
||||
# Install custom nodes module
|
||||
npm install n8n-nodes-my-custom-nodes
|
||||
|
||||
# Start n8n
|
||||
n8n
|
||||
```
|
||||
|
||||
|
||||
### Development/Testing of custom n8n-nodes-module
|
||||
|
||||
This works in the same way as for any other npm module.
|
||||
|
||||
Execute in the folder which contains the code of the custom `n8n-nodes-module`
|
||||
which should be loaded with n8n:
|
||||
|
||||
```bash
|
||||
# Build the code
|
||||
npm run build
|
||||
|
||||
# "Publish" the package locally
|
||||
npm link
|
||||
```
|
||||
|
||||
Then in the folder in which n8n is installed:
|
||||
|
||||
```bash
|
||||
# "Install" the above locally published module
|
||||
npm link n8n-nodes-my-custom-nodes
|
||||
|
||||
# Start n8n
|
||||
n8n
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Node Development Guidelines
|
||||
|
||||
|
||||
Please make sure that everything works correctly and that no unnecessary code gets added. It is important to follow the following guidelines:
|
||||
|
||||
|
||||
### Do not change incoming data
|
||||
|
||||
Never change the incoming data a node receives (which can be queried with `this.getInputData()`) as it gets shared by all nodes. If data has to get added, changed or deleted it has to be cloned and the new data returned. If that is not done, sibling nodes which execute after the current one will operate on the altered data and would process different data than they were supposed to.
|
||||
It is however not needed to always clone all the data. If a node for, example only, changes only the binary data but not the JSON data, a new item can be created which reuses the reference to the JSON item.
|
||||
|
||||
An example can be seen in the code of the [ReadBinaryFile-Node](https://github.com/n8n-io/n8n/blob/master/packages/nodes-base/nodes/ReadBinaryFile.node.ts#L69-L83).
|
||||
|
||||
|
||||
### Write nodes in TypeScript
|
||||
|
||||
All code of n8n is written in TypeScript and hence, the nodes should also be written in TypeScript. That makes development easier, faster, and avoids at least some bugs.
|
||||
|
||||
|
||||
### Use the built in request library
|
||||
|
||||
Some third-party services have their own libraries on npm which make it easier to create an integration. It can be quite tempting to use them. The problem with those is that you add another dependency and not just one you add but also all the dependencies of the dependencies. This means more and more code gets added, has to get loaded, can introduce security vulnerabilities, bugs and so on. So please use the built-in module which can be used like this:
|
||||
|
||||
```typescript
|
||||
const response = await this.helpers.request(options);
|
||||
```
|
||||
|
||||
That is simply using the npm package [`request-promise-native`](https://github.com/request/request-promise-native) which is the basic npm `request` module but with promises. For a full set of `options` consider looking at [the underlying `request` options documentation](https://github.com/request/request#requestoptions-callback).
|
||||
|
||||
|
||||
### Reuse parameter names
|
||||
|
||||
When a node can perform multiple operations like edit and delete some kind of entity, for both operations, it would need an entity-id. Do not call them "editId" and "deleteId" simply call them "id". n8n can handle multiple parameters with the same name without a problem as long as only one is visible. To make sure that is the case, the "displayOptions" can be used. By keeping the same name, the value can be kept if a user switches the operation from "edit" to "delete".
|
||||
|
||||
|
||||
### Create an "Options" parameter
|
||||
|
||||
Some nodes may need a lot of options. Add only the very important ones to the top level and for all others, create an "Options" parameter where they can be added if needed. This ensures that the interface stays clean and does not unnecessarily confuse people. A good example of that would be the XML node.
|
||||
|
||||
|
||||
### Follow exiting parameter naming guideline
|
||||
|
||||
There is not much of a guideline yet but if your node can do multiple things, call the parameter which sets the behavior either "mode" (like "Merge" and "XML" node) or "operation" like the most other ones. If these operations can be done on different resources (like "User" or "Order) create a "resource" parameter (like "Pipedrive" and "Trello" node)
|
||||
|
||||
|
||||
### Node Icons
|
||||
|
||||
Check existing node icons as a reference when you create own ones. The resolution of an icon should be 60x60px and saved as PNG.
|
|
@ -1,39 +0,0 @@
|
|||
# Data Structure
|
||||
|
||||
For "basic usage" it is not necessarily needed to understand how the data that
|
||||
gets passed from one node to another is structured. However, it becomes important if you want to:
|
||||
|
||||
- create your own node
|
||||
- write custom expressions
|
||||
- use the Function or Function Item node
|
||||
- you want to get the most out of n8n
|
||||
|
||||
|
||||
In n8n, all the data that is passed between nodes is an array of objects. It has the following structure:
|
||||
|
||||
```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)
|
||||
}
|
||||
}
|
||||
},
|
||||
...
|
||||
]
|
||||
```
|
109
docs/database.md
109
docs/database.md
|
@ -1,109 +0,0 @@
|
|||
# Database
|
||||
|
||||
By default, n8n uses SQLite to save credentials, past executions, and workflows. However,
|
||||
n8n also supports MongoDB and PostgresDB.
|
||||
|
||||
|
||||
## Shared Settings
|
||||
|
||||
The following environment variables get used by all databases:
|
||||
|
||||
- `DB_TABLE_PREFIX` (default: '') - Prefix for table names
|
||||
|
||||
|
||||
## MongoDB
|
||||
|
||||
!> **WARNING**: Use PostgresDB, if possible! MongoDB has problems saving large
|
||||
amounts of data in a document, among other issues. So, support
|
||||
may be dropped in the future.
|
||||
|
||||
To use MongoDB as the database, you can provide the following environment variables like
|
||||
in the example below:
|
||||
- `DB_TYPE=mongodb`
|
||||
- `DB_MONGODB_CONNECTION_URL=<CONNECTION_URL>`
|
||||
|
||||
Replace the following placeholders with the actual data:
|
||||
- MONGO_DATABASE
|
||||
- MONGO_HOST
|
||||
- MONGO_PORT
|
||||
- MONGO_USER
|
||||
- MONGO_PASSWORD
|
||||
|
||||
```bash
|
||||
export DB_TYPE=mongodb
|
||||
export DB_MONGODB_CONNECTION_URL=mongodb://MONGO_USER:MONGO_PASSWORD@MONGO_HOST:MONGO_PORT/MONGO_DATABASE
|
||||
n8n start
|
||||
```
|
||||
|
||||
|
||||
## PostgresDB
|
||||
|
||||
To use PostgresDB as the database, you can provide the following environment variables
|
||||
- `DB_TYPE=postgresdb`
|
||||
- `DB_POSTGRESDB_DATABASE` (default: 'n8n')
|
||||
- `DB_POSTGRESDB_HOST` (default: 'localhost')
|
||||
- `DB_POSTGRESDB_PORT` (default: 5432)
|
||||
- `DB_POSTGRESDB_USER` (default: 'root')
|
||||
- `DB_POSTGRESDB_PASSWORD` (default: empty)
|
||||
- `DB_POSTGRESDB_SCHEMA` (default: 'public')
|
||||
|
||||
|
||||
```bash
|
||||
export DB_TYPE=postgresdb
|
||||
export DB_POSTGRESDB_DATABASE=n8n
|
||||
export DB_POSTGRESDB_HOST=postgresdb
|
||||
export DB_POSTGRESDB_PORT=5432
|
||||
export DB_POSTGRESDB_USER=n8n
|
||||
export DB_POSTGRESDB_PASSWORD=n8n
|
||||
export DB_POSTGRESDB_SCHEMA=n8n
|
||||
|
||||
n8n start
|
||||
```
|
||||
|
||||
## MySQL / MariaDB
|
||||
|
||||
The compatibility with MySQL/MariaDB has been tested. Even then, it is advisable to observe the operation of the application with this database as this option has been recently added. If you spot any problems, feel free to submit a burg report or a pull request.
|
||||
|
||||
To use MySQL as database you can provide the following environment variables:
|
||||
- `DB_TYPE=mysqldb` or `DB_TYPE=mariadb`
|
||||
- `DB_MYSQLDB_DATABASE` (default: 'n8n')
|
||||
- `DB_MYSQLDB_HOST` (default: 'localhost')
|
||||
- `DB_MYSQLDB_PORT` (default: 3306)
|
||||
- `DB_MYSQLDB_USER` (default: 'root')
|
||||
- `DB_MYSQLDB_PASSWORD` (default: empty)
|
||||
|
||||
|
||||
```bash
|
||||
export DB_TYPE=mysqldb
|
||||
export DB_MYSQLDB_DATABASE=n8n
|
||||
export DB_MYSQLDB_HOST=mysqldb
|
||||
export DB_MYSQLDB_PORT=3306
|
||||
export DB_MYSQLDB_USER=n8n
|
||||
export DB_MYSQLDB_PASSWORD=n8n
|
||||
|
||||
n8n start
|
||||
```
|
||||
|
||||
## SQLite
|
||||
|
||||
This is the default database that gets used if nothing is defined.
|
||||
|
||||
The database file is located at:
|
||||
`~/.n8n/database.sqlite`
|
||||
|
||||
|
||||
## Other Databases
|
||||
|
||||
Currently, only the databases mentioned above are supported. n8n internally uses
|
||||
[TypeORM](https://typeorm.io), so adding support for the following databases
|
||||
should not be too much work:
|
||||
|
||||
- CockroachDB
|
||||
- Microsoft SQL
|
||||
- Oracle
|
||||
|
||||
If you cannot use any of the currently supported databases for some reason and
|
||||
you can code, we'd appreciate your support in the form of a pull request. If not, you can request
|
||||
for support here:
|
||||
|
||||
[https://community.n8n.io/c/feature-requests/cli](https://community.n8n.io/c/feature-requests/cli)
|
|
@ -1,3 +0,0 @@
|
|||
# Development
|
||||
|
||||
Have you found a bug :bug:? Or maybe you have a nice feature :sparkles: to contribute? The [CONTRIBUTING guide](https://github.com/n8n-io/n8n/blob/master/CONTRIBUTING.md) will help you get your development environment ready in minutes.
|
|
@ -1,7 +0,0 @@
|
|||
# Docker
|
||||
|
||||
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 Let's Encrypt is available on the
|
||||
[Server Setup](server-setup.md) page.
|
47
docs/faq.md
47
docs/faq.md
|
@ -1,47 +0,0 @@
|
|||
# FAQ
|
||||
|
||||
## Integrations
|
||||
|
||||
|
||||
### Can you create an integration for service X?
|
||||
|
||||
You can request new integrations to be added to our forum. There is a special section for that where
|
||||
other users can also upvote it so that we know which integrations are important and should be
|
||||
created next. Request a new feature [here](https://community.n8n.io/c/feature-requests/nodes).
|
||||
|
||||
|
||||
### An integration exists already but a feature is missing. Can you add it?
|
||||
|
||||
Adding new functionality to an existing integration is normally not that complicated. So the chance is
|
||||
high that we can do that quite fast. Post your feature request in the forum and we'll see
|
||||
what we can do. Request a new feature [here](https://community.n8n.io/c/feature-requests/nodes).
|
||||
|
||||
|
||||
### How can I create an integration myself?
|
||||
|
||||
Information about that can be found in the [CONTRIBUTING guide](https://github.com/n8n-io/n8n/blob/master/CONTRIBUTING.md).
|
||||
|
||||
|
||||
## License
|
||||
|
||||
|
||||
### Which license does n8n use?
|
||||
|
||||
n8n is [fair-code](http://faircode.io) licensed under [Apache 2.0 with Commons Clause](https://github.com/n8n-io/n8n/blob/master/packages/cli/LICENSE.md)
|
||||
|
||||
|
||||
### Is n8n open-source?
|
||||
|
||||
No. The [Commons Clause](https://commonsclause.com) that is attached to the Apache 2.0 license takes away some rights. Hence, according to the definition of the [Open Source Initiative (OSI)](https://opensource.org/osd), n8n is not open-source. Nonetheless, the source code is open and everyone (individuals and companies) can use it for free. However, it is not allowed to make money directly with n8n.
|
||||
|
||||
For instance, one cannot charge others to host or support n8n. However, to make things simpler, we grant everyone (individuals and companies) the right to offer consulting or support without prior permission as long as it is less than 30,000 USD ($30k) per annum.
|
||||
If your revenue from services based on n8n is greater than $30k per annum, we'd invite you to become a partner and apply for a license. If you have any questions about this, feel free to reach out to us at [license@n8n.io](mailto:license@n8n.io).
|
||||
|
||||
|
||||
### Why is n8n not open-source but [fair-code](http://faircode.io) licensed instead?
|
||||
|
||||
We love open-source and the idea that everybody can freely use and extend what we wrote. Our community is at the heart of everything that we do and we understand that people who contribute to a project are the main drivers that push a project forward. So to make sure that the project continues to evolve and stay alive in the longer run, we decided to attach the Commons Clause. This ensures that no other person or company can make money directly with n8n. Especially if it competes with how we plan to finance our further development. For the greater majority of the people, it will not make any difference at all. At the same time, it protects the project.
|
||||
|
||||
As n8n itself depends on and uses a lot of other open-source projects, it is only fair that we support them back. That is why we have planned to contribute a certain percentage of revenue/profit every month to these projects.
|
||||
|
||||
We have already started with the first monthly contributions via [Open Collective](https://opencollective.com/n8n). It is not much yet, but we hope to be able to ramp that up substantially over time.
|
Binary file not shown.
Before Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 127 KiB |
|
@ -1,53 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>n8n Documentation</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<meta name="description" content="Documentation of n8n - Open Source Workflow Automation Tool">
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
|
||||
<style>
|
||||
.app-name-link img {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.sidebar-nav a img {
|
||||
position: relative;
|
||||
top: 3px;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="//unpkg.com/docsify-edit-on-github/index.js"></script>
|
||||
<script>
|
||||
window.$docsify = {
|
||||
auto2top: true,
|
||||
ga: 'UA-146470481-3',
|
||||
themeColor: '#ff0000',
|
||||
name: 'docs.n8n.io',
|
||||
logo: 'images/n8n-logo.png',
|
||||
loadSidebar: true,
|
||||
subMaxLevel: 2,
|
||||
repo: '',
|
||||
plugins: [
|
||||
EditOnGithubPlugin.create('https://github.com/n8n-io/n8n/tree/master/docs/')
|
||||
]
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
<script src="https://unpkg.com/docsify-copy-code@2"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-yaml.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-json.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-typescript.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,25 +0,0 @@
|
|||
# Key Components
|
||||
|
||||
|
||||
## Connection
|
||||
|
||||
A connection establishes a link between nodes to route data through the workflow. Each node can have one or multiple connections.
|
||||
|
||||
|
||||
## Node
|
||||
|
||||
A node is an entry point for retrieving data, a function to process data or an exit for sending data. The data process includes filtering, recomposing and changing data. There can be one or several nodes for your API, service or app. You can easily connect multiple nodes, which allows you to create simple and complex workflows with them intuitively.
|
||||
|
||||
For example, consider a Google Sheets node. It can be used to retrieve or write data to a Google Sheet.
|
||||
|
||||
|
||||
## Trigger Node
|
||||
|
||||
A trigger node is a node that starts a workflow and supplies the initial data. What triggers it, depends on the node. It could be the time, a webhook call or an event from an external service.
|
||||
|
||||
For example, consider a Trello trigger node. When a Trello Board gets updated, it will trigger a workflow to start using the data from the updated board.
|
||||
|
||||
|
||||
## Workflow
|
||||
|
||||
A workflow is a canvas on which you can place and connect nodes. A workflow can be started manually or by trigger nodes. A workflow run ends when all active and connected nodes have processed their data.
|
|
@ -1,28 +0,0 @@
|
|||
# Keyboard Shortcuts
|
||||
|
||||
The following keyboard shortcuts can currently be used:
|
||||
|
||||
## General
|
||||
|
||||
- **Ctrl + Left Mouse Button**: Move/Pan Node View
|
||||
- **Ctrl + a**: Select all nodes
|
||||
- **Ctrl + Alt + n**: Create new workflow
|
||||
- **Ctrl + o**: Open workflow
|
||||
- **Ctrl + s**: Save the current workflow
|
||||
- **Ctrl + v**: Paste nodes
|
||||
- **Tab**: Open "Node Creator". Type to filter and navigate with arrow keys. To create press "enter"
|
||||
|
||||
|
||||
## With node(s) selected
|
||||
|
||||
- **ArrowDown**: Select sibling node bellow the current one
|
||||
- **ArrowLeft**: Select node left of the current one
|
||||
- **ArrowRight**: Select node right of the current one
|
||||
- **ArrowUp**: Select sibling node above the current one
|
||||
- **Ctrl + c**: Copy nodes
|
||||
- **Ctrl + x**: Cut nodes
|
||||
- **d**: Deactivate nodes
|
||||
- **Delete**: Delete nodes
|
||||
- **F2**: Rename node
|
||||
- **Shift + ArrowLeft**: Select all nodes left of the current one
|
||||
- **Shift + ArrowRight**: Select all nodes right of the current one
|
|
@ -1,5 +0,0 @@
|
|||
# License
|
||||
|
||||
n8n is [fair-code](http://faircode.io) licensed under [Apache 2.0 with Commons Clause](https://github.com/n8n-io/n8n/blob/master/packages/cli/LICENSE.md)
|
||||
|
||||
Additional information about the license can be found in the [FAQ](faq.md?id=license) and [fair-code](http://faircode.io).
|
|
@ -1,76 +0,0 @@
|
|||
# Node Basics
|
||||
|
||||
|
||||
## Types
|
||||
|
||||
There are two main node types in n8n: Trigger nodes 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, only one of them will execute. This is because the other trigger nodes would not have any input as they are the nodes from which the execution of the workflow starts.
|
||||
|
||||
|
||||
### Regular Nodes
|
||||
|
||||
These nodes do the actual work. They can add, remove, and edit the data in the flow as well as request and send data to external APIs. They can do everything possible with Node.js in general.
|
||||
|
||||
|
||||
## Credentials
|
||||
|
||||
External services need a way to identify and authenticate users. This data can range from an API key over an email/password combination to a very long multi-line private key and can be saved in n8n as credentials.
|
||||
|
||||
Nodes in n8n can then request that credential information. As an additional layer of security credentials can only be accessed by node types which specifically have the right to do so.
|
||||
|
||||
To make sure that the data is secure, it gets saved to the database encrypted. A random personal encryption key is used which gets automatically generated on the first run of n8n and then saved under `~/.n8n/config`.
|
||||
|
||||
|
||||
## 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. Expressions 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"].json["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
|
||||
- **$evaluateExpression**: Evaluates a string as expression
|
||||
- **$env**: Environment variables
|
||||
- **$items**: Environment variables
|
||||
- **$json**: Incoming JSON data of a node
|
||||
- **$node**: Data of other nodes (binary, context, json, parameter, runIndex)
|
||||
- **$parameters**: Parameters of the current node
|
||||
- **$runIndex**: The current run index (first time node gets executed it is 0, second time 1, ...)
|
||||
- **$workflow**: Returns workflow metadata like: active, id, name
|
||||
|
||||
Normally it is not needed to write the JavaScript variables manually as they can be selected with the help of the Expression Editor.
|
||||
|
||||
|
||||
## Parameters
|
||||
|
||||
Parameters can be set for most nodes in n8n. The values that get set define what exactly a node does.
|
||||
|
||||
Parameter values are static by default and are always the same no matter what kind of data the node processes. However, it is possible to set the values dynamically with the help of an Expression. Using Expressions, it is possible to make the parameter value dependent 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 specific nodes. To do that without disconnecting each node, you can pause them. When a node gets paused, the data passes through the node without being changed.
|
||||
|
||||
There are two ways to pause a node. You can either press the pause button which gets displayed above the node when hovering over it or select the node and press “d”.
|
247
docs/nodes.md
247
docs/nodes.md
|
@ -1,247 +0,0 @@
|
|||
# Nodes
|
||||
|
||||
## Function and Function Item Nodes
|
||||
|
||||
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 give you access to the incoming data
|
||||
and you can manipulate it.
|
||||
|
||||
|
||||
### Difference between both nodes
|
||||
|
||||
The difference is that the code of the Function node gets executed only once. It receives the
|
||||
full items (JSON and binary data) as an array and expects an array of items as a return value. The items
|
||||
returned can be totally different from the incoming ones. So it is not only possible to remove and edit
|
||||
existing items, but also to add or return totally new ones.
|
||||
|
||||
The code of the Function Item node on the other hand gets executed once for every item. It receives
|
||||
one item at a time as input and also just the JSON data. As a return value, it expects the JSON data
|
||||
of one single item. That makes it possible to 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.
|
||||
|
||||
|
||||
### Function-Node
|
||||
|
||||
#### Variable: items
|
||||
|
||||
It contains all the items that the node received as input.
|
||||
|
||||
Information about how the data is structured can be found on the page [Data Structure](data-structure.md).
|
||||
|
||||
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;
|
||||
|
||||
return items;
|
||||
```
|
||||
|
||||
This example creates 10 dummy items with the ids 0 to 9:
|
||||
|
||||
```typescript
|
||||
const newItems = [];
|
||||
|
||||
for (let i=0;i<10;i++) {
|
||||
newItems.push({
|
||||
json: {
|
||||
id: i
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return newItems;
|
||||
```
|
||||
|
||||
|
||||
#### Method: $item(index: number, runIndex?: number)
|
||||
|
||||
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, 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.
|
||||
|
||||
The index is 0 based. So `$item(0)` will return the first item, `$item(1)` the second one, ...
|
||||
|
||||
By default the item of the last run of the node will be returned. So if the referenced node ran
|
||||
3x (its last runIndex is 2) and the current node runs the first time (its runIndex is 0) the
|
||||
data of runIndex 2 of the referenced node will be returned.
|
||||
|
||||
For more information about what data can be accessed via $node, check [here](#variable-node).
|
||||
|
||||
Example:
|
||||
|
||||
```typescript
|
||||
// Returns the value of the JSON data property "myNumber" of Node "Set" (first item)
|
||||
const myNumber = $item(0).$node["Set"].json["myNumber"];
|
||||
// Like above but data of the 6th item
|
||||
const myNumber = $item(5).$node["Set"].json["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"];
|
||||
```
|
||||
|
||||
|
||||
#### Method: $items(nodeName?: string, outputIndex?: number, runIndex?: number)
|
||||
|
||||
Gives access to all the items of current or parent nodes. If no parameters get supplied,
|
||||
it returns all the items of the current node.
|
||||
If a node-name is given, it returns the items the node output on its first output
|
||||
(index: 0, most nodes only have one output, exceptions are IF and Switch-Node) on
|
||||
its last run.
|
||||
|
||||
Example:
|
||||
|
||||
```typescript
|
||||
// Returns all the items of the current node and current run
|
||||
const allItems = $items();
|
||||
|
||||
// Returns all items the node "IF" outputs (index: 0 which is Output "true" of its most recent run)
|
||||
const allItems = $items("IF");
|
||||
|
||||
// Returns all items the node "IF" outputs (index: 0 which is Output "true" of the same run as current node)
|
||||
const allItems = $items("IF", 0, $runIndex);
|
||||
|
||||
// Returns all items the node "IF" outputs (index: 1 which is Output "false" of run 0 which is the first run)
|
||||
const allItems = $items("IF", 1, 0);
|
||||
```
|
||||
|
||||
|
||||
#### Variable: $node
|
||||
|
||||
Works exactly like `$item` with the difference that it will always return the data of the first item and
|
||||
the last run of the node.
|
||||
|
||||
```typescript
|
||||
// Returns the fileName of binary property "data" of Node "HTTP Request"
|
||||
const fileName = $node["HTTP Request"].binary["data"]["fileName"]}}
|
||||
|
||||
// Returns the context data "noItemsLeft" of Node "SplitInBatches"
|
||||
const noItemsLeft = $node["SplitInBatches"].context["noItemsLeft"];
|
||||
|
||||
// Returns the value of the JSON data property "myNumber" of Node "Set"
|
||||
const myNumber = $node["Set"].json['myNumber'];
|
||||
|
||||
// Returns the value of the parameter "channel" of Node "Slack"
|
||||
const channel = $node["Slack"].parameter["channel"];
|
||||
|
||||
// Returns the index of the last run of Node "HTTP Request"
|
||||
const runIndex = $node["HTTP Request"].runIndex}}
|
||||
```
|
||||
|
||||
|
||||
#### Variable: $runIndex
|
||||
|
||||
Contains the index of the current run of the node.
|
||||
|
||||
```typescript
|
||||
// Returns all items the node "IF" outputs (index: 0 which is Output "true" of the same run as current node)
|
||||
const allItems = $items("IF", 0, $runIndex);
|
||||
```
|
||||
|
||||
|
||||
#### Variable: $workflow
|
||||
|
||||
Gives information about the current workflow.
|
||||
|
||||
```typescript
|
||||
const isActive = $workflow.active;
|
||||
const workflowId = $workflow.id;
|
||||
const workflowName = $workflow.name;
|
||||
```
|
||||
|
||||
|
||||
#### Method: $evaluateExpression(expression: string, itemIndex: number)
|
||||
|
||||
Evaluates a given string as expression.
|
||||
If no `itemIndex` is provided it uses by default in the Function-Node the data of item 0 and
|
||||
in the Function Item-Node the data of the current item.
|
||||
|
||||
Example:
|
||||
|
||||
```javascript
|
||||
items[0].json.variable1 = $evaluateExpression('{{1+2}}');
|
||||
items[0].json.variable2 = $evaluateExpression($node["Set"].json["myExpression"], 1);
|
||||
|
||||
return items;
|
||||
```
|
||||
|
||||
|
||||
#### 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, delete or
|
||||
set on that object. When the workflow execution succeeds, n8n will check automatically if the data
|
||||
has 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 set it can retrieve it again.
|
||||
|
||||
Example:
|
||||
|
||||
```javascript
|
||||
// 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 the static data can not be read and written when testing via the UI.
|
||||
The data there will always be empty and the changes will not persist. Only when a workflow
|
||||
is active and it gets called by a Trigger or Webhook, the static data will 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,43 +0,0 @@
|
|||
# Quick Start
|
||||
|
||||
|
||||
## Give n8n a spin
|
||||
|
||||
To spin up n8n, you can run:
|
||||
|
||||
```bash
|
||||
npx n8n
|
||||
```
|
||||
|
||||
It will download everything that is needed to start n8n.
|
||||
|
||||
You can then access n8n by opening:
|
||||
[http://localhost:5678](http://localhost:5678)
|
||||
|
||||
|
||||
## Start with docker
|
||||
|
||||
To play around with n8n, you can also start it using docker:
|
||||
|
||||
```bash
|
||||
docker run -it --rm \
|
||||
--name n8n \
|
||||
-p 5678:5678 \
|
||||
n8nio/n8n
|
||||
```
|
||||
|
||||
Be aware that all the data will be lost once the docker container gets removed. To
|
||||
persist the data mount the `~/.n8n` folder:
|
||||
|
||||
```bash
|
||||
docker run -it --rm \
|
||||
--name n8n \
|
||||
-p 5678:5678 \
|
||||
-v ~/.n8n:/root/.n8n \
|
||||
n8nio/n8n
|
||||
```
|
||||
|
||||
More information about the Docker setup can be found in the README file of the
|
||||
[Docker Image](https://github.com/n8n-io/n8n/blob/master/docker/images/n8n/README.md).
|
||||
|
||||
In case you run into issues, check out the [troubleshooting](troubleshooting.md) page or ask for help in the community [forum](https://community.n8n.io/).
|
|
@ -1,13 +0,0 @@
|
|||
# Security
|
||||
|
||||
By default, n8n can be accessed by everybody. This is okay if you only have it running
|
||||
locally but if you deploy it on a server which is accessible from the web, you have
|
||||
to make sure that n8n is protected.
|
||||
Right now we have very basic protection in place using basic-auth. It can be activated
|
||||
by setting the following environment variables:
|
||||
|
||||
```bash
|
||||
export N8N_BASIC_AUTH_ACTIVE=true
|
||||
export N8N_BASIC_AUTH_USER=<USER>
|
||||
export N8N_BASIC_AUTH_PASSWORD=<PASSWORD>
|
||||
```
|
|
@ -1,18 +0,0 @@
|
|||
# Sensitive Data via File
|
||||
|
||||
To avoid passing sensitive information via environment variables, "_FILE" may be
|
||||
appended to some environment variables. It will then load the data from a file
|
||||
with the given name. That makes it possible to load data easily from
|
||||
Docker and Kubernetes secrets.
|
||||
|
||||
The following environment variables support file input:
|
||||
|
||||
- DB_MONGODB_CONNECTION_URL_FILE
|
||||
- DB_POSTGRESDB_DATABASE_FILE
|
||||
- DB_POSTGRESDB_HOST_FILE
|
||||
- DB_POSTGRESDB_PASSWORD_FILE
|
||||
- DB_POSTGRESDB_PORT_FILE
|
||||
- DB_POSTGRESDB_USER_FILE
|
||||
- DB_POSTGRESDB_SCHEMA_FILE
|
||||
- N8N_BASIC_AUTH_PASSWORD_FILE
|
||||
- N8N_BASIC_AUTH_USER_FILE
|
|
@ -1,183 +0,0 @@
|
|||
# Server Setup
|
||||
|
||||
!> ***Important***: Make sure that you secure your n8n instance as described under [Security](security.md).
|
||||
|
||||
|
||||
## Example setup with docker-compose
|
||||
|
||||
If you have already installed docker and docker-compose, then you can directly start with step 4.
|
||||
|
||||
|
||||
### 1. Install Docker
|
||||
|
||||
This can vary depending on the Linux distribution used. Example bellow is for Ubuntu:
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install apt-transport-https ca-certificates curl software-properties-common
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
|
||||
sudo apt update
|
||||
sudo apt install docker-ce -y
|
||||
```
|
||||
|
||||
### 2. Optional: If it should run as not root user
|
||||
|
||||
Run when logged in as the user that should also be allowed to run docker:
|
||||
|
||||
```bash
|
||||
sudo usermod -aG docker ${USER}
|
||||
su - ${USER}
|
||||
```
|
||||
|
||||
### 3. Install Docker-compose
|
||||
|
||||
This can vary depending on the Linux distribution used. Example bellow is for Ubuntu:
|
||||
|
||||
Check before what version the latestand replace "1.24.1" with that version accordingly.
|
||||
https://github.com/docker/compose/releases
|
||||
|
||||
```bash
|
||||
sudo curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
|
||||
sudo chmod +x /usr/local/bin/docker-compose
|
||||
```
|
||||
|
||||
|
||||
### 4. Setup DNS
|
||||
|
||||
Add A record to route the subdomain accordingly.
|
||||
|
||||
```
|
||||
Type: A
|
||||
Name: n8n (or whatever the subdomain should be)
|
||||
IP address: <IP_OF_YOUR_SERVER>
|
||||
```
|
||||
|
||||
|
||||
### 5. Create docker-compose file
|
||||
|
||||
Save this file as `docker-compose.yml`
|
||||
|
||||
Normally no changes should be needed.
|
||||
|
||||
```yaml
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
traefik:
|
||||
image: "traefik"
|
||||
command:
|
||||
- "--api=true"
|
||||
- "--api.insecure=true"
|
||||
- "--providers.docker=true"
|
||||
- "--providers.docker.exposedbydefault=false"
|
||||
- "--entrypoints.websecure.address=:443"
|
||||
- "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
|
||||
- "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
|
||||
- "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
|
||||
ports:
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ${DATA_FOLDER}/letsencrypt:/letsencrypt
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
|
||||
n8n:
|
||||
image: n8nio/n8n
|
||||
ports:
|
||||
- "127.0.0.1:5678:5678"
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
|
||||
- traefik.http.routers.n8n.tls=true
|
||||
- traefik.http.routers.n8n.entrypoints=websecure
|
||||
- traefik.http.routers.n8n.tls.certresolver=mytlschallenge
|
||||
- traefik.http.middlewares.n8n.headers.SSLRedirect=true
|
||||
- traefik.http.middlewares.n8n.headers.STSSeconds=315360000
|
||||
- traefik.http.middlewares.n8n.headers.browserXSSFilter=true
|
||||
- traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
|
||||
- traefik.http.middlewares.n8n.headers.forceSTSHeader=true
|
||||
- traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
|
||||
- traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
|
||||
- traefik.http.middlewares.n8n.headers.STSPreload=true
|
||||
environment:
|
||||
- N8N_BASIC_AUTH_ACTIVE=true
|
||||
- N8N_BASIC_AUTH_USER
|
||||
- N8N_BASIC_AUTH_PASSWORD
|
||||
- N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
|
||||
- N8N_PORT=5678
|
||||
- N8N_LISTEN_ADDRESS=0.0.0.0
|
||||
- N8N_PROTOCOL=https
|
||||
- NODE_ENV=production
|
||||
- WEBHOOK_TUNNEL_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
|
||||
- VUE_APP_URL_BASE_API=https://${SUBDOMAIN}.${DOMAIN_NAME}/
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ${DATA_FOLDER}/.n8n:/root/.n8n
|
||||
```
|
||||
|
||||
|
||||
### 6. Create `.env` file
|
||||
|
||||
Create `.env` file and change it accordingly.
|
||||
|
||||
```bash
|
||||
# Folder where data should be saved
|
||||
DATA_FOLDER=/root/n8n/
|
||||
|
||||
# The top level domain to serve from
|
||||
DOMAIN_NAME=example.com
|
||||
|
||||
# The subdomain to serve from
|
||||
SUBDOMAIN=n8n
|
||||
|
||||
# DOMAIN_NAME and SUBDOMAIN combined decide where n8n will be reachable from
|
||||
# above example would result in: https://n8n.example.com
|
||||
|
||||
# The user name to use for autentication - IMPORTANT ALWAYS CHANGE!
|
||||
N8N_BASIC_AUTH_USER=user
|
||||
|
||||
# The password to use for autentication - IMPORTANT ALWAYS CHANGE!
|
||||
N8N_BASIC_AUTH_PASSWORD=password
|
||||
|
||||
# Optional timezone to set which gets used by Cron-Node by default
|
||||
# If not set New York time will be used
|
||||
GENERIC_TIMEZONE=Europe/Berlin
|
||||
|
||||
# The email address to use for the SSL certificate creation
|
||||
SSL_EMAIL=user@example.com
|
||||
```
|
||||
|
||||
|
||||
### 7. Create data folder
|
||||
|
||||
Create the folder which is defined as `DATA_FOLDER`. In the example
|
||||
above, it is `/root/n8n/`.
|
||||
|
||||
In that folder, the database file from SQLite as well as the encryption key will be saved.
|
||||
|
||||
The folder can be created like this:
|
||||
```
|
||||
mkdir /root/n8n/
|
||||
```
|
||||
|
||||
|
||||
### 8. Start docker-compose setup
|
||||
|
||||
n8n can now be started via:
|
||||
|
||||
```bash
|
||||
sudo docker-compose up -d
|
||||
```
|
||||
|
||||
In case it should ever be stopped that can be done with this command:
|
||||
```bash
|
||||
sudo docker-compose stop
|
||||
```
|
||||
|
||||
|
||||
### 9. Done
|
||||
|
||||
n8n will now be reachable via the above defined subdomain + domain combination.
|
||||
The above example would result in: https://n8n.example.com
|
||||
|
||||
n8n will only be reachable via https and not via http.
|
|
@ -1,35 +0,0 @@
|
|||
# Setup
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
To install n8n globally:
|
||||
|
||||
```bash
|
||||
npm install n8n -g
|
||||
```
|
||||
|
||||
## Start
|
||||
|
||||
After the installation n8n can be started by simply typing in:
|
||||
|
||||
```bash
|
||||
n8n
|
||||
# or
|
||||
n8n start
|
||||
```
|
||||
|
||||
|
||||
## Start with tunnel
|
||||
|
||||
!> **WARNING**: This is only meant for local development and testing. It should not be used in production!
|
||||
|
||||
To be able to use webhooks for trigger nodes of external services like GitHub, n8n has to be reachable from the web. To make that easy, n8n has a special tunnel service, which redirects requests from our servers to your local n8n instance (uses this code: [https://github.com/localtunnel/localtunnel](https://github.com/localtunnel/localtunnel)).
|
||||
|
||||
To use it, simply start n8n with `--tunnel`
|
||||
|
||||
```bash
|
||||
n8n start --tunnel
|
||||
```
|
||||
|
||||
In case you run into issues, check out the [troubleshooting](troubleshooting.md) page or ask for help in the community [forum](https://community.n8n.io/).
|
|
@ -1,15 +0,0 @@
|
|||
# Start Workflows via CLI
|
||||
|
||||
Workflows cannot be only started by triggers, webhooks or manually via the
|
||||
Editor. It is also possible to start them directly via the CLI.
|
||||
|
||||
Execute a saved workflow by its ID:
|
||||
|
||||
```bash
|
||||
n8n execute --id <ID>
|
||||
```
|
||||
|
||||
Execute a workflow from a workflow file:
|
||||
```bash
|
||||
n8n execute --file <WORKFLOW_FILE>
|
||||
```
|
|
@ -1,3 +0,0 @@
|
|||
# This is a simple test
|
||||
|
||||
with some text
|
|
@ -1,58 +0,0 @@
|
|||
# Troubleshooting
|
||||
|
||||
## Windows
|
||||
|
||||
If you are experiencing issues running n8n with the typical flow of:
|
||||
|
||||
```powershell
|
||||
npx n8n
|
||||
```
|
||||
|
||||
### Requirements
|
||||
|
||||
Please ensure that you have the following requirements fulfilled:
|
||||
|
||||
- Install latest version of [NodeJS](https://nodejs.org/en/download/)
|
||||
- Install [Python 2.7](https://www.python.org/downloads/release/python-2717/) (It is okay to have multiple versions installed on the machine)
|
||||
- Windows SDK
|
||||
- C++ Desktop Development Tools
|
||||
- Windows Build Tools
|
||||
|
||||
#### Install build tools
|
||||
|
||||
If you haven't satisfied the above, follow this procedure through your PowerShell (run with administrative privileges).
|
||||
This command installs the build tools, windows SDK and the C++ development tools in one package.
|
||||
|
||||
```powershell
|
||||
npm install --global --production windows-build-tools
|
||||
```
|
||||
|
||||
#### Configure npm to use Python version 2.7
|
||||
|
||||
```powershell
|
||||
npm config set python python2.7
|
||||
```
|
||||
|
||||
#### Configure npm to use correct msvs version
|
||||
|
||||
```powershell
|
||||
npm config set msvs_version 2017 --global
|
||||
```
|
||||
|
||||
### Lesser known issues:
|
||||
|
||||
#### mmmagic npm package when using MSbuild tools with Visual Studio
|
||||
|
||||
While installing this package, `node-gyp` is run and it might fail to install it with an error appearing in the ballpark of:
|
||||
|
||||
```
|
||||
gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\**Enterprise**\MSBuild\Current\Bin\MSBuild.exe ENOENT
|
||||
```
|
||||
|
||||
It is seeking the `MSBuild.exe` in a directory that does not exist. If you are using Visual Studio Community or vice versa, you can change the path of MSBuild with command:
|
||||
|
||||
```powershell
|
||||
npm config set msbuild_path "C:\Program Files (x86)\Microsoft Visual Studio\2019\**Community**\MSBuild\Current\Bin\MSBuild.exe"
|
||||
```
|
||||
|
||||
Attempt to install package again after running the command above.
|
|
@ -1,26 +0,0 @@
|
|||
# Tutorials
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
Example workflows which show what can be done with n8n can be found here:
|
||||
[https://n8n.io/workflows](https://n8n.io/workflows)
|
||||
|
||||
If you want to know how a node can get used in context, you can search for it here:
|
||||
[https://n8n.io/nodes](https://n8n.io/nodes). There it shows in which workflows the
|
||||
node got used.
|
||||
|
||||
|
||||
|
||||
## Videos
|
||||
|
||||
- [Slack Notification on Github Star](https://www.youtube.com/watch?v=3w7xIMKLVAg)
|
||||
- [Typeform to Google Sheet and Slack or Email](https://www.youtube.com/watch?v=rn3-d4IiW44)
|
||||
|
||||
|
||||
### Community Tutorials
|
||||
|
||||
- [n8n basics 1/3 - Getting Started](https://www.youtube.com/watch?v=JIaxjH2CyFc)
|
||||
- [n8n basics 2/3 - Simple Workflow](https://www.youtube.com/watch?v=ovlxledZfM4)
|
||||
- [n8n basics 3/3 - Transforming JSON](https://www.youtube.com/watch?v=wGAEAcfwV8w)
|
||||
- [n8n Google Integration - Using Google Sheets and Google Api nodes](https://www.youtube.com/watch?v=KFqx8OmkqVE)
|
111
docs/workflow.md
111
docs/workflow.md
|
@ -1,111 +0,0 @@
|
|||
# Workflow
|
||||
|
||||
|
||||
## Activate
|
||||
|
||||
Activating a workflow means that the Trigger and Webhook nodes get activated and can trigger a workflow to run. By default all the newly created workflows are deactivated. That means that even if a Trigger node like the Cron node should start a workflow because a predefined time is reached, it will not unless the workflow gets activated. It is only possible to activate a workflow which contains a Trigger or a Webhook node.
|
||||
|
||||
|
||||
## Data Flow
|
||||
|
||||
Nodes do not only process one "item", they process multiple ones. So if the Trello node is set to "Create-Card" and it has an expression set for "Name" to be set depending on "name" property, it will create a card for each item, always choosing the name-property-value of the current one.
|
||||
|
||||
This data would, for example, create two boards. One named "test1" the other one named "test2":
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
name: "test1"
|
||||
},
|
||||
{
|
||||
name: "test2"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
## Error Workflows
|
||||
|
||||
For each workflow, an optional "Error Workflow" can be set. It gets executed in case the execution of the workflow fails. That makes it possible to, for instance, inform the user via Email or Slack if something goes wrong. The same "Error Workflow" can be set on multiple workflows.
|
||||
|
||||
The only difference between a regular workflow and an "Error Workflow" is that it contains an "Error Trigger" node. So it is important to make sure that this node gets created before setting a workflow as "Error Workflow".
|
||||
|
||||
The "Error Trigger" node will trigger in case the execution fails and receives information about it. The data looks like this:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"execution": {
|
||||
"id": "231",
|
||||
"url": "https://n8n.example.com/execution/231",
|
||||
"retryOf": "34",
|
||||
"error": {
|
||||
"message": "Example Error Message",
|
||||
"stack": "Stacktrace"
|
||||
},
|
||||
"lastNodeExecuted": "Node With Error",
|
||||
"mode": "manual"
|
||||
},
|
||||
"workflow": {
|
||||
"id": "1",
|
||||
"name": "Example Workflow"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
All information is always present except:
|
||||
- **execution.id**: Only present when the execution gets saved in the database
|
||||
- **execution.url**: Only present when the execution gets saved in the database
|
||||
- **execution.retryOf**: Only present when the execution is a retry of a previously failed execution
|
||||
|
||||
|
||||
### Setting Error Workflow
|
||||
|
||||
An "Error Workflow" can be set in the Workflow Settings which can be accessed by pressing the "Workflow" button in the menu on the on the left side. The last option is "Settings". In the window that appears, the "Error Workflow" can be selected via the Dropdown "Error Workflow".
|
||||
|
||||
|
||||
## Share Workflows
|
||||
|
||||
All workflows are JSON and can be shared very easily.
|
||||
|
||||
There are multiple ways to download a workflow as JSON to then share it with other people via Email, Slack, Skype, Dropbox, …
|
||||
|
||||
1. Press the "Download" button under the Workflow menu in the sidebar on the left. It then downloads the workflow as a JSON file.
|
||||
1. Select the nodes in the editor which should be exported and then copy them (Ctrl + c). The nodes then get saved as JSON in the clipboard and can be pasted wherever desired (Ctrl + v).
|
||||
|
||||
Importing that JSON representation again into n8n is as easy and can also be done in different ways:
|
||||
|
||||
1. Press "Import from File" or "Import from URL" under the Workflow menu in the sidebar on the left.
|
||||
1. Copy the JSON workflow to the clipboard (Ctrl + c) and then simply pasting it directly into the editor (Ctrl + v).
|
||||
|
||||
|
||||
## Workflow Settings
|
||||
|
||||
On each workflow, it is possible to set some custom settings and overwrite some of the global default settings. Currently, the following settings can be set:
|
||||
|
||||
|
||||
### Error Workflow
|
||||
|
||||
Workflow to run in case the execution of the current workflow fails. More information in section [Error Workflows](#error-workflows).
|
||||
|
||||
|
||||
### Timezone
|
||||
|
||||
The timezone to use in the current workflow. If not set, the global Timezone (by default "New York" gets used). For instance, this is important for the Cron Trigger node.
|
||||
|
||||
|
||||
### Save Data Error Execution
|
||||
|
||||
If the Execution data of the workflow should be saved when it fails.
|
||||
|
||||
|
||||
### Save Data Success Execution
|
||||
|
||||
If the Execution data of the workflow should be saved when it succeeds.
|
||||
|
||||
|
||||
### Save Manual Executions
|
||||
|
||||
If executions started from the Editor UI should be saved.
|
|
@ -63,6 +63,34 @@ const config = convict({
|
|||
default: 'public',
|
||||
env: 'DB_POSTGRESDB_SCHEMA'
|
||||
},
|
||||
|
||||
ssl: {
|
||||
ca: {
|
||||
doc: 'SSL certificate authority',
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'DB_POSTGRESDB_SSL_CA',
|
||||
},
|
||||
cert: {
|
||||
doc: 'SSL certificate',
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'DB_POSTGRESDB_SSL_CERT',
|
||||
},
|
||||
key: {
|
||||
doc: 'SSL key',
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'DB_POSTGRESDB_SSL_KEY',
|
||||
},
|
||||
rejectUnauthorized: {
|
||||
doc: 'If unauthorized SSL connections should be rejected',
|
||||
format: 'Boolean',
|
||||
default: true,
|
||||
env: 'DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED',
|
||||
},
|
||||
}
|
||||
|
||||
},
|
||||
mysqldb: {
|
||||
database: {
|
||||
|
@ -100,15 +128,23 @@ const config = convict({
|
|||
|
||||
credentials: {
|
||||
overwrite: {
|
||||
// Allows to set default values for credentials which
|
||||
// get automatically prefilled and the user does not get
|
||||
// displayed and can not change.
|
||||
// Format: { CREDENTIAL_NAME: { PARAMTER: VALUE }}
|
||||
doc: 'Overwrites for credentials',
|
||||
format: '*',
|
||||
default: '{}',
|
||||
env: 'CREDENTIALS_OVERWRITE'
|
||||
}
|
||||
data: {
|
||||
// Allows to set default values for credentials which
|
||||
// get automatically prefilled and the user does not get
|
||||
// displayed and can not change.
|
||||
// Format: { CREDENTIAL_NAME: { PARAMTER: VALUE }}
|
||||
doc: 'Overwrites for credentials',
|
||||
format: '*',
|
||||
default: '{}',
|
||||
env: 'CREDENTIALS_OVERWRITE_DATA'
|
||||
},
|
||||
endpoint: {
|
||||
doc: 'Fetch credentials from API',
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'CREDENTIALS_OVERWRITE_ENDPOINT',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
executions: {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "n8n",
|
||||
"version": "0.70.0",
|
||||
"version": "0.72.0",
|
||||
"description": "n8n Workflow Automation Tool",
|
||||
"license": "SEE LICENSE IN LICENSE.md",
|
||||
"homepage": "https://n8n.io",
|
||||
|
@ -100,9 +100,9 @@
|
|||
"lodash.get": "^4.4.2",
|
||||
"mongodb": "^3.5.5",
|
||||
"mysql2": "^2.0.1",
|
||||
"n8n-core": "~0.36.0",
|
||||
"n8n-editor-ui": "~0.47.0",
|
||||
"n8n-nodes-base": "~0.65.0",
|
||||
"n8n-core": "~0.37.0",
|
||||
"n8n-editor-ui": "~0.48.0",
|
||||
"n8n-nodes-base": "~0.67.0",
|
||||
"n8n-workflow": "~0.33.0",
|
||||
"oauth-1.0a": "^2.2.6",
|
||||
"open": "^7.0.0",
|
||||
|
|
|
@ -20,7 +20,7 @@ class CredentialsOverwritesClass {
|
|||
return;
|
||||
}
|
||||
|
||||
const data = await GenericHelpers.getConfigValue('credentials.overwrite') as string;
|
||||
const data = await GenericHelpers.getConfigValue('credentials.overwrite.data') as string;
|
||||
|
||||
try {
|
||||
this.overwriteData = JSON.parse(data);
|
||||
|
@ -30,6 +30,7 @@ class CredentialsOverwritesClass {
|
|||
}
|
||||
|
||||
applyOverwrite(type: string, data: ICredentialDataDecryptedObject) {
|
||||
|
||||
const overwrites = this.get(type);
|
||||
|
||||
if (overwrites === undefined) {
|
||||
|
|
|
@ -14,6 +14,8 @@ import {
|
|||
getRepository,
|
||||
} from 'typeorm';
|
||||
|
||||
import { TlsOptions } from 'tls';
|
||||
|
||||
import * as config from '../config';
|
||||
|
||||
import {
|
||||
|
@ -72,6 +74,22 @@ export async function init(): Promise<IDatabaseCollections> {
|
|||
|
||||
case 'postgresdb':
|
||||
entities = PostgresDb;
|
||||
|
||||
const sslCa = await GenericHelpers.getConfigValue('database.postgresdb.ssl.ca') as string;
|
||||
const sslCert = await GenericHelpers.getConfigValue('database.postgresdb.ssl.cert') as string;
|
||||
const sslKey = await GenericHelpers.getConfigValue('database.postgresdb.ssl.key') as string;
|
||||
const sslRejectUnauthorized = await GenericHelpers.getConfigValue('database.postgresdb.ssl.rejectUnauthorized') as boolean;
|
||||
|
||||
let ssl: TlsOptions | undefined = undefined;
|
||||
if (sslCa !== '' || sslCert !== '' || sslKey !== '' || sslRejectUnauthorized !== true) {
|
||||
ssl = {
|
||||
ca: sslCa || undefined,
|
||||
cert: sslCert || undefined,
|
||||
key: sslKey || undefined,
|
||||
rejectUnauthorized: sslRejectUnauthorized,
|
||||
};
|
||||
}
|
||||
|
||||
connectionOptions = {
|
||||
type: 'postgres',
|
||||
entityPrefix,
|
||||
|
@ -84,7 +102,9 @@ export async function init(): Promise<IDatabaseCollections> {
|
|||
migrations: [InitialMigration1587669153312],
|
||||
migrationsRun: true,
|
||||
migrationsTableName: `${entityPrefix}migrations`,
|
||||
ssl,
|
||||
};
|
||||
|
||||
break;
|
||||
|
||||
case 'mariadb':
|
||||
|
|
|
@ -58,6 +58,9 @@ import {
|
|||
WorkflowExecuteAdditionalData,
|
||||
WorkflowRunner,
|
||||
GenericHelpers,
|
||||
CredentialsOverwrites,
|
||||
ICredentialsOverwrite,
|
||||
LoadNodesAndCredentials,
|
||||
} from './';
|
||||
|
||||
import {
|
||||
|
@ -105,6 +108,7 @@ class App {
|
|||
testWebhooks: TestWebhooks.TestWebhooks;
|
||||
endpointWebhook: string;
|
||||
endpointWebhookTest: string;
|
||||
endpointPresetCredentials: string;
|
||||
externalHooks: IExternalHooksClass;
|
||||
saveDataErrorExecution: string;
|
||||
saveDataSuccessExecution: string;
|
||||
|
@ -119,6 +123,8 @@ class App {
|
|||
sslKey: string;
|
||||
sslCert: string;
|
||||
|
||||
presetCredentialsLoaded: boolean;
|
||||
|
||||
constructor() {
|
||||
this.app = express();
|
||||
|
||||
|
@ -141,6 +147,9 @@ class App {
|
|||
this.sslCert = config.get('ssl_cert');
|
||||
|
||||
this.externalHooks = ExternalHooks();
|
||||
|
||||
this.presetCredentialsLoaded = false;
|
||||
this.endpointPresetCredentials = config.get('credentials.overwrite.endpoint') as string;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1650,6 +1659,40 @@ class App {
|
|||
});
|
||||
|
||||
|
||||
if (this.endpointPresetCredentials !== '') {
|
||||
|
||||
// POST endpoint to set preset credentials
|
||||
this.app.post(`/${this.endpointPresetCredentials}`, async (req: express.Request, res: express.Response) => {
|
||||
|
||||
if (this.presetCredentialsLoaded === false) {
|
||||
|
||||
const body = req.body as ICredentialsOverwrite;
|
||||
|
||||
if (req.headers['content-type'] !== 'application/json') {
|
||||
ResponseHelper.sendErrorResponse(res, new Error('Body must be a valid JSON, make sure the content-type is application/json'));
|
||||
return;
|
||||
}
|
||||
|
||||
const loadNodesAndCredentials = LoadNodesAndCredentials();
|
||||
|
||||
const credentialsOverwrites = CredentialsOverwrites();
|
||||
|
||||
await credentialsOverwrites.init(body);
|
||||
|
||||
const credentialTypes = CredentialTypes();
|
||||
|
||||
await credentialTypes.init(loadNodesAndCredentials.credentialTypes);
|
||||
|
||||
this.presetCredentialsLoaded = true;
|
||||
|
||||
ResponseHelper.sendSuccessResponse(res, { success: true }, true, 200);
|
||||
|
||||
} else {
|
||||
ResponseHelper.sendErrorResponse(res, new Error('Preset credentials can be set once'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Serve the website
|
||||
const startTime = (new Date()).toUTCString();
|
||||
const editorUiPath = require.resolve('n8n-editor-ui');
|
||||
|
|
|
@ -316,14 +316,14 @@ export async function executeWorkflow(workflowInfo: IExecuteWorkflowInfo, additi
|
|||
// Does not get used so set it simply to empty string
|
||||
const executionId = '';
|
||||
|
||||
// Create new additionalData to have different workflow loaded and to call
|
||||
// different webooks
|
||||
const additionalDataIntegrated = await getBase(additionalData.credentials);
|
||||
additionalDataIntegrated.hooks = getWorkflowHooksIntegrated(mode, executionId, workflowData!, { parentProcessMode: additionalData.hooks!.mode });
|
||||
|
||||
// Get the needed credentials for the current workflow as they will differ to the ones of the
|
||||
// calling workflow.
|
||||
additionalDataIntegrated.credentials = await WorkflowCredentials(workflowData!.nodes);
|
||||
const credentials = await WorkflowCredentials(workflowData!.nodes);
|
||||
|
||||
// Create new additionalData to have different workflow loaded and to call
|
||||
// different webooks
|
||||
const additionalDataIntegrated = await getBase(credentials);
|
||||
additionalDataIntegrated.hooks = getWorkflowHooksIntegrated(mode, executionId, workflowData!, { parentProcessMode: additionalData.hooks!.mode });
|
||||
|
||||
// Find Start-Node
|
||||
const requiredNodeTypes = ['n8n-nodes-base.start'];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "n8n-core",
|
||||
"version": "0.36.0",
|
||||
"version": "0.37.0",
|
||||
"description": "Core functionality of n8n",
|
||||
"license": "SEE LICENSE IN LICENSE.md",
|
||||
"homepage": "https://n8n.io",
|
||||
|
@ -45,7 +45,7 @@
|
|||
"crypto-js": "3.1.9-1",
|
||||
"lodash.get": "^4.4.2",
|
||||
"mmmagic": "^0.5.2",
|
||||
"n8n-workflow": "~0.32.0",
|
||||
"n8n-workflow": "~0.33.0",
|
||||
"p-cancelable": "^2.0.0",
|
||||
"request": "^2.88.2",
|
||||
"request-promise-native": "^1.0.7"
|
||||
|
|
|
@ -41,8 +41,13 @@ export async function prepareUserSettings(): Promise<IUserSettings> {
|
|||
userSettings = {};
|
||||
}
|
||||
|
||||
// Settings and/or key do not exist. So generate a new encryption key
|
||||
userSettings.encryptionKey = randomBytes(24).toString('base64');
|
||||
if (process.env[ENCRYPTION_KEY_ENV_OVERWRITE] !== undefined) {
|
||||
// Use the encryption key which got set via environment
|
||||
userSettings.encryptionKey = process.env[ENCRYPTION_KEY_ENV_OVERWRITE];
|
||||
} else {
|
||||
// Generate a new encryption key
|
||||
userSettings.encryptionKey = randomBytes(24).toString('base64');
|
||||
}
|
||||
|
||||
console.log(`UserSettings got generated and saved to: ${settingsPath}`);
|
||||
|
||||
|
|
|
@ -459,7 +459,7 @@ export class WorkflowExecute {
|
|||
let executionData: IExecuteData;
|
||||
let executionError: IExecutionError | undefined;
|
||||
let executionNode: INode;
|
||||
let nodeSuccessData: INodeExecutionData[][] | null;
|
||||
let nodeSuccessData: INodeExecutionData[][] | null | undefined;
|
||||
let runIndex: number;
|
||||
let startTime: number;
|
||||
let taskData: ITaskData;
|
||||
|
@ -593,9 +593,15 @@ export class WorkflowExecute {
|
|||
}
|
||||
}
|
||||
|
||||
this.runExecutionData.resultData.lastNodeExecuted = executionData.node.name;
|
||||
nodeSuccessData = await workflow.runNode(executionData.node, executionData.data, this.runExecutionData, runIndex, this.additionalData, NodeExecuteFunctions, this.mode);
|
||||
|
||||
if (nodeSuccessData === undefined) {
|
||||
// Node did not get executed
|
||||
nodeSuccessData = null;
|
||||
} else {
|
||||
this.runExecutionData.resultData.lastNodeExecuted = executionData.node.name;
|
||||
}
|
||||
|
||||
if (nodeSuccessData === null || nodeSuccessData[0][0] === undefined) {
|
||||
if (executionData.node.alwaysOutputData === true) {
|
||||
nodeSuccessData = nodeSuccessData || [];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "n8n-editor-ui",
|
||||
"version": "0.47.0",
|
||||
"version": "0.48.0",
|
||||
"description": "Workflow Editor UI for n8n",
|
||||
"license": "SEE LICENSE IN LICENSE.md",
|
||||
"homepage": "https://n8n.io",
|
||||
|
|
|
@ -127,7 +127,7 @@ export class MyNode implements INodeType {
|
|||
|
||||
The "description" property has to be set on all nodes because it contains all
|
||||
the base information. Additionally do all nodes have to have exactly one of the
|
||||
following methods defined which contains the the actual logic:
|
||||
following methods defined which contains the actual logic:
|
||||
|
||||
**Regular node**
|
||||
|
||||
|
@ -138,8 +138,8 @@ Method get called when the workflow gets executed
|
|||
By default always `execute` should be used especially when creating a
|
||||
third-party integration. The reason for that is that it is way more flexible
|
||||
and allows to, for example, return a different amount of items than it received
|
||||
as input. This is very important when a node should query data like return
|
||||
all users. In that case, does the node normally just receive one input-item
|
||||
as input. This is very important when a node should query data like *return
|
||||
all users*. In that case, does the node normally just receive one input-item
|
||||
but returns as many as users exist. So in doubt always `execute` should be
|
||||
used!
|
||||
|
||||
|
@ -188,10 +188,10 @@ The following properties can be set in the node description:
|
|||
- **outputs** [required]: Types of outputs the node has (currently only "main" exists) and the amount
|
||||
- **outputNames** [optional]: In case a node has multiple outputs names can be set that users know what data to expect
|
||||
- **maxNodes** [optional]: If not an unlimited amount of nodes of that type can exist in a workflow the max-amount can be specified
|
||||
- **name** [required]: Nme of the node (for n8n to use internally in camelCase)
|
||||
- **name** [required]: Name of the node (for n8n to use internally, in camelCase)
|
||||
- **properties** [required]: Properties which get displayed in the Editor UI and can be set by the user
|
||||
- **subtitle** [optional]: Text which should be displayed underneath the name of the node in the Editor UI (can be an expression)
|
||||
- **version** [required]: Version of the node. Currently always "1" (integer). For future usage does not get used yet.
|
||||
- **version** [required]: Version of the node. Currently always "1" (integer). For future usage, does not get used yet.
|
||||
- **webhooks** [optional]: Webhooks the node should listen to
|
||||
|
||||
|
||||
|
@ -200,12 +200,12 @@ The following properties can be set in the node description:
|
|||
The following properties can be set in the node properties:
|
||||
|
||||
- **default** [required]: Default value of the property
|
||||
- **description** [required]: Description to display users in Editor UI
|
||||
- **displayName** [required]: Name to display users in Editor UI
|
||||
- **description** [required]: Description that is displayed to users in the Editor UI
|
||||
- **displayName** [required]: Name that is displayed to users in the Editor UI
|
||||
- **displayOptions** [optional]: Defines logic to decide if a property should be displayed or not
|
||||
- **name** [required]: Name of the property (for n8n to use internally in camelCase)
|
||||
- **name** [required]: Name of the property (for n8n to use internally, in camelCase)
|
||||
- **options** [optional]: The options the user can select when type of property is "collection", "fixedCollection" or "options"
|
||||
- **placeholder** [optional]: Placeholder text to display users in Editor UI
|
||||
- **placeholder** [optional]: Placeholder text that is displayed to users in the Editor UI
|
||||
- **type** [required]: Type of the property. If it is for example a "string", "number", ...
|
||||
- **typeOptions** [optional]: Additional options for type. Like for example the min or max value of a number
|
||||
- **required** [optional]: Defines if the value has to be set or if it can stay empty
|
||||
|
@ -215,11 +215,11 @@ The following properties can be set in the node properties:
|
|||
|
||||
The following properties can be set in the node property options.
|
||||
|
||||
All properties are optional. The most, however, work only work when the node-property is of a specfic type.
|
||||
All properties are optional. However, most only work when the node-property is of a specfic type.
|
||||
|
||||
- **alwaysOpenEditWindow** [type: string]: If set then the "Editor Window" will always open when the user tries to edit the field. Is helpful when long texts normally get used in the property
|
||||
- **alwaysOpenEditWindow** [type: string]: If set then the "Editor Window" will always open when the user tries to edit the field. Helpful if long text is typically used in the property.
|
||||
- **loadOptionsMethod** [type: options]: Method to use to load options from an external service
|
||||
- **maxValue** [type: number]: Maximal value of the number
|
||||
- **maxValue** [type: number]: Maximum value of the number
|
||||
- **minValue** [type: number]: Minimum value of the number
|
||||
- **multipleValues** [type: all]: If set the property gets turned into an Array and the user can add multiple values
|
||||
- **multipleValueButtonText** [type: all]: Custom text for add button in case "multipleValues" got set
|
||||
|
|
|
@ -27,7 +27,7 @@ export class ClassNameReplace implements INodeType {
|
|||
{
|
||||
name: 'default',
|
||||
httpMethod: 'POST',
|
||||
reponseMode: 'onReceived',
|
||||
responseMode: 'onReceived',
|
||||
// Each webhook property can either be hardcoded
|
||||
// like the above ones or referenced from a parameter
|
||||
// like the "path" property bellow
|
||||
|
|
17
packages/nodes-base/credentials/CircleCiApi.credentials.ts
Normal file
17
packages/nodes-base/credentials/CircleCiApi.credentials.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import {
|
||||
ICredentialType,
|
||||
NodePropertyTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export class CircleCiApi implements ICredentialType {
|
||||
name = 'circleCiApi';
|
||||
displayName = 'CircleCI API';
|
||||
properties = [
|
||||
{
|
||||
displayName: 'Personal API Token',
|
||||
name: 'apiKey',
|
||||
type: 'string' as NodePropertyTypes,
|
||||
default: '',
|
||||
},
|
||||
];
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
import {
|
||||
ICredentialType,
|
||||
NodePropertyTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
|
||||
export class DriftOAuth2Api implements ICredentialType {
|
||||
name = 'driftOAuth2Api';
|
||||
extends = [
|
||||
'oAuth2Api',
|
||||
];
|
||||
displayName = 'Drift OAuth2 API';
|
||||
properties = [
|
||||
{
|
||||
displayName: 'Authorization URL',
|
||||
name: 'authUrl',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: 'https://dev.drift.com/authorize',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Access Token URL',
|
||||
name: 'accessTokenUrl',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: 'https://driftapi.com/oauth2/token',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Auth URI Query Parameters',
|
||||
name: 'authQueryParameters',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Scope',
|
||||
name: 'scope',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Authentication',
|
||||
name: 'authentication',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: 'body',
|
||||
},
|
||||
];
|
||||
}
|
|
@ -8,7 +8,7 @@ export class EventbriteApi implements ICredentialType {
|
|||
displayName = 'Eventbrite API';
|
||||
properties = [
|
||||
{
|
||||
displayName: 'API Key',
|
||||
displayName: 'Private Key',
|
||||
name: 'apiKey',
|
||||
type: 'string' as NodePropertyTypes,
|
||||
default: '',
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
import {
|
||||
ICredentialType,
|
||||
NodePropertyTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
|
||||
export class EventbriteOAuth2Api implements ICredentialType {
|
||||
name = 'eventbriteOAuth2Api';
|
||||
extends = [
|
||||
'oAuth2Api',
|
||||
];
|
||||
displayName = 'Eventbrite OAuth2 API';
|
||||
properties = [
|
||||
{
|
||||
displayName: 'Authorization URL',
|
||||
name: 'authUrl',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: 'https://www.eventbrite.com/oauth/authorize',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Access Token URL',
|
||||
name: 'accessTokenUrl',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: 'https://www.eventbrite.com/oauth/token',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Scope',
|
||||
name: 'scope',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Auth URI Query Parameters',
|
||||
name: 'authQueryParameters',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Authentication',
|
||||
name: 'authentication',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: 'body'
|
||||
},
|
||||
];
|
||||
}
|
18
packages/nodes-base/credentials/Signl4Api.credentials.ts
Normal file
18
packages/nodes-base/credentials/Signl4Api.credentials.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import {
|
||||
ICredentialType,
|
||||
NodePropertyTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export class Signl4Api implements ICredentialType {
|
||||
name = 'signl4Api';
|
||||
displayName = 'SIGNL4 Webhook';
|
||||
properties = [
|
||||
{
|
||||
displayName: 'Team Secret',
|
||||
name: 'teamSecret',
|
||||
type: 'string' as NodePropertyTypes,
|
||||
default: '',
|
||||
description: 'The team secret is the last part of your SIGNL4 webhook URL.'
|
||||
},
|
||||
];
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
import {
|
||||
ICredentialType,
|
||||
NodePropertyTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
|
||||
export class SpotifyOAuth2Api implements ICredentialType {
|
||||
name = 'spotifyOAuth2Api';
|
||||
extends = [
|
||||
'oAuth2Api',
|
||||
];
|
||||
displayName = 'Spotify OAuth2 API';
|
||||
properties = [
|
||||
{
|
||||
displayName: 'Spotify Server',
|
||||
name: 'server',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: 'https://api.spotify.com/',
|
||||
},
|
||||
{
|
||||
displayName: 'Authorization URL',
|
||||
name: 'authUrl',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: 'https://accounts.spotify.com/authorize',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Access Token URL',
|
||||
name: 'accessTokenUrl',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: 'https://accounts.spotify.com/api/token',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Scope',
|
||||
name: 'scope',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: 'user-read-playback-state playlist-read-collaborative user-modify-playback-state playlist-modify-public user-read-currently-playing playlist-read-private user-read-recently-played playlist-modify-private',
|
||||
},
|
||||
{
|
||||
displayName: 'Auth URI Query Parameters',
|
||||
name: 'authQueryParameters',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Authentication',
|
||||
name: 'authentication',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: 'header',
|
||||
}
|
||||
];
|
||||
}
|
14
packages/nodes-base/credentials/ZoomApi.credentials.ts
Normal file
14
packages/nodes-base/credentials/ZoomApi.credentials.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { ICredentialType, NodePropertyTypes } from 'n8n-workflow';
|
||||
|
||||
export class ZoomApi implements ICredentialType {
|
||||
name = 'zoomApi';
|
||||
displayName = 'Zoom API';
|
||||
properties = [
|
||||
{
|
||||
displayName: 'JTW Token',
|
||||
name: 'accessToken',
|
||||
type: 'string' as NodePropertyTypes,
|
||||
default: ''
|
||||
}
|
||||
];
|
||||
}
|
42
packages/nodes-base/credentials/ZoomOAuth2Api.credentials.ts
Normal file
42
packages/nodes-base/credentials/ZoomOAuth2Api.credentials.ts
Normal file
|
@ -0,0 +1,42 @@
|
|||
import {
|
||||
ICredentialType,
|
||||
NodePropertyTypes,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export class ZoomOAuth2Api implements ICredentialType {
|
||||
name = 'zoomOAuth2Api';
|
||||
extends = ['oAuth2Api'];
|
||||
displayName = 'Zoom OAuth2 API';
|
||||
properties = [
|
||||
{
|
||||
displayName: 'Authorization URL',
|
||||
name: 'authUrl',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: 'https://zoom.us/oauth/authorize'
|
||||
},
|
||||
{
|
||||
displayName: 'Access Token URL',
|
||||
name: 'accessTokenUrl',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: 'https://zoom.us/oauth/token'
|
||||
},
|
||||
{
|
||||
displayName: 'Scope',
|
||||
name: 'scope',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: ''
|
||||
},
|
||||
{
|
||||
displayName: 'Auth URI Query Parameters',
|
||||
name: 'authQueryParameters',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: ''
|
||||
},
|
||||
{
|
||||
displayName: 'Authentication',
|
||||
name: 'authentication',
|
||||
type: 'hidden' as NodePropertyTypes,
|
||||
default: 'header'
|
||||
}
|
||||
];
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
const { src, dest } = require('gulp');
|
||||
|
||||
function copyIcons() {
|
||||
return src('nodes/**/*.png')
|
||||
return src('nodes/**/*.{png,svg}')
|
||||
.pipe(dest('dist/nodes'));
|
||||
}
|
||||
|
||||
|
|
140
packages/nodes-base/nodes/CircleCi/CircleCi.node.ts
Normal file
140
packages/nodes-base/nodes/CircleCi/CircleCi.node.ts
Normal file
|
@ -0,0 +1,140 @@
|
|||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeTypeDescription,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
pipelineFields,
|
||||
pipelineOperations,
|
||||
} from './PipelineDescription';
|
||||
|
||||
import {
|
||||
circleciApiRequest,
|
||||
circleciApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
|
||||
export class CircleCi implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'CircleCI',
|
||||
name: 'circleCi',
|
||||
icon: 'file:circleCi.png',
|
||||
group: ['output'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: 'Consume CircleCI API',
|
||||
defaults: {
|
||||
name: 'CircleCI',
|
||||
color: '#04AA51',
|
||||
},
|
||||
inputs: ['main'],
|
||||
outputs: ['main'],
|
||||
credentials: [
|
||||
{
|
||||
name: 'circleCiApi',
|
||||
required: true,
|
||||
}
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: ' Pipeline',
|
||||
value: 'pipeline',
|
||||
},
|
||||
],
|
||||
default: 'pipeline',
|
||||
description: 'Resource to consume.',
|
||||
},
|
||||
...pipelineOperations,
|
||||
...pipelineFields,
|
||||
],
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const length = items.length as unknown as number;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (resource === 'pipeline') {
|
||||
if (operation === 'get') {
|
||||
const vcs = this.getNodeParameter('vcs', i) as string;
|
||||
let slug = this.getNodeParameter('projectSlug', i) as string;
|
||||
const pipelineNumber = this.getNodeParameter('pipelineNumber', i) as number;
|
||||
|
||||
slug = slug.replace(new RegExp(/\//g), '%2F');
|
||||
|
||||
const endpoint = `/project/${vcs}/${slug}/pipeline/${pipelineNumber}`;
|
||||
|
||||
responseData = await circleciApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
const vcs = this.getNodeParameter('vcs', i) as string;
|
||||
const filters = this.getNodeParameter('filters', i) as IDataObject;
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
let slug = this.getNodeParameter('projectSlug', i) as string;
|
||||
|
||||
slug = slug.replace(new RegExp(/\//g), '%2F');
|
||||
|
||||
if (filters.branch) {
|
||||
qs.branch = filters.branch;
|
||||
}
|
||||
|
||||
const endpoint = `/project/${vcs}/${slug}/pipeline`;
|
||||
|
||||
if (returnAll === true) {
|
||||
responseData = await circleciApiRequestAllItems.call(this, 'items', 'GET', endpoint, {}, qs);
|
||||
|
||||
} else {
|
||||
qs.limit = this.getNodeParameter('limit', i) as number;
|
||||
responseData = await circleciApiRequest.call(this, 'GET', endpoint, {}, qs);
|
||||
responseData = responseData.items;
|
||||
responseData = responseData.splice(0, qs.limit);
|
||||
}
|
||||
}
|
||||
|
||||
if (operation === 'trigger') {
|
||||
const vcs = this.getNodeParameter('vcs', i) as string;
|
||||
let slug = this.getNodeParameter('projectSlug', i) as string;
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
|
||||
slug = slug.replace(new RegExp(/\//g), '%2F');
|
||||
|
||||
const endpoint = `/project/${vcs}/${slug}/pipeline`;
|
||||
|
||||
const body: IDataObject = {};
|
||||
|
||||
if (additionalFields.branch) {
|
||||
body.branch = additionalFields.branch as string;
|
||||
}
|
||||
|
||||
if (additionalFields.tag) {
|
||||
body.tag = additionalFields.tag as string;
|
||||
}
|
||||
|
||||
responseData = await circleciApiRequest.call(this, 'POST', endpoint, body, qs);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
}
|
||||
}
|
67
packages/nodes-base/nodes/CircleCi/GenericFunctions.ts
Normal file
67
packages/nodes-base/nodes/CircleCi/GenericFunctions.ts
Normal file
|
@ -0,0 +1,67 @@
|
|||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function circleciApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
const credentials = this.getCredentials('circleCiApi');
|
||||
if (credentials === undefined) {
|
||||
throw new Error('No credentials got returned!');
|
||||
}
|
||||
let options: OptionsWithUri = {
|
||||
headers: {
|
||||
'Circle-Token': credentials.apiKey,
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
method,
|
||||
qs,
|
||||
body,
|
||||
uri: uri ||`https://circleci.com/api/v2${resource}`,
|
||||
json: true
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
if (Object.keys(options.body).length === 0) {
|
||||
delete options.body;
|
||||
}
|
||||
try {
|
||||
return await this.helpers.request!(options);
|
||||
} catch (err) {
|
||||
if (err.response && err.response.body && err.response.body.message) {
|
||||
// Try to return the error prettier
|
||||
throw new Error(`CircleCI error response [${err.statusCode}]: ${err.response.body.message}`);
|
||||
}
|
||||
|
||||
// If that data does not exist for some reason return the actual error
|
||||
throw err; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Make an API request to paginated CircleCI endpoint
|
||||
* and return all results
|
||||
*/
|
||||
export async function circleciApiRequestAllItems(this: IHookFunctions | IExecuteFunctions| ILoadOptionsFunctions, propertyName: string, method: string, resource: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
|
||||
do {
|
||||
responseData = await circleciApiRequest.call(this, method, resource, body, query);
|
||||
returnData.push.apply(returnData, responseData[propertyName]);
|
||||
query['page-token'] = responseData.next_page_token;
|
||||
} while (
|
||||
responseData.next_page_token !== undefined &&
|
||||
responseData.next_page_token !== null
|
||||
);
|
||||
return returnData;
|
||||
}
|
229
packages/nodes-base/nodes/CircleCi/PipelineDescription.ts
Normal file
229
packages/nodes-base/nodes/CircleCi/PipelineDescription.ts
Normal file
|
@ -0,0 +1,229 @@
|
|||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export const pipelineOperations = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'pipeline',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a pipeline',
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Get all pipelines',
|
||||
},
|
||||
{
|
||||
name: 'Trigger',
|
||||
value: 'trigger',
|
||||
description: 'Trigger a pipeline',
|
||||
},
|
||||
],
|
||||
default: 'get',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
||||
export const pipelineFields = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* pipeline:shared */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Provider',
|
||||
name: 'vcs',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Bitbucket',
|
||||
value: 'bitbucket',
|
||||
},
|
||||
{
|
||||
name: 'GitHub',
|
||||
value: 'github',
|
||||
},
|
||||
],
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
'getAll',
|
||||
'trigger',
|
||||
],
|
||||
resource: [
|
||||
'pipeline',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Version control system',
|
||||
},
|
||||
{
|
||||
displayName: 'Project Slug',
|
||||
name: 'projectSlug',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
'getAll',
|
||||
'trigger',
|
||||
],
|
||||
resource: [
|
||||
'pipeline',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
placeholder: 'n8n-io/n8n',
|
||||
description: 'Project slug in the form org-name/repo-name',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* pipeline:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Pipeline Number',
|
||||
name: 'pipelineNumber',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'pipeline',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 1,
|
||||
description: 'The number of the pipeline',
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* pipeline:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'pipeline',
|
||||
],
|
||||
},
|
||||
},
|
||||
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: [
|
||||
'pipeline',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 500,
|
||||
},
|
||||
default: 100,
|
||||
description: 'How many results to return.',
|
||||
},
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'pipeline',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Branch',
|
||||
name: 'branch',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The name of a vcs branch.',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* pipeline:trigger */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'pipeline',
|
||||
],
|
||||
operation: [
|
||||
'trigger',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Branch',
|
||||
name: 'branch',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: `The branch where the pipeline ran.<br/>
|
||||
The HEAD commit on this branch was used for the pipeline.<br/>
|
||||
Note that branch and tag are mutually exclusive.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Tag',
|
||||
name: 'tag',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: `The tag used by the pipeline.<br/>
|
||||
The commit that this tag points to was used for the pipeline.<br/>
|
||||
Note that branch and tag are mutually exclusive`,
|
||||
},
|
||||
],
|
||||
},
|
||||
] as INodeProperties[];
|
BIN
packages/nodes-base/nodes/CircleCi/circleCi.png
Normal file
BIN
packages/nodes-base/nodes/CircleCi/circleCi.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
|
@ -243,9 +243,10 @@ export class DateTime implements INodeType {
|
|||
if (currentDate === undefined) {
|
||||
continue;
|
||||
}
|
||||
if (!moment(currentDate as string | number).isValid()) {
|
||||
if (options.fromFormat === undefined && !moment(currentDate as string | number).isValid()) {
|
||||
throw new Error('The date input format could not be recognized. Please set the "From Format" field');
|
||||
}
|
||||
|
||||
if (Number.isInteger(currentDate as unknown as number)) {
|
||||
newDate = moment.unix(currentDate as unknown as number);
|
||||
} else {
|
||||
|
|
|
@ -37,9 +37,44 @@ export class Drift implements INodeType {
|
|||
{
|
||||
name: 'driftApi',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'accessToken',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'driftOAuth2Api',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'oAuth2',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Authentication',
|
||||
name: 'authentication',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Access Token',
|
||||
value: 'accessToken',
|
||||
},
|
||||
{
|
||||
name: 'OAuth2',
|
||||
value: 'oAuth2',
|
||||
},
|
||||
],
|
||||
default: 'accessToken',
|
||||
description: 'The resource to operate on.',
|
||||
},
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
|
|
|
@ -12,25 +12,15 @@ import {
|
|||
} from 'n8n-workflow';
|
||||
|
||||
export async function driftApiRequest(this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
const credentials = this.getCredentials('driftApi');
|
||||
|
||||
if (credentials === undefined) {
|
||||
throw new Error('No credentials got returned!');
|
||||
}
|
||||
|
||||
const endpoint = 'https://driftapi.com';
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
headers: {
|
||||
Authorization: `Bearer ${credentials.accessToken}`,
|
||||
},
|
||||
headers: {},
|
||||
method,
|
||||
body,
|
||||
qs: query,
|
||||
uri: uri || `${endpoint}${resource}`,
|
||||
uri: uri || `https://driftapi.com${resource}`,
|
||||
json: true
|
||||
};
|
||||
|
||||
if (!Object.keys(body).length) {
|
||||
delete options.form;
|
||||
}
|
||||
|
@ -38,11 +28,27 @@ export async function driftApiRequest(this: IExecuteFunctions | IWebhookFunction
|
|||
delete options.qs;
|
||||
}
|
||||
options = Object.assign({}, options, option);
|
||||
|
||||
const authenticationMethod = this.getNodeParameter('authentication', 0);
|
||||
|
||||
try {
|
||||
return await this.helpers.request!(options);
|
||||
if (authenticationMethod === 'accessToken') {
|
||||
const credentials = this.getCredentials('driftApi');
|
||||
|
||||
if (credentials === undefined) {
|
||||
throw new Error('No credentials got returned!');
|
||||
}
|
||||
|
||||
options.headers!['Authorization'] = `Bearer ${credentials.accessToken}`;
|
||||
|
||||
return await this.helpers.request!(options);
|
||||
} else {
|
||||
return await this.helpers.requestOAuth2!.call(this, 'driftOAuth2Api', options);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.response) {
|
||||
const errorMessage = error.message || (error.response.body && error.response.body.message );
|
||||
|
||||
if (error.response && error.response.body && error.response.body.error) {
|
||||
const errorMessage = error.response.body.error.message;
|
||||
throw new Error(`Drift error response [${error.statusCode}]: ${errorMessage}`);
|
||||
}
|
||||
throw error;
|
||||
|
|
|
@ -35,7 +35,25 @@ export class EventbriteTrigger implements INodeType {
|
|||
{
|
||||
name: 'eventbriteApi',
|
||||
required: true,
|
||||
}
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'privateKey',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'eventbriteOAuth2Api',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'oAuth2',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
webhooks: [
|
||||
{
|
||||
|
@ -46,6 +64,23 @@ export class EventbriteTrigger implements INodeType {
|
|||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Authentication',
|
||||
name: 'authentication',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Private Key',
|
||||
value: 'privateKey',
|
||||
},
|
||||
{
|
||||
name: 'OAuth2',
|
||||
value: 'oAuth2',
|
||||
},
|
||||
],
|
||||
default: 'privateKey',
|
||||
description: 'The resource to operate on.',
|
||||
},
|
||||
{
|
||||
displayName: 'Organization',
|
||||
name: 'organization',
|
||||
|
@ -149,7 +184,6 @@ export class EventbriteTrigger implements INodeType {
|
|||
description: 'By default does the webhook-data only contain the URL to receive<br />the object data manually. If this option gets activated it<br />will resolve the data automatically.',
|
||||
},
|
||||
],
|
||||
|
||||
};
|
||||
|
||||
methods = {
|
||||
|
@ -192,23 +226,39 @@ export class EventbriteTrigger implements INodeType {
|
|||
default: {
|
||||
async checkExists(this: IHookFunctions): Promise<boolean> {
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
if (webhookData.webhookId === undefined) {
|
||||
return false;
|
||||
const webhookUrl = this.getNodeWebhookUrl('default');
|
||||
const organisation = this.getNodeParameter('organization') as string;
|
||||
const actions = this.getNodeParameter('actions') as string[];
|
||||
|
||||
const endpoint = `/organizations/${organisation}/webhooks/`;
|
||||
|
||||
const { webhooks } = await eventbriteApiRequest.call(this, 'GET', endpoint);
|
||||
|
||||
const check = (currentActions: string[], webhookActions: string[]) => {
|
||||
for (const currentAction of currentActions) {
|
||||
if (!webhookActions.includes(currentAction)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
for (const webhook of webhooks) {
|
||||
if (webhook.endpoint_url === webhookUrl && check(actions, webhook.actions)) {
|
||||
webhookData.webhookId = webhook.id;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
const endpoint = `/webhooks/${webhookData.webhookId}/`;
|
||||
try {
|
||||
await eventbriteApiRequest.call(this, 'GET', endpoint);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
return false;
|
||||
},
|
||||
async create(this: IHookFunctions): Promise<boolean> {
|
||||
const webhookUrl = this.getNodeWebhookUrl('default');
|
||||
const webhookData = this.getWorkflowStaticData('node');
|
||||
const organisation = this.getNodeParameter('organization') as string;
|
||||
const event = this.getNodeParameter('event') as string;
|
||||
const actions = this.getNodeParameter('actions') as string[];
|
||||
const endpoint = `/webhooks/`;
|
||||
const endpoint = `/organizations/${organisation}/webhooks/`;
|
||||
const body: IDataObject = {
|
||||
endpoint_url: webhookUrl,
|
||||
actions: actions.join(','),
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
import { OptionsWithUri } from 'request';
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
|
@ -6,16 +9,14 @@ import {
|
|||
ILoadOptionsFunctions,
|
||||
IWebhookFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IDataObject } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function eventbriteApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IWebhookFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
const credentials = this.getCredentials('eventbriteApi');
|
||||
if (credentials === undefined) {
|
||||
throw new Error('No credentials got returned!');
|
||||
}
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
headers: { 'Authorization': `Bearer ${credentials.apiKey}`},
|
||||
headers: {},
|
||||
method,
|
||||
qs,
|
||||
body,
|
||||
|
@ -27,14 +28,26 @@ export async function eventbriteApiRequest(this: IHookFunctions | IExecuteFuncti
|
|||
delete options.body;
|
||||
}
|
||||
|
||||
const authenticationMethod = this.getNodeParameter('authentication', 0);
|
||||
|
||||
try {
|
||||
return await this.helpers.request!(options);
|
||||
if (authenticationMethod === 'privateKey') {
|
||||
const credentials = this.getCredentials('eventbriteApi');
|
||||
if (credentials === undefined) {
|
||||
throw new Error('No credentials got returned!');
|
||||
}
|
||||
|
||||
options.headers!['Authorization'] = `Bearer ${credentials.apiKey}`;
|
||||
|
||||
return await this.helpers.request!(options);
|
||||
} else {
|
||||
return await this.helpers.requestOAuth2!.call(this, 'eventbriteOAuth2Api', options);
|
||||
}
|
||||
} catch (error) {
|
||||
let errorMessage = error.message;
|
||||
if (error.response.body && error.response.body.error_description) {
|
||||
errorMessage = error.response.body.error_description;
|
||||
}
|
||||
|
||||
throw new Error('Eventbrite Error: ' + errorMessage);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,6 +137,13 @@ export class FacebookGraphApi implements INodeType {
|
|||
placeholder: 'videos',
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Ignore SSL Issues',
|
||||
name: 'allowUnauthorizedCerts',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Still download the response even if SSL certificate validation is not possible. (Not recommended)',
|
||||
},
|
||||
{
|
||||
displayName: 'Send Binary Data',
|
||||
name: 'sendBinaryData',
|
||||
|
@ -301,6 +308,7 @@ export class FacebookGraphApi implements INodeType {
|
|||
qs: {
|
||||
access_token: graphApiCredentials!.accessToken,
|
||||
},
|
||||
rejectUnauthorized: !this.getNodeParameter('allowUnauthorizedCerts', itemIndex, false) as boolean,
|
||||
};
|
||||
|
||||
if (options !== undefined) {
|
||||
|
|
|
@ -17,14 +17,14 @@ import {
|
|||
|
||||
export class Github implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Github',
|
||||
displayName: 'GitHub',
|
||||
name: 'github',
|
||||
icon: 'file:github.png',
|
||||
group: ['input'],
|
||||
version: 1,
|
||||
description: 'Retrieve data from Github API.',
|
||||
description: 'Retrieve data from GitHub API.',
|
||||
defaults: {
|
||||
name: 'Github',
|
||||
name: 'GitHub',
|
||||
color: '#665533',
|
||||
},
|
||||
inputs: ['main'],
|
||||
|
@ -178,7 +178,7 @@ export class Github implements INodeType {
|
|||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get the data of a single issues',
|
||||
description: 'Get the data of a single issue',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
|
@ -220,7 +220,7 @@ export class Github implements INodeType {
|
|||
{
|
||||
name: 'List Popular Paths',
|
||||
value: 'listPopularPaths',
|
||||
description: 'Get the data of a file in repositoryGet the top 10 popular content paths over the last 14 days.',
|
||||
description: 'Get the top 10 popular content paths over the last 14 days.',
|
||||
},
|
||||
{
|
||||
name: 'List Referrers',
|
||||
|
@ -458,7 +458,7 @@ export class Github implements INodeType {
|
|||
description: 'The name of the author of the commit.',
|
||||
},
|
||||
{
|
||||
displayName: 'EMail',
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
|
@ -491,7 +491,7 @@ export class Github implements INodeType {
|
|||
description: 'The name of the committer of the commit.',
|
||||
},
|
||||
{
|
||||
displayName: 'EMail',
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
default: '',
|
||||
|
@ -1014,28 +1014,28 @@ export class Github implements INodeType {
|
|||
name: 'assignee',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Return only issuse which are assigned to a specific user.',
|
||||
description: 'Return only issues which are assigned to a specific user.',
|
||||
},
|
||||
{
|
||||
displayName: 'Creator',
|
||||
name: 'creator',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Return only issuse which were created by a specific user.',
|
||||
description: 'Return only issues which were created by a specific user.',
|
||||
},
|
||||
{
|
||||
displayName: 'Mentioned',
|
||||
name: 'mentioned',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Return only issuse in which a specific user was mentioned.',
|
||||
description: 'Return only issues in which a specific user was mentioned.',
|
||||
},
|
||||
{
|
||||
displayName: 'Labels',
|
||||
name: 'labels',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Return only issuse with the given labels. Multiple lables can be separated by comma.',
|
||||
description: 'Return only issues with the given labels. Multiple lables can be separated by comma.',
|
||||
},
|
||||
{
|
||||
displayName: 'Updated Since',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
|
@ -102,6 +102,7 @@ export class GoogleTasks implements INodeType {
|
|||
body = {};
|
||||
//https://developers.google.com/tasks/v1/reference/tasks/insert
|
||||
const taskId = this.getNodeParameter('task', i) as string;
|
||||
body.title = this.getNodeParameter('title', i) as string;
|
||||
const additionalFields = this.getNodeParameter(
|
||||
'additionalFields',
|
||||
i
|
||||
|
@ -121,11 +122,6 @@ export class GoogleTasks implements INodeType {
|
|||
if (additionalFields.notes) {
|
||||
body.notes = additionalFields.notes as string;
|
||||
}
|
||||
|
||||
if (additionalFields.title) {
|
||||
body.title = additionalFields.title as string;
|
||||
}
|
||||
|
||||
if (additionalFields.dueDate) {
|
||||
body.dueDate = additionalFields.dueDate as string;
|
||||
}
|
||||
|
|
|
@ -70,6 +70,13 @@ export const taskFields = [
|
|||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Title',
|
||||
name: 'title',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Title of the task.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
|
@ -146,13 +153,7 @@ export const taskFields = [
|
|||
default: '',
|
||||
description: 'Current status of the task.',
|
||||
},
|
||||
{
|
||||
displayName: 'Title',
|
||||
name: 'title',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Title of the task.',
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
|
|
@ -62,7 +62,7 @@ export class Mattermost implements INodeType {
|
|||
},
|
||||
],
|
||||
default: 'message',
|
||||
description: 'The resource to operate on.',
|
||||
description: 'The resource to operate on',
|
||||
},
|
||||
|
||||
|
||||
|
@ -95,22 +95,22 @@ export class Mattermost implements INodeType {
|
|||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Soft-deletes a channel',
|
||||
description: 'Soft delete a channel',
|
||||
},
|
||||
{
|
||||
name: 'Member',
|
||||
value: 'members',
|
||||
description: 'Get a page of members for a channel.',
|
||||
description: 'Get a page of members for a channel',
|
||||
},
|
||||
{
|
||||
name: 'Restore',
|
||||
value: 'restore',
|
||||
description: 'Restores a soft-deleted channel',
|
||||
description: 'Restores a soft deleted channel',
|
||||
},
|
||||
{
|
||||
name: 'Statistics',
|
||||
value: 'statistics',
|
||||
description: 'Get statistics for a channel.',
|
||||
description: 'Get statistics for a channel',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
|
@ -131,7 +131,7 @@ export class Mattermost implements INodeType {
|
|||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Soft deletes a post, by marking the post as deleted in the database.',
|
||||
description: 'Soft delete a post, by marking the post as deleted in the database',
|
||||
},
|
||||
{
|
||||
name: 'Post',
|
||||
|
@ -140,7 +140,7 @@ export class Mattermost implements INodeType {
|
|||
},
|
||||
],
|
||||
default: 'post',
|
||||
description: 'The operation to perform.',
|
||||
description: 'The operation to perform',
|
||||
},
|
||||
|
||||
|
||||
|
@ -191,7 +191,7 @@ export class Mattermost implements INodeType {
|
|||
},
|
||||
},
|
||||
required: true,
|
||||
description: 'The non-unique UI name for the channel.',
|
||||
description: 'The non-unique UI name for the channel',
|
||||
},
|
||||
{
|
||||
displayName: 'Name',
|
||||
|
@ -210,7 +210,7 @@ export class Mattermost implements INodeType {
|
|||
},
|
||||
},
|
||||
required: true,
|
||||
description: 'The unique handle for the channel, will be present in the channel URL.',
|
||||
description: 'The unique handle for the channel, will be present in the channel URL',
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
|
@ -264,7 +264,7 @@ export class Mattermost implements INodeType {
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the channel to soft-delete.',
|
||||
description: 'The ID of the channel to soft delete',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
|
|
|
@ -5,10 +5,12 @@ import {
|
|||
|
||||
import {
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
|
||||
export interface ICustomInterface {
|
||||
name: string;
|
||||
|
@ -33,7 +35,7 @@ export interface ICustomProperties {
|
|||
* @param {object} body
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export async function pipedriveApiRequest(this: IHookFunctions | IExecuteFunctions, method: string, endpoint: string, body: IDataObject, query?: IDataObject, formData?: IDataObject, downloadFile?: boolean): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function pipedriveApiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: IDataObject, query?: IDataObject, formData?: IDataObject, downloadFile?: boolean): Promise<any> { // tslint:disable-line:no-any
|
||||
const credentials = this.getCredentials('pipedriveApi');
|
||||
if (credentials === undefined) {
|
||||
throw new Error('No credentials got returned!');
|
||||
|
@ -66,6 +68,7 @@ export async function pipedriveApiRequest(this: IHookFunctions | IExecuteFunctio
|
|||
}
|
||||
|
||||
try {
|
||||
//@ts-ignore
|
||||
const responseData = await this.helpers.request(options);
|
||||
|
||||
if (downloadFile === true) {
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import {
|
||||
BINARY_ENCODING,
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
import {
|
||||
IDataObject,
|
||||
INodeTypeDescription,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodePropertyOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
|
@ -2047,9 +2049,68 @@ export class Pipedrive implements INodeType {
|
|||
description: 'How many results to return.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// person:getAll
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'person',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Filter ID',
|
||||
name: 'filterId',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getFilters',
|
||||
},
|
||||
default: '',
|
||||
description: 'ID of the filter to use.',
|
||||
},
|
||||
{
|
||||
displayName: 'First Char',
|
||||
name: 'firstChar',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'If supplied, only persons whose name starts with the specified letter will be returned ',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
// Get all the filters to display them to user so that he can
|
||||
// select them easily
|
||||
async getFilters(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const { data } = await pipedriveApiRequest.call(this, 'GET', '/filters', {}, { type: 'people' });
|
||||
for (const filter of data) {
|
||||
const filterName = filter.name;
|
||||
const filterId = filter.id;
|
||||
returnData.push({
|
||||
name: filterName,
|
||||
value: filterId,
|
||||
});
|
||||
}
|
||||
return returnData;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
|
@ -2453,6 +2514,16 @@ export class Pipedrive implements INodeType {
|
|||
qs.limit = this.getNodeParameter('limit', i) as number;
|
||||
}
|
||||
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
|
||||
if (additionalFields.filterId) {
|
||||
qs.filter_id = additionalFields.filterId as string;
|
||||
}
|
||||
|
||||
if (additionalFields.firstChar) {
|
||||
qs.first_char = additionalFields.firstChar as string;
|
||||
}
|
||||
|
||||
endpoint = `/persons`;
|
||||
|
||||
} else if (operation === 'update') {
|
||||
|
@ -2499,6 +2570,7 @@ export class Pipedrive implements INodeType {
|
|||
}
|
||||
|
||||
responseData = await pipedriveApiRequest.call(this, requestMethod, endpoint, body, qs, formData, downloadFile);
|
||||
|
||||
}
|
||||
|
||||
if (resource === 'file' && operation === 'download') {
|
||||
|
@ -2520,6 +2592,11 @@ export class Pipedrive implements INodeType {
|
|||
|
||||
items[i].binary![binaryPropertyName] = await this.helpers.prepareBinaryData(responseData.data);
|
||||
} else {
|
||||
|
||||
if (responseData.data === null) {
|
||||
responseData.data = [];
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData.data)) {
|
||||
returnData.push.apply(returnData, responseData.data as IDataObject[]);
|
||||
} else {
|
||||
|
|
|
@ -402,6 +402,7 @@ export class Redis implements INodeType {
|
|||
} else if (type === 'hash') {
|
||||
const clientHset = util.promisify(client.hset).bind(client);
|
||||
for (const key of Object.keys(value)) {
|
||||
// @ts-ignore
|
||||
await clientHset(keyName, key, (value as IDataObject)[key]!.toString());
|
||||
}
|
||||
} else if (type === 'list') {
|
||||
|
|
|
@ -30,7 +30,7 @@ export async function salesforceApiRequest(this: IExecuteFunctions | IExecuteSin
|
|||
}
|
||||
}
|
||||
|
||||
export async function salesforceApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string ,method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function salesforceApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
|
|
52
packages/nodes-base/nodes/Signl4/GenericFunctions.ts
Normal file
52
packages/nodes-base/nodes/Signl4/GenericFunctions.ts
Normal file
|
@ -0,0 +1,52 @@
|
|||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
|
||||
/**
|
||||
* Make an API request to SIGNL4
|
||||
*
|
||||
* @param {IHookFunctions | IExecuteFunctions} this
|
||||
* @param {object} message
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
|
||||
export async function SIGNL4ApiRequest(this: IExecuteFunctions, method: string, resource: string, body: any = {}, query: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
headers: {
|
||||
'Accept': '*/*',
|
||||
},
|
||||
method,
|
||||
body,
|
||||
qs: query,
|
||||
uri: uri || ``,
|
||||
json: true,
|
||||
};
|
||||
|
||||
if (!Object.keys(body).length) {
|
||||
delete options.body;
|
||||
}
|
||||
if (!Object.keys(query).length) {
|
||||
delete options.qs;
|
||||
}
|
||||
options = Object.assign({}, options, option);
|
||||
|
||||
try {
|
||||
return await this.helpers.request!(options);
|
||||
} catch (error) {
|
||||
|
||||
if (error.response && error.response.body && error.response.body.details) {
|
||||
throw new Error(`SIGNL4 error response [${error.statusCode}]: ${error.response.body.details}`);
|
||||
}
|
||||
|
||||
throw error;
|
||||
}
|
||||
}
|
325
packages/nodes-base/nodes/Signl4/Signl4.node.ts
Normal file
325
packages/nodes-base/nodes/Signl4/Signl4.node.ts
Normal file
|
@ -0,0 +1,325 @@
|
|||
import {
|
||||
IExecuteFunctions,
|
||||
BINARY_ENCODING,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IBinaryKeyData,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
SIGNL4ApiRequest,
|
||||
} from './GenericFunctions';
|
||||
|
||||
export class Signl4 implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'SIGNL4',
|
||||
name: 'signl4',
|
||||
icon: 'file:signl4.png',
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
description: 'Consume SIGNL4 API.',
|
||||
defaults: {
|
||||
name: 'SIGNL4',
|
||||
color: '#53afe8',
|
||||
},
|
||||
inputs: ['main'],
|
||||
outputs: ['main'],
|
||||
credentials: [
|
||||
{
|
||||
name: 'signl4Api',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Alert',
|
||||
value: 'alert',
|
||||
},
|
||||
],
|
||||
default: 'alert',
|
||||
description: 'The resource to operate on.',
|
||||
},
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'alert',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Send',
|
||||
value: 'send',
|
||||
description: 'Send an alert.',
|
||||
},
|
||||
],
|
||||
default: 'send',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
{
|
||||
displayName: 'Message',
|
||||
name: 'message',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
default: '',
|
||||
required: false,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'send',
|
||||
],
|
||||
resource: [
|
||||
'alert',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'A more detailed description for the alert.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'send',
|
||||
],
|
||||
resource: [
|
||||
'alert',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Alerting Scenario',
|
||||
name: 'alertingScenario',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Single ACK',
|
||||
value: 'single_ack',
|
||||
description: 'In case only one person needs to confirm this Signl.'
|
||||
},
|
||||
{
|
||||
name: 'Multi ACK',
|
||||
value: 'multi_ack',
|
||||
description: 'in case this alert must be confirmed by the number of people who are on duty at the time this Singl is raised',
|
||||
},
|
||||
],
|
||||
default: 'single_ack',
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
displayName: 'Attachments',
|
||||
name: 'attachmentsUi',
|
||||
placeholder: 'Add Attachments',
|
||||
type: 'fixedCollection',
|
||||
typeOptions: {
|
||||
multipleValues: false,
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'attachmentsBinary',
|
||||
displayName: 'Attachments Binary',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'property',
|
||||
type: 'string',
|
||||
placeholder: 'data',
|
||||
default: '',
|
||||
description: 'Name of the binary properties which contain data which should be added as attachment',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
default: {},
|
||||
},
|
||||
{
|
||||
displayName: 'External ID',
|
||||
name: 'externalId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: `If the event originates from a record in a 3rd party system, use this parameter to pass <br/>
|
||||
the unique ID of that record. That ID will be communicated in outbound webhook notifications from SIGNL4,<br/>
|
||||
which is great for correlation/synchronization of that record with the alert.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Filtering',
|
||||
name: 'filtering',
|
||||
type: 'boolean',
|
||||
default: 'false',
|
||||
description: `Specify a boolean value of true or false to apply event filtering for this event, or not. <br/>
|
||||
If set to true, the event will only trigger a notification to the team, if it contains at least one keyword <br/>
|
||||
from one of your services and system categories (i.e. it is whitelisted)`,
|
||||
},
|
||||
{
|
||||
displayName: 'Location',
|
||||
name: 'locationFieldsUi',
|
||||
type: 'fixedCollection',
|
||||
placeholder: 'Add Location',
|
||||
default: {},
|
||||
description: 'Transmit location information (\'latitude, longitude\') with your event and display a map in the mobile app.',
|
||||
options: [
|
||||
{
|
||||
name: 'locationFieldsValues',
|
||||
displayName: 'Location',
|
||||
values: [
|
||||
{
|
||||
displayName: 'Latitude',
|
||||
name: 'latitude',
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'The location latitude.',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Longitude',
|
||||
name: 'longitude',
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'The location longitude.',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
}
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Service',
|
||||
name: 'service',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Assigns the alert to the service/system category with the specified name.',
|
||||
},
|
||||
{
|
||||
displayName: 'Title',
|
||||
name: 'title',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
const length = (items.length as unknown) as number;
|
||||
const qs: IDataObject = {};
|
||||
let responseData;
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (resource === 'alert') {
|
||||
//https://connect.signl4.com/webhook/docs/index.html
|
||||
if (operation === 'send') {
|
||||
const message = this.getNodeParameter('message', i) as string;
|
||||
const additionalFields = this.getNodeParameter('additionalFields',i) as IDataObject;
|
||||
|
||||
const data: IDataObject = {
|
||||
message,
|
||||
};
|
||||
|
||||
if (additionalFields.alertingScenario) {
|
||||
data['X-S4-AlertingScenario'] = additionalFields.alertingScenario as string;
|
||||
}
|
||||
if (additionalFields.externalId) {
|
||||
data['X-S4-ExternalID'] = additionalFields.externalId as string;
|
||||
}
|
||||
if (additionalFields.filtering) {
|
||||
data['X-S4-Filtering'] = (additionalFields.filtering as boolean).toString();
|
||||
}
|
||||
if (additionalFields.locationFieldsUi) {
|
||||
const locationUi = (additionalFields.locationFieldsUi as IDataObject).locationFieldsValues as IDataObject;
|
||||
if (locationUi) {
|
||||
data['X-S4-Location'] = `${locationUi.latitude},${locationUi.longitude}`;
|
||||
}
|
||||
}
|
||||
if (additionalFields.service) {
|
||||
data['X-S4-Service'] = additionalFields.service as string;
|
||||
}
|
||||
if (additionalFields.title) {
|
||||
data['title'] = additionalFields.title as string;
|
||||
}
|
||||
|
||||
const attachments = additionalFields.attachmentsUi as IDataObject;
|
||||
|
||||
if (attachments) {
|
||||
if (attachments.attachmentsBinary && items[i].binary) {
|
||||
|
||||
const propertyName = (attachments.attachmentsBinary as IDataObject).property as string;
|
||||
|
||||
const binaryProperty = (items[i].binary as IBinaryKeyData)[propertyName];
|
||||
|
||||
if (binaryProperty) {
|
||||
|
||||
const supportedFileExtension = ['png', 'jpg', 'txt'];
|
||||
|
||||
if (!supportedFileExtension.includes(binaryProperty.fileExtension as string)) {
|
||||
|
||||
throw new Error(`Invalid extension, just ${supportedFileExtension.join(',')} are supported}`);
|
||||
}
|
||||
|
||||
data['file'] = {
|
||||
value: Buffer.from(binaryProperty.data, BINARY_ENCODING),
|
||||
options: {
|
||||
filename: binaryProperty.fileName,
|
||||
contentType: binaryProperty.mimeType,
|
||||
},
|
||||
};
|
||||
|
||||
} else {
|
||||
throw new Error(`Binary property ${propertyName} does not exist on input`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const credentials = this.getCredentials('signl4Api');
|
||||
|
||||
const endpoint = `https://connect.signl4.com/webhook/${credentials?.teamSecret}`;
|
||||
|
||||
responseData = await SIGNL4ApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'',
|
||||
{},
|
||||
{},
|
||||
endpoint,
|
||||
{
|
||||
formData: {
|
||||
...data,
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else if (responseData !== undefined) {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
}
|
||||
}
|
BIN
packages/nodes-base/nodes/Signl4/signl4.png
Normal file
BIN
packages/nodes-base/nodes/Signl4/signl4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3 KiB |
|
@ -91,7 +91,7 @@ export const messageFields = [
|
|||
],
|
||||
},
|
||||
},
|
||||
description: 'Post the message as authenticated user instead of bot.',
|
||||
description: 'Post the message as authenticated user instead of bot. Works only with user token.',
|
||||
},
|
||||
{
|
||||
displayName: 'User Name',
|
||||
|
@ -486,6 +486,26 @@ export const messageFields = [
|
|||
},
|
||||
description: `Timestamp of the message to be updated.`,
|
||||
},
|
||||
{
|
||||
displayName: 'As User',
|
||||
name: 'as_user',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'accessToken',
|
||||
],
|
||||
operation: [
|
||||
'update'
|
||||
],
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'Pass true to update the message as the authed user. Works only with user token.',
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
|
|
|
@ -289,7 +289,7 @@ export class Slack implements INodeType {
|
|||
if (operation === 'get') {
|
||||
const channel = this.getNodeParameter('channelId', i) as string;
|
||||
qs.channel = channel,
|
||||
responseData = await slackApiRequest.call(this, 'POST', '/conversations.info', {}, qs);
|
||||
responseData = await slackApiRequest.call(this, 'POST', '/conversations.info', {}, qs);
|
||||
responseData = responseData.channel;
|
||||
}
|
||||
//https://api.slack.com/methods/conversations.list
|
||||
|
@ -452,15 +452,12 @@ export class Slack implements INodeType {
|
|||
}
|
||||
if (body.as_user === false) {
|
||||
body.username = this.getNodeParameter('username', i) as string;
|
||||
delete body.as_user;
|
||||
}
|
||||
|
||||
// ignore body.as_user as it's deprecated
|
||||
|
||||
delete body.as_user;
|
||||
|
||||
if (!jsonParameters) {
|
||||
const attachments = this.getNodeParameter('attachments', i, []) as unknown as Attachment[];
|
||||
const blocksUi = (this.getNodeParameter('blocksUi', i, []) as IDataObject).blocksValues as IDataObject[];
|
||||
const blocksUi = (this.getNodeParameter('blocksUi', i, []) as IDataObject).blocksValues as IDataObject[];
|
||||
|
||||
// The node does save the fields data differently than the API
|
||||
// expects so fix the data befre we send the request
|
||||
|
@ -486,7 +483,7 @@ export class Slack implements INodeType {
|
|||
block.block_id = blockUi.blockId as string;
|
||||
block.type = blockUi.type as string;
|
||||
if (block.type === 'actions') {
|
||||
const elementsUi = (blockUi.elementsUi as IDataObject).elementsValues as IDataObject[];
|
||||
const elementsUi = (blockUi.elementsUi as IDataObject).elementsValues as IDataObject[];
|
||||
if (elementsUi) {
|
||||
for (const elementUi of elementsUi) {
|
||||
const element: Element = {};
|
||||
|
@ -502,7 +499,7 @@ export class Slack implements INodeType {
|
|||
text: elementUi.text as string,
|
||||
type: 'plain_text',
|
||||
emoji: elementUi.emoji as boolean,
|
||||
};
|
||||
};
|
||||
if (elementUi.url) {
|
||||
element.url = elementUi.url as string;
|
||||
}
|
||||
|
@ -512,13 +509,13 @@ export class Slack implements INodeType {
|
|||
if (elementUi.style !== 'default') {
|
||||
element.style = elementUi.style as string;
|
||||
}
|
||||
const confirmUi = (elementUi.confirmUi as IDataObject).confirmValue as IDataObject;
|
||||
if (confirmUi) {
|
||||
const confirmUi = (elementUi.confirmUi as IDataObject).confirmValue as IDataObject;
|
||||
if (confirmUi) {
|
||||
const confirm: Confirm = {};
|
||||
const titleUi = (confirmUi.titleUi as IDataObject).titleValue as IDataObject;
|
||||
const textUi = (confirmUi.textUi as IDataObject).textValue as IDataObject;
|
||||
const confirmTextUi = (confirmUi.confirmTextUi as IDataObject).confirmValue as IDataObject;
|
||||
const denyUi = (confirmUi.denyUi as IDataObject).denyValue as IDataObject;
|
||||
const titleUi = (confirmUi.titleUi as IDataObject).titleValue as IDataObject;
|
||||
const textUi = (confirmUi.textUi as IDataObject).textValue as IDataObject;
|
||||
const confirmTextUi = (confirmUi.confirmTextUi as IDataObject).confirmValue as IDataObject;
|
||||
const denyUi = (confirmUi.denyUi as IDataObject).denyValue as IDataObject;
|
||||
const style = confirmUi.style as string;
|
||||
if (titleUi) {
|
||||
confirm.title = {
|
||||
|
@ -552,13 +549,13 @@ export class Slack implements INodeType {
|
|||
confirm.style = style as string;
|
||||
}
|
||||
element.confirm = confirm;
|
||||
}
|
||||
elements.push(element);
|
||||
}
|
||||
elements.push(element);
|
||||
}
|
||||
block.elements = elements;
|
||||
}
|
||||
} else if (block.type === 'section') {
|
||||
const textUi = (blockUi.textUi as IDataObject).textValue as IDataObject;
|
||||
const textUi = (blockUi.textUi as IDataObject).textValue as IDataObject;
|
||||
if (textUi) {
|
||||
const text: Text = {};
|
||||
if (textUi.type === 'plainText') {
|
||||
|
@ -573,7 +570,7 @@ export class Slack implements INodeType {
|
|||
} else {
|
||||
throw new Error('Property text must be defined');
|
||||
}
|
||||
const fieldsUi = (blockUi.fieldsUi as IDataObject).fieldsValues as IDataObject[];
|
||||
const fieldsUi = (blockUi.fieldsUi as IDataObject).fieldsValues as IDataObject[];
|
||||
if (fieldsUi) {
|
||||
const fields: Text[] = [];
|
||||
for (const fieldUi of fieldsUi) {
|
||||
|
@ -593,7 +590,7 @@ export class Slack implements INodeType {
|
|||
block.fields = fields;
|
||||
}
|
||||
}
|
||||
const accessoryUi = (blockUi.accessoryUi as IDataObject).accessoriesValues as IDataObject;
|
||||
const accessoryUi = (blockUi.accessoryUi as IDataObject).accessoriesValues as IDataObject;
|
||||
if (accessoryUi) {
|
||||
const accessory: Element = {};
|
||||
if (accessoryUi.type === 'button') {
|
||||
|
@ -612,46 +609,46 @@ export class Slack implements INodeType {
|
|||
if (accessoryUi.style !== 'default') {
|
||||
accessory.style = accessoryUi.style as string;
|
||||
}
|
||||
const confirmUi = (accessoryUi.confirmUi as IDataObject).confirmValue as IDataObject;
|
||||
const confirmUi = (accessoryUi.confirmUi as IDataObject).confirmValue as IDataObject;
|
||||
if (confirmUi) {
|
||||
const confirm: Confirm = {};
|
||||
const titleUi = (confirmUi.titleUi as IDataObject).titleValue as IDataObject;
|
||||
const textUi = (confirmUi.textUi as IDataObject).textValue as IDataObject;
|
||||
const confirmTextUi = (confirmUi.confirmTextUi as IDataObject).confirmValue as IDataObject;
|
||||
const denyUi = (confirmUi.denyUi as IDataObject).denyValue as IDataObject;
|
||||
const style = confirmUi.style as string;
|
||||
if (titleUi) {
|
||||
confirm.title = {
|
||||
type: 'plain_text',
|
||||
text: titleUi.text as string,
|
||||
emoji: titleUi.emoji as boolean,
|
||||
};
|
||||
}
|
||||
if (textUi) {
|
||||
confirm.text = {
|
||||
type: 'plain_text',
|
||||
text: textUi.text as string,
|
||||
emoji: textUi.emoji as boolean,
|
||||
};
|
||||
}
|
||||
if (confirmTextUi) {
|
||||
confirm.confirm = {
|
||||
type: 'plain_text',
|
||||
text: confirmTextUi.text as string,
|
||||
emoji: confirmTextUi.emoji as boolean,
|
||||
};
|
||||
}
|
||||
if (denyUi) {
|
||||
confirm.deny = {
|
||||
type: 'plain_text',
|
||||
text: denyUi.text as string,
|
||||
emoji: denyUi.emoji as boolean,
|
||||
};
|
||||
}
|
||||
if (style !== 'default') {
|
||||
confirm.style = style as string;
|
||||
}
|
||||
accessory.confirm = confirm;
|
||||
const confirm: Confirm = {};
|
||||
const titleUi = (confirmUi.titleUi as IDataObject).titleValue as IDataObject;
|
||||
const textUi = (confirmUi.textUi as IDataObject).textValue as IDataObject;
|
||||
const confirmTextUi = (confirmUi.confirmTextUi as IDataObject).confirmValue as IDataObject;
|
||||
const denyUi = (confirmUi.denyUi as IDataObject).denyValue as IDataObject;
|
||||
const style = confirmUi.style as string;
|
||||
if (titleUi) {
|
||||
confirm.title = {
|
||||
type: 'plain_text',
|
||||
text: titleUi.text as string,
|
||||
emoji: titleUi.emoji as boolean,
|
||||
};
|
||||
}
|
||||
if (textUi) {
|
||||
confirm.text = {
|
||||
type: 'plain_text',
|
||||
text: textUi.text as string,
|
||||
emoji: textUi.emoji as boolean,
|
||||
};
|
||||
}
|
||||
if (confirmTextUi) {
|
||||
confirm.confirm = {
|
||||
type: 'plain_text',
|
||||
text: confirmTextUi.text as string,
|
||||
emoji: confirmTextUi.emoji as boolean,
|
||||
};
|
||||
}
|
||||
if (denyUi) {
|
||||
confirm.deny = {
|
||||
type: 'plain_text',
|
||||
text: denyUi.text as string,
|
||||
emoji: denyUi.emoji as boolean,
|
||||
};
|
||||
}
|
||||
if (style !== 'default') {
|
||||
confirm.style = style as string;
|
||||
}
|
||||
accessory.confirm = confirm;
|
||||
}
|
||||
}
|
||||
block.accessory = accessory;
|
||||
|
@ -790,8 +787,8 @@ export class Slack implements INodeType {
|
|||
if (binaryData) {
|
||||
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
|
||||
if (items[i].binary === undefined
|
||||
//@ts-ignore
|
||||
|| items[i].binary[binaryPropertyName] === undefined) {
|
||||
//@ts-ignore
|
||||
|| items[i].binary[binaryPropertyName] === undefined) {
|
||||
throw new Error(`No binary data property "${binaryPropertyName}" does not exists on item!`);
|
||||
}
|
||||
body.file = {
|
||||
|
@ -804,7 +801,7 @@ export class Slack implements INodeType {
|
|||
contentType: items[i].binary[binaryPropertyName].mimeType,
|
||||
}
|
||||
};
|
||||
responseData = await slackApiRequest.call(this, 'POST', '/files.upload', {}, qs, { 'Content-Type': 'multipart/form-data' }, { formData: body });
|
||||
responseData = await slackApiRequest.call(this, 'POST', '/files.upload', {}, qs, { 'Content-Type': 'multipart/form-data' }, { formData: body });
|
||||
responseData = responseData.file;
|
||||
} else {
|
||||
const fileContent = this.getNodeParameter('fileContent', i) as string;
|
||||
|
|
84
packages/nodes-base/nodes/Spotify/GenericFunctions.ts
Normal file
84
packages/nodes-base/nodes/Spotify/GenericFunctions.ts
Normal file
|
@ -0,0 +1,84 @@
|
|||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
/**
|
||||
* Make an API request to Spotify
|
||||
*
|
||||
* @param {IHookFunctions} this
|
||||
* @param {string} method
|
||||
* @param {string} url
|
||||
* @param {object} body
|
||||
* @returns {Promise<any>}
|
||||
*/
|
||||
export async function spotifyApiRequest(this: IHookFunctions | IExecuteFunctions,
|
||||
method: string, endpoint: string, body: object, query?: object, uri?: string): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
method,
|
||||
headers: {
|
||||
'User-Agent': 'n8n',
|
||||
'Content-Type': 'text/plain',
|
||||
'Accept': ' application/json',
|
||||
},
|
||||
body,
|
||||
qs: query,
|
||||
uri: uri || `https://api.spotify.com/v1${endpoint}`,
|
||||
json: true
|
||||
};
|
||||
|
||||
try {
|
||||
const credentials = this.getCredentials('spotifyOAuth2Api');
|
||||
|
||||
if (credentials === undefined) {
|
||||
throw new Error('No credentials got returned!');
|
||||
}
|
||||
|
||||
if (Object.keys(body).length === 0) {
|
||||
delete options.body;
|
||||
}
|
||||
|
||||
return await this.helpers.requestOAuth2.call(this, 'spotifyOAuth2Api', options);
|
||||
} catch (error) {
|
||||
if (error.statusCode === 401) {
|
||||
// Return a clear error
|
||||
throw new Error('The Spotify credentials are not valid!');
|
||||
}
|
||||
|
||||
if (error.error && error.error.error && error.error.error.message) {
|
||||
// Try to return the error prettier
|
||||
throw new Error(`Spotify error response [${error.error.error.status}]: ${error.error.error.message}`);
|
||||
}
|
||||
|
||||
// If that data does not exist for some reason return the actual error
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function spotifyApiRequestAllItems(this: IHookFunctions | IExecuteFunctions,
|
||||
propertyName: string, method: string, endpoint: string, body: object, query?: object): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
|
||||
let uri: string | undefined;
|
||||
|
||||
do {
|
||||
responseData = await spotifyApiRequest.call(this, method, endpoint, body, query, uri);
|
||||
returnData.push.apply(returnData, responseData[propertyName]);
|
||||
uri = responseData.next;
|
||||
|
||||
} while (
|
||||
responseData['next'] !== null
|
||||
);
|
||||
|
||||
return returnData;
|
||||
}
|
816
packages/nodes-base/nodes/Spotify/Spotify.node.ts
Normal file
816
packages/nodes-base/nodes/Spotify/Spotify.node.ts
Normal file
|
@ -0,0 +1,816 @@
|
|||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
spotifyApiRequest,
|
||||
spotifyApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
|
||||
export class Spotify implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Spotify',
|
||||
name: 'spotify',
|
||||
icon: 'file:spotify.png',
|
||||
group: ['input'],
|
||||
version: 1,
|
||||
description: 'Access public song data via the Spotify API.',
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
defaults: {
|
||||
name: 'Spotify',
|
||||
color: '#1DB954',
|
||||
},
|
||||
inputs: ['main'],
|
||||
outputs: ['main'],
|
||||
credentials: [
|
||||
{
|
||||
name: 'spotifyOAuth2Api',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
// ----------------------------------------------------------
|
||||
// Resource to Operate on
|
||||
// Player, Album, Artisits, Playlists, Tracks
|
||||
// ----------------------------------------------------------
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Album',
|
||||
value: 'album',
|
||||
},
|
||||
{
|
||||
name: 'Artist',
|
||||
value: 'artist',
|
||||
},
|
||||
{
|
||||
name: 'Player',
|
||||
value: 'player',
|
||||
},
|
||||
{
|
||||
name: 'Playlist',
|
||||
value: 'playlist',
|
||||
},
|
||||
{
|
||||
name: 'Track',
|
||||
value: 'track',
|
||||
},
|
||||
],
|
||||
default: 'player',
|
||||
description: 'The resource to operate on.',
|
||||
},
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
// Player Operations
|
||||
// Pause, Play, Get Recently Played, Get Currently Playing, Next Song, Previous Song, Add to Queue
|
||||
// --------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'player',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Add Song to Queue',
|
||||
value: 'addSongToQueue',
|
||||
description: 'Add a song to your queue.'
|
||||
},
|
||||
{
|
||||
name: 'Currently Playing',
|
||||
value: 'currentlyPlaying',
|
||||
description: 'Get your currently playing track.'
|
||||
},
|
||||
{
|
||||
name: 'Next Song',
|
||||
value: 'nextSong',
|
||||
description: 'Skip to your next track.'
|
||||
},
|
||||
{
|
||||
name: 'Pause',
|
||||
value: 'pause',
|
||||
description: 'Pause your music.',
|
||||
},
|
||||
{
|
||||
name: 'Previous Song',
|
||||
value: 'previousSong',
|
||||
description: 'Skip to your previous song.'
|
||||
},
|
||||
{
|
||||
name: 'Recently Played',
|
||||
value: 'recentlyPlayed',
|
||||
description: 'Get your recently played tracks.'
|
||||
},
|
||||
{
|
||||
name: 'Start Music',
|
||||
value: 'startMusic',
|
||||
description: 'Start playing a playlist, artist, or album.'
|
||||
},
|
||||
],
|
||||
default: 'addSongToQueue',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
{
|
||||
displayName: 'Resource ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'player'
|
||||
],
|
||||
operation: [
|
||||
'startMusic',
|
||||
],
|
||||
},
|
||||
},
|
||||
placeholder: 'spotify:album:1YZ3k65Mqw3G8FzYlW1mmp',
|
||||
description: `Enter a playlist, artist, or album URI or ID.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Track ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'player'
|
||||
],
|
||||
operation: [
|
||||
'addSongToQueue',
|
||||
],
|
||||
},
|
||||
},
|
||||
placeholder: 'spotify:track:0xE4LEFzSNGsz1F6kvXsHU',
|
||||
description: `Enter a track URI or ID.`,
|
||||
},
|
||||
// -----------------------------------------------
|
||||
// Album Operations
|
||||
// Get an Album, Get an Album's Tracks
|
||||
// -----------------------------------------------
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'album',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get an album by URI or ID.',
|
||||
},
|
||||
{
|
||||
name: `Get Tracks`,
|
||||
value: 'getTracks',
|
||||
description: `Get an album's tracks by URI or ID.`,
|
||||
},
|
||||
],
|
||||
default: 'get',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
{
|
||||
displayName: 'Album ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'album',
|
||||
],
|
||||
},
|
||||
},
|
||||
placeholder: 'spotify:album:1YZ3k65Mqw3G8FzYlW1mmp',
|
||||
description: `The album's Spotify URI or ID.`,
|
||||
},
|
||||
// -------------------------------------------------------------------------------------------------------------
|
||||
// Artist Operations
|
||||
// Get an Artist, Get an Artist's Related Artists, Get an Artist's Top Tracks, Get an Artist's Albums
|
||||
// -------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'artist',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get an artist by URI or ID.',
|
||||
},
|
||||
{
|
||||
name: `Get Albums`,
|
||||
value: 'getAlbums',
|
||||
description: `Get an artist's albums by URI or ID.`,
|
||||
},
|
||||
{
|
||||
name: `Get Related Artists`,
|
||||
value: 'getRelatedArtists',
|
||||
description: `Get an artist's related artists by URI or ID.`,
|
||||
},
|
||||
{
|
||||
name: `Get Top Tracks`,
|
||||
value: 'getTopTracks',
|
||||
description: `Get an artist's top tracks by URI or ID.`,
|
||||
},
|
||||
],
|
||||
default: 'get',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
{
|
||||
displayName: 'Artist ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'artist',
|
||||
],
|
||||
},
|
||||
},
|
||||
placeholder: 'spotify:artist:4LLpKhyESsyAXpc4laK94U',
|
||||
description: `The artist's Spotify URI or ID.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Country',
|
||||
name: 'country',
|
||||
type: 'string',
|
||||
default: 'US',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'artist'
|
||||
],
|
||||
operation: [
|
||||
'getTopTracks',
|
||||
],
|
||||
},
|
||||
},
|
||||
placeholder: 'US',
|
||||
description: `Top tracks in which country? Enter the postal abbriviation.`,
|
||||
},
|
||||
// -------------------------------------------------------------------------------------------------------------
|
||||
// Playlist Operations
|
||||
// Get a Playlist, Get a Playlist's Tracks, Add/Remove a Song from a Playlist, Get a User's Playlists
|
||||
// -------------------------------------------------------------------------------------------------------------
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'playlist',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Add an Item',
|
||||
value: 'add',
|
||||
description: 'Add tracks from a playlist by track and playlist URI or ID.',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a playlist by URI or ID.',
|
||||
},
|
||||
{
|
||||
name: 'Get Tracks',
|
||||
value: 'getTracks',
|
||||
description: `Get a playlist's tracks by URI or ID.`,
|
||||
},
|
||||
{
|
||||
name: `Get the User's Playlists`,
|
||||
value: 'getUserPlaylists',
|
||||
description: `Get a user's playlists.`,
|
||||
},
|
||||
{
|
||||
name: 'Remove an Item',
|
||||
value: 'delete',
|
||||
description: 'Remove tracks from a playlist by track and playlist URI or ID.',
|
||||
},
|
||||
],
|
||||
default: 'add',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
{
|
||||
displayName: 'Playlist ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'playlist',
|
||||
],
|
||||
operation: [
|
||||
'add',
|
||||
'delete',
|
||||
'get',
|
||||
'getTracks',
|
||||
],
|
||||
},
|
||||
},
|
||||
placeholder: 'spotify:playlist:37i9dQZF1DWUhI3iC1khPH',
|
||||
description: `The playlist's Spotify URI or its ID.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Track ID',
|
||||
name: 'trackID',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'playlist',
|
||||
],
|
||||
operation: [
|
||||
'add',
|
||||
'delete',
|
||||
],
|
||||
},
|
||||
},
|
||||
placeholder: 'spotify:track:0xE4LEFzSNGsz1F6kvXsHU',
|
||||
description: `The track's Spotify URI or its ID. The track to add/delete from the playlist.`,
|
||||
},
|
||||
// -----------------------------------------------------
|
||||
// Track Operations
|
||||
// Get a Track, Get a Track's Audio Features
|
||||
// -----------------------------------------------------
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'track',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Get a track by its URI or ID.',
|
||||
},
|
||||
{
|
||||
name: 'Get Audio Features',
|
||||
value: 'getAudioFeatures',
|
||||
description: 'Get audio features for a track by URI or ID.',
|
||||
},
|
||||
],
|
||||
default: 'track',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
{
|
||||
displayName: 'Track ID',
|
||||
name: 'id',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'track',
|
||||
],
|
||||
},
|
||||
},
|
||||
placeholder: 'spotify:track:0xE4LEFzSNGsz1F6kvXsHU',
|
||||
description: `The track's Spotify URI or ID.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'album',
|
||||
'artist',
|
||||
'playlist',
|
||||
],
|
||||
operation: [
|
||||
'getTracks',
|
||||
'getAlbums',
|
||||
'getUserPlaylists',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: `The number of items to return.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'album',
|
||||
'artist',
|
||||
'playlist'
|
||||
],
|
||||
operation: [
|
||||
'getTracks',
|
||||
'getAlbums',
|
||||
'getUserPlaylists',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 100,
|
||||
},
|
||||
description: `The number of items to return.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
default: 50,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'player',
|
||||
],
|
||||
operation: [
|
||||
'recentlyPlayed',
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 50,
|
||||
},
|
||||
description: `The number of items to return.`,
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
// Get all of the incoming input data to loop through
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
// For Post
|
||||
let body: IDataObject;
|
||||
// For Query string
|
||||
let qs: IDataObject;
|
||||
|
||||
let requestMethod: string;
|
||||
let endpoint: string;
|
||||
let returnAll: boolean;
|
||||
let propertyName = '';
|
||||
let responseData;
|
||||
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
|
||||
// Set initial values
|
||||
requestMethod = 'GET';
|
||||
endpoint = '';
|
||||
body = {};
|
||||
qs = {};
|
||||
returnAll = false;
|
||||
|
||||
for(let i = 0; i < items.length; i++) {
|
||||
// -----------------------------
|
||||
// Player Operations
|
||||
// -----------------------------
|
||||
if( resource === 'player' ) {
|
||||
if(operation === 'pause') {
|
||||
requestMethod = 'PUT';
|
||||
|
||||
endpoint = `/me/player/pause`;
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
responseData = { success: true };
|
||||
|
||||
} else if(operation === 'recentlyPlayed') {
|
||||
requestMethod = 'GET';
|
||||
|
||||
endpoint = `/me/player/recently-played`;
|
||||
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
qs = {
|
||||
limit,
|
||||
};
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
responseData = responseData.items;
|
||||
|
||||
} else if(operation === 'currentlyPlaying') {
|
||||
requestMethod = 'GET';
|
||||
|
||||
endpoint = `/me/player/currently-playing`;
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
} else if(operation === 'nextSong') {
|
||||
requestMethod = 'POST';
|
||||
|
||||
endpoint = `/me/player/next`;
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
responseData = { success: true };
|
||||
|
||||
} else if(operation === 'previousSong') {
|
||||
requestMethod = 'POST';
|
||||
|
||||
endpoint = `/me/player/previous`;
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
responseData = { success: true };
|
||||
|
||||
} else if(operation === 'startMusic') {
|
||||
requestMethod = 'PUT';
|
||||
|
||||
endpoint = `/me/player/play`;
|
||||
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
body.context_uri = id;
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
responseData = { success: true };
|
||||
|
||||
} else if(operation === 'addSongToQueue') {
|
||||
requestMethod = 'POST';
|
||||
|
||||
endpoint = `/me/player/queue`;
|
||||
|
||||
const id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
qs = {
|
||||
uri: id
|
||||
};
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
responseData = { success: true };
|
||||
}
|
||||
// -----------------------------
|
||||
// Album Operations
|
||||
// -----------------------------
|
||||
} else if( resource === 'album') {
|
||||
const uri = this.getNodeParameter('id', i) as string;
|
||||
|
||||
const id = uri.replace('spotify:album:', '');
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
if(operation === 'get') {
|
||||
endpoint = `/albums/${id}`;
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
} else if(operation === 'getTracks') {
|
||||
endpoint = `/albums/${id}/tracks`;
|
||||
|
||||
propertyName = 'tracks';
|
||||
|
||||
returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
propertyName = 'items';
|
||||
|
||||
if(!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
qs = {
|
||||
limit,
|
||||
};
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
responseData = responseData.items;
|
||||
}
|
||||
}
|
||||
// -----------------------------
|
||||
// Artist Operations
|
||||
// -----------------------------
|
||||
} else if( resource === 'artist') {
|
||||
const uri = this.getNodeParameter('id', i) as string;
|
||||
|
||||
const id = uri.replace('spotify:artist:', '');
|
||||
|
||||
if(operation === 'getAlbums') {
|
||||
|
||||
endpoint = `/artists/${id}/albums`;
|
||||
|
||||
returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
propertyName = 'items';
|
||||
|
||||
if(!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
qs = {
|
||||
limit,
|
||||
};
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
responseData = responseData.items;
|
||||
}
|
||||
} else if(operation === 'getRelatedArtists') {
|
||||
|
||||
endpoint = `/artists/${id}/related-artists`;
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
responseData = responseData.artists;
|
||||
|
||||
} else if(operation === 'getTopTracks'){
|
||||
const country = this.getNodeParameter('country', i) as string;
|
||||
|
||||
qs = {
|
||||
country,
|
||||
};
|
||||
|
||||
endpoint = `/artists/${id}/top-tracks`;
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
responseData = responseData.tracks;
|
||||
|
||||
} else if (operation === 'get') {
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
endpoint = `/artists/${id}`;
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
}
|
||||
// -----------------------------
|
||||
// Playlist Operations
|
||||
// -----------------------------
|
||||
} else if( resource === 'playlist') {
|
||||
if(['delete', 'get', 'getTracks', 'add'].includes(operation)) {
|
||||
const uri = this.getNodeParameter('id', i) as string;
|
||||
|
||||
const id = uri.replace('spotify:playlist:', '');
|
||||
|
||||
if(operation === 'delete') {
|
||||
requestMethod = 'DELETE';
|
||||
const trackId = this.getNodeParameter('trackID', i) as string;
|
||||
|
||||
body.tracks = [
|
||||
{
|
||||
uri: `${trackId}`,
|
||||
positions: [ 0 ],
|
||||
},
|
||||
];
|
||||
|
||||
endpoint = `/playlists/${id}/tracks`;
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
responseData = { success: true };
|
||||
|
||||
} else if(operation === 'get') {
|
||||
requestMethod = 'GET';
|
||||
|
||||
endpoint = `/playlists/${id}`;
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
} else if(operation === 'getTracks') {
|
||||
requestMethod = 'GET';
|
||||
|
||||
endpoint = `/playlists/${id}/tracks`;
|
||||
|
||||
returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
propertyName = 'items';
|
||||
|
||||
if(!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
qs = {
|
||||
'limit': limit
|
||||
};
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
responseData = responseData.items;
|
||||
}
|
||||
} else if(operation === 'add') {
|
||||
requestMethod = 'POST';
|
||||
|
||||
const trackId = this.getNodeParameter('trackID', i) as string;
|
||||
|
||||
qs = {
|
||||
uris: trackId
|
||||
};
|
||||
|
||||
endpoint = `/playlists/${id}/tracks`;
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
}
|
||||
} else if(operation === 'getUserPlaylists') {
|
||||
requestMethod = 'GET';
|
||||
|
||||
endpoint = '/me/playlists';
|
||||
|
||||
returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
propertyName = 'items';
|
||||
|
||||
if(!returnAll) {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
|
||||
qs = {
|
||||
limit,
|
||||
};
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
responseData = responseData.items;
|
||||
}
|
||||
}
|
||||
// -----------------------------
|
||||
// Track Operations
|
||||
// -----------------------------
|
||||
} else if( resource === 'track') {
|
||||
const uri = this.getNodeParameter('id', i) as string;
|
||||
|
||||
const id = uri.replace('spotify:track:', '');
|
||||
|
||||
requestMethod = 'GET';
|
||||
|
||||
if(operation === 'getAudioFeatures') {
|
||||
endpoint = `/audio-features/${id}`;
|
||||
} else if(operation === 'get') {
|
||||
endpoint = `/tracks/${id}`;
|
||||
}
|
||||
|
||||
responseData = await spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
}
|
||||
|
||||
if(returnAll) {
|
||||
responseData = await spotifyApiRequestAllItems.call(this, propertyName, requestMethod, endpoint, body, qs);
|
||||
}
|
||||
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
}
|
||||
}
|
BIN
packages/nodes-base/nodes/Spotify/spotify.png
Normal file
BIN
packages/nodes-base/nodes/Spotify/spotify.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.5 KiB |
105
packages/nodes-base/nodes/Zoom/GenericFunctions.ts
Normal file
105
packages/nodes-base/nodes/Zoom/GenericFunctions.ts
Normal file
|
@ -0,0 +1,105 @@
|
|||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function zoomApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: object = {}, query: object = {}, headers: {} | undefined = undefined, option: {} = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
const authenticationMethod = this.getNodeParameter('authentication', 0, 'accessToken') as string;
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
method,
|
||||
headers: headers || {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body,
|
||||
qs: query,
|
||||
uri: `https://api.zoom.us/v2${resource}`,
|
||||
json: true
|
||||
};
|
||||
options = Object.assign({}, options, option);
|
||||
if (Object.keys(body).length === 0) {
|
||||
delete options.body;
|
||||
}
|
||||
if (Object.keys(query).length === 0) {
|
||||
delete options.qs;
|
||||
}
|
||||
|
||||
try {
|
||||
if (authenticationMethod === 'accessToken') {
|
||||
const credentials = this.getCredentials('zoomApi');
|
||||
if (credentials === undefined) {
|
||||
throw new Error('No credentials got returned!');
|
||||
}
|
||||
options.headers!.Authorization = `Bearer ${credentials.accessToken}`;
|
||||
|
||||
//@ts-ignore
|
||||
return await this.helpers.request(options);
|
||||
} else {
|
||||
//@ts-ignore
|
||||
return await this.helpers.requestOAuth2.call(this, 'zoomOAuth2Api', options);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.statusCode === 401) {
|
||||
// Return a clear error
|
||||
throw new Error('The Zoom credentials are not valid!');
|
||||
}
|
||||
|
||||
if (error.response && error.response.body && error.response.body.message) {
|
||||
// Try to return the error prettier
|
||||
throw new Error(`Zoom error response [${error.statusCode}]: ${error.response.body.message}`);
|
||||
}
|
||||
|
||||
// If that data does not exist for some reason return the actual error
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function zoomApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
endpoint: string,
|
||||
body: any = {},
|
||||
query: IDataObject = {}
|
||||
): Promise<any> {
|
||||
// tslint:disable-line:no-any
|
||||
const returnData: IDataObject[] = [];
|
||||
let responseData;
|
||||
query.page_number = 0;
|
||||
do {
|
||||
responseData = await zoomApiRequest.call(
|
||||
this,
|
||||
method,
|
||||
endpoint,
|
||||
body,
|
||||
query
|
||||
);
|
||||
query.page_number++;
|
||||
returnData.push.apply(returnData, responseData[propertyName]);
|
||||
// zoom free plan rate limit is 1 request/second
|
||||
// TODO just wait when the plan is free
|
||||
await wait();
|
||||
} while (
|
||||
responseData.page_count !== responseData.page_number
|
||||
);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
function wait() {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve(true);
|
||||
}, 1000);
|
||||
});
|
||||
}
|
751
packages/nodes-base/nodes/Zoom/MeetingDescription.ts
Normal file
751
packages/nodes-base/nodes/Zoom/MeetingDescription.ts
Normal file
|
@ -0,0 +1,751 @@
|
|||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export const meetingOperations = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'meeting',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a meeting',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a meeting',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Retrieve a meeting',
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Retrieve all meetings',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a meeting',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
] as INodeProperties[];
|
||||
|
||||
export const meetingFields = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* meeting:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Topic',
|
||||
name: 'topic',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
|
||||
],
|
||||
resource: [
|
||||
'meeting',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: `Topic of the meeting.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
|
||||
],
|
||||
resource: [
|
||||
'meeting',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Agenda',
|
||||
name: 'agenda',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
default: '',
|
||||
description: 'Meeting agenda.',
|
||||
},
|
||||
{
|
||||
displayName: 'Duration',
|
||||
name: 'duration',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
default: 0,
|
||||
description: 'Meeting duration (minutes).',
|
||||
},
|
||||
{
|
||||
displayName: 'Password',
|
||||
name: 'password',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Password to join the meeting with maximum 10 characters.',
|
||||
},
|
||||
{
|
||||
displayName: 'Schedule For',
|
||||
name: 'scheduleFor',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Schedule meeting for someone else from your account, provide their email ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Settings',
|
||||
name: 'settings',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Setting',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Audio',
|
||||
name: 'audio',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Both Telephony and VoiP',
|
||||
value: 'both',
|
||||
},
|
||||
{
|
||||
name: 'Telephony',
|
||||
value: 'telephony',
|
||||
},
|
||||
{
|
||||
name: 'VOIP',
|
||||
value: 'voip',
|
||||
},
|
||||
|
||||
],
|
||||
default: 'both',
|
||||
description: 'Determine how participants can join audio portion of the meeting.',
|
||||
},
|
||||
{
|
||||
displayName: 'Alternative Hosts',
|
||||
name: 'alternativeHosts',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Alternative hosts email IDs.',
|
||||
},
|
||||
{
|
||||
displayName: 'Auto Recording',
|
||||
name: 'autoRecording',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Record on Local',
|
||||
value: 'local',
|
||||
},
|
||||
{
|
||||
name: 'Record on Cloud',
|
||||
value: 'cloud',
|
||||
},
|
||||
{
|
||||
name: 'Disabled',
|
||||
value: 'none',
|
||||
},
|
||||
],
|
||||
default: 'none',
|
||||
description: 'Auto recording.',
|
||||
},
|
||||
{
|
||||
displayName: 'Host Meeting in China',
|
||||
name: 'cnMeeting',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Host Meeting in China.',
|
||||
},
|
||||
{
|
||||
displayName: 'Host Meeting in India',
|
||||
name: 'inMeeting',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Host Meeting in India.',
|
||||
},
|
||||
{
|
||||
displayName: 'Host Video',
|
||||
name: 'hostVideo',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Start video when host joins the meeting.',
|
||||
},
|
||||
{
|
||||
displayName: 'Join Before Host',
|
||||
name: 'joinBeforeHost',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Allow participants to join the meeting before host starts it.',
|
||||
},
|
||||
{
|
||||
displayName: 'Muting Upon Entry',
|
||||
name: 'muteUponEntry',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Mute participants upon entry.',
|
||||
},
|
||||
{
|
||||
displayName: 'Participant Video',
|
||||
name: 'participantVideo',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Start video when participant joins the meeting.',
|
||||
},
|
||||
{
|
||||
displayName: 'Registration Type',
|
||||
name: 'registrationType',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Attendees register once and can attend any of the occurences',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Attendees need to register for every occurrence',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'Attendees register once and can choose one or more occurrences to attend',
|
||||
value: 3,
|
||||
},
|
||||
],
|
||||
default: 1,
|
||||
description: 'Registration type. Used for recurring meetings with fixed time only',
|
||||
},
|
||||
{
|
||||
displayName: 'Watermark',
|
||||
name: 'watermark',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Adds watermark when viewing a shared screen.',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Start Time',
|
||||
name: 'startTime',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'Start time should be used only for scheduled or recurring meetings with fixed time',
|
||||
},
|
||||
{
|
||||
displayName: 'Timezone',
|
||||
name: 'timeZone',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getTimezones',
|
||||
},
|
||||
default: '',
|
||||
description: `Time zone used in the response. The default is the time zone of the calendar.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Instant Meeting',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Scheduled Meeting',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'Recurring Meeting with no fixed time',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
name: 'Recurring Meeting with fixed time',
|
||||
value: 8,
|
||||
},
|
||||
|
||||
],
|
||||
default: 2,
|
||||
description: 'Meeting type.',
|
||||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* meeting:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'ID',
|
||||
name: 'meetingId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'meeting',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'Meeting ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
|
||||
],
|
||||
resource: [
|
||||
'meeting',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Occurrence ID',
|
||||
name: 'occurrenceId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'To view meeting details of a particular occurrence of the recurring meeting.',
|
||||
},
|
||||
{
|
||||
displayName: 'Show Previous Occurrences',
|
||||
name: 'showPreviousOccurrences',
|
||||
type: 'boolean',
|
||||
default: '',
|
||||
description: 'To view meeting details of all previous occurrences of the recurring meeting.',
|
||||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* meeting:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'meeting',
|
||||
],
|
||||
},
|
||||
},
|
||||
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: [
|
||||
'meeting',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 300,
|
||||
},
|
||||
default: 30,
|
||||
description: 'How many results to return.',
|
||||
},
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
|
||||
],
|
||||
resource: [
|
||||
'meeting',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Scheduled',
|
||||
value: 'scheduled',
|
||||
description: 'This includes all valid past meetings, live meetings and upcoming scheduled meetings'
|
||||
},
|
||||
{
|
||||
name: 'Live',
|
||||
value: 'live',
|
||||
description: 'All ongoing meetings',
|
||||
},
|
||||
{
|
||||
name: 'Upcoming',
|
||||
value: 'upcoming',
|
||||
description: 'All upcoming meetings including live meetings',
|
||||
},
|
||||
],
|
||||
default: 'live',
|
||||
description: `Meeting type.`,
|
||||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* meeting:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'ID',
|
||||
name: 'meetingId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: [
|
||||
'meeting',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'Meeting ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: [
|
||||
'meeting',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Occurence ID',
|
||||
name: 'occurrenceId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Meeting occurrence ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Schedule Reminder',
|
||||
name: 'scheduleForReminder',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Notify hosts and alternative hosts about meeting cancellation via email',
|
||||
},
|
||||
],
|
||||
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* meeting:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'ID',
|
||||
name: 'meetingId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'meeting',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'Meeting ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'meeting',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Agenda',
|
||||
name: 'agenda',
|
||||
type: 'string',
|
||||
typeOptions: {
|
||||
alwaysOpenEditWindow: true,
|
||||
},
|
||||
default: '',
|
||||
description: 'Meeting agenda.',
|
||||
},
|
||||
{
|
||||
displayName: 'Duration',
|
||||
name: 'duration',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 0,
|
||||
},
|
||||
default: 0,
|
||||
description: 'Meeting duration (minutes).',
|
||||
},
|
||||
{
|
||||
displayName: 'Password',
|
||||
name: 'password',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Password to join the meeting with maximum 10 characters.',
|
||||
},
|
||||
{
|
||||
displayName: 'Schedule For',
|
||||
name: 'scheduleFor',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Schedule meeting for someone else from your account, provide their email ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Settings',
|
||||
name: 'settings',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Setting',
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Audio',
|
||||
name: 'audio',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Both Telephony and VoiP',
|
||||
value: 'both',
|
||||
},
|
||||
{
|
||||
name: 'Telephony',
|
||||
value: 'telephony',
|
||||
},
|
||||
{
|
||||
name: 'VOIP',
|
||||
value: 'voip',
|
||||
},
|
||||
|
||||
],
|
||||
default: 'both',
|
||||
description: 'Determine how participants can join audio portion of the meeting.',
|
||||
},
|
||||
{
|
||||
displayName: 'Alternative Hosts',
|
||||
name: 'alternativeHosts',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Alternative hosts email IDs.',
|
||||
},
|
||||
{
|
||||
displayName: 'Auto Recording',
|
||||
name: 'autoRecording',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Record on Local',
|
||||
value: 'local',
|
||||
},
|
||||
{
|
||||
name: 'Record on Cloud',
|
||||
value: 'cloud',
|
||||
},
|
||||
{
|
||||
name: 'Disabled',
|
||||
value: 'none',
|
||||
},
|
||||
],
|
||||
default: 'none',
|
||||
description: 'Auto recording.',
|
||||
},
|
||||
{
|
||||
displayName: 'Host Meeting in China',
|
||||
name: 'cnMeeting',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Host Meeting in China.',
|
||||
},
|
||||
{
|
||||
displayName: 'Host Meeting in India',
|
||||
name: 'inMeeting',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Host Meeting in India.',
|
||||
},
|
||||
{
|
||||
displayName: 'Host Video',
|
||||
name: 'hostVideo',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Start video when host joins the meeting.',
|
||||
},
|
||||
{
|
||||
displayName: 'Join Before Host',
|
||||
name: 'joinBeforeHost',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Allow participants to join the meeting before host starts it.',
|
||||
},
|
||||
{
|
||||
displayName: 'Muting Upon Entry',
|
||||
name: 'muteUponEntry',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Mute participants upon entry.',
|
||||
},
|
||||
{
|
||||
displayName: 'Participant Video',
|
||||
name: 'participantVideo',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Start video when participant joins the meeting.',
|
||||
},
|
||||
{
|
||||
displayName: 'Registration Type',
|
||||
name: 'registrationType',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Attendees register once and can attend any of the occurences',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Attendees need to register for every occurrence',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'Attendees register once and can choose one or more occurrences to attend',
|
||||
value: 3,
|
||||
},
|
||||
],
|
||||
default: 1,
|
||||
description: 'Registration type. Used for recurring meetings with fixed time only',
|
||||
},
|
||||
{
|
||||
displayName: 'Watermark',
|
||||
name: 'watermark',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Adds watermark when viewing a shared screen.',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Start Time',
|
||||
name: 'startTime',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'Start time should be used only for scheduled or recurring meetings with fixed time',
|
||||
},
|
||||
{
|
||||
displayName: 'Timezone',
|
||||
name: 'timeZone',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getTimezones',
|
||||
},
|
||||
default: '',
|
||||
description: `Time zone used in the response. The default is the time zone of the calendar.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Topic',
|
||||
name: 'topic',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: `Meeting topic.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Instant Meeting',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Scheduled Meeting',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'Recurring Meeting with no fixed time',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
name: 'Recurring Meeting with fixed time',
|
||||
value: 8,
|
||||
},
|
||||
|
||||
],
|
||||
default: 2,
|
||||
description: 'Meeting type.',
|
||||
},
|
||||
],
|
||||
},
|
||||
] as INodeProperties[];
|
443
packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts
Normal file
443
packages/nodes-base/nodes/Zoom/MeetingRegistrantDescription.ts
Normal file
|
@ -0,0 +1,443 @@
|
|||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export const meetingRegistrantOperations = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'meetingRegistrant',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create Meeting Registrants',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update Meeting Registrant Status',
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Retrieve all Meeting Registrants',
|
||||
},
|
||||
|
||||
],
|
||||
default: 'create',
|
||||
description: 'The operation to perform.',
|
||||
}
|
||||
] as INodeProperties[];
|
||||
|
||||
export const meetingRegistrantFields = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* meetingRegistrant:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Meeting Id',
|
||||
name: 'meetingId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'meetingRegistrant',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'Meeting ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Email',
|
||||
name: 'email',
|
||||
type: 'string',
|
||||
required: true,
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'meetingRegistrant',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'Valid Email-ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'First Name',
|
||||
name: 'firstName',
|
||||
required: true,
|
||||
type: 'string',
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'meetingRegistrant',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'First Name.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
|
||||
],
|
||||
resource: [
|
||||
'meetingRegistrant',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Address',
|
||||
name: 'address',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Valid address of registrant.',
|
||||
},
|
||||
{
|
||||
displayName: 'City',
|
||||
name: 'city',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Valid city of registrant.',
|
||||
},
|
||||
{
|
||||
displayName: 'Comments',
|
||||
name: 'comments',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Allows registrants to provide any questions they have.',
|
||||
},
|
||||
{
|
||||
displayName: 'Country',
|
||||
name: 'country',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Valid country of registrant.',
|
||||
},
|
||||
{
|
||||
displayName: 'Job Title',
|
||||
name: 'jobTitle',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Job title of registrant.',
|
||||
},
|
||||
{
|
||||
displayName: 'Last Name',
|
||||
name: 'lastName',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Last Name.',
|
||||
},
|
||||
{
|
||||
displayName: 'Occurrence IDs',
|
||||
name: 'occurrenceId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Occurrence IDs separated by comma.',
|
||||
},
|
||||
{
|
||||
displayName: 'Organization',
|
||||
name: 'org',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Organization of registrant.',
|
||||
},
|
||||
{
|
||||
displayName: 'Phone Number',
|
||||
name: 'phone',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Valid phone number of registrant.',
|
||||
},
|
||||
{
|
||||
displayName: 'Purchasing Time Frame',
|
||||
name: 'purchasingTimeFrame',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Within a month',
|
||||
value: 'Within a month',
|
||||
},
|
||||
{
|
||||
name: '1-3 months',
|
||||
value: '1-3 months',
|
||||
},
|
||||
{
|
||||
name: '4-6 months',
|
||||
value: '4-6 months',
|
||||
},
|
||||
{
|
||||
name: 'More than 6 months',
|
||||
value: 'More than 6 months',
|
||||
},
|
||||
{
|
||||
name: 'No timeframe',
|
||||
value: 'No timeframe',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
description: 'Meeting type.',
|
||||
},
|
||||
{
|
||||
displayName: 'Role in Purchase Process',
|
||||
name: 'roleInPurchaseProcess',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Decision Maker',
|
||||
value: 'Decision Maker',
|
||||
},
|
||||
{
|
||||
name: 'Evaluator/Recommender',
|
||||
value: 'Evaluator/Recommender',
|
||||
},
|
||||
{
|
||||
name: 'Influener',
|
||||
value: 'Influener',
|
||||
},
|
||||
{
|
||||
name: 'Not Involved',
|
||||
value: 'Not Involved',
|
||||
},
|
||||
|
||||
],
|
||||
default: '',
|
||||
description: 'Role in purchase process.',
|
||||
},
|
||||
{
|
||||
displayName: 'State',
|
||||
name: 'state',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Valid state of registrant.',
|
||||
},
|
||||
{
|
||||
displayName: 'Zip Code',
|
||||
name: 'zip',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Valid zip-code of registrant.',
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* meetingRegistrant:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Meeting ID',
|
||||
name: 'meetingId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'meetingRegistrant',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'Meeting ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'meetingRegistrant',
|
||||
],
|
||||
},
|
||||
},
|
||||
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: [
|
||||
'meetingRegistrant',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 300,
|
||||
},
|
||||
default: 30,
|
||||
description: 'How many results to return.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
|
||||
],
|
||||
resource: [
|
||||
'meetingRegistrant',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Occurrence ID',
|
||||
name: 'occurrenceId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: `Occurrence ID.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Status',
|
||||
name: 'status',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Pending',
|
||||
value: 'pending',
|
||||
},
|
||||
{
|
||||
name: 'Approved',
|
||||
value: 'approved',
|
||||
},
|
||||
{
|
||||
name: 'Denied',
|
||||
value: 'denied',
|
||||
},
|
||||
],
|
||||
default: 'approved',
|
||||
description: `Registrant Status.`,
|
||||
},
|
||||
|
||||
]
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* meetingRegistrant:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Meeting ID',
|
||||
name: 'meetingId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'meetingRegistrant',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'Meeting ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Action',
|
||||
name: 'action',
|
||||
type: 'options',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'meetingRegistrant',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Cancel',
|
||||
value: 'cancel',
|
||||
},
|
||||
{
|
||||
name: 'Approved',
|
||||
value: 'approve',
|
||||
},
|
||||
{
|
||||
name: 'Deny',
|
||||
value: 'deny',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
description: `Registrant Status.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'meetingRegistrant',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Occurrence ID',
|
||||
name: 'occurrenceId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Occurrence ID.',
|
||||
},
|
||||
|
||||
],
|
||||
}
|
||||
|
||||
] as INodeProperties[];
|
665
packages/nodes-base/nodes/Zoom/WebinarDescription.ts
Normal file
665
packages/nodes-base/nodes/Zoom/WebinarDescription.ts
Normal file
|
@ -0,0 +1,665 @@
|
|||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export const webinarOperations = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'webinar',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create a webinar',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete a webinar',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Retrieve a webinar',
|
||||
},
|
||||
{
|
||||
name: 'Get All',
|
||||
value: 'getAll',
|
||||
description: 'Retrieve all webinars',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update a webinar',
|
||||
}
|
||||
],
|
||||
default: 'create',
|
||||
description: 'The operation to perform.',
|
||||
}
|
||||
] as INodeProperties[];
|
||||
|
||||
export const webinarFields = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* webinar:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'webinar',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'User ID or email ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
|
||||
],
|
||||
resource: [
|
||||
'webinar',
|
||||
],
|
||||
}
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Agenda',
|
||||
name: 'agenda',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Webinar agenda.',
|
||||
},
|
||||
{
|
||||
displayName: 'Alternative Hosts',
|
||||
name: 'alternativeHosts',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Alternative hosts email IDs.',
|
||||
},
|
||||
{
|
||||
displayName: 'Approval Type',
|
||||
name: 'approvalType',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Automatically Approve',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
name: 'Manually Approve',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'No Registration Required',
|
||||
value: 2,
|
||||
},
|
||||
],
|
||||
default: 2,
|
||||
description: 'Approval type.',
|
||||
},
|
||||
{
|
||||
displayName: 'Audio',
|
||||
name: 'audio',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Both Telephony and VoiP',
|
||||
value: 'both',
|
||||
},
|
||||
{
|
||||
name: 'Telephony',
|
||||
value: 'telephony',
|
||||
},
|
||||
{
|
||||
name: 'VOIP',
|
||||
value: 'voip',
|
||||
},
|
||||
|
||||
],
|
||||
default: 'both',
|
||||
description: 'Determine how participants can join audio portion of the webinar.',
|
||||
},
|
||||
{
|
||||
displayName: 'Auto Recording',
|
||||
name: 'autoRecording',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Record on Local',
|
||||
value: 'local',
|
||||
},
|
||||
{
|
||||
name: 'Record on Cloud',
|
||||
value: 'cloud',
|
||||
},
|
||||
{
|
||||
name: 'Disabled',
|
||||
value: 'none',
|
||||
},
|
||||
],
|
||||
default: 'none',
|
||||
description: 'Auto recording.',
|
||||
},
|
||||
{
|
||||
displayName: 'Duration',
|
||||
name: 'duration',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Duration.',
|
||||
},
|
||||
{
|
||||
displayName: 'Host Video',
|
||||
name: 'hostVideo',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Start video when host joins the webinar.',
|
||||
},
|
||||
{
|
||||
displayName: 'Panelists Video',
|
||||
name: 'panelistsVideo',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Start video when panelists joins the webinar.',
|
||||
},
|
||||
{
|
||||
displayName: 'Password',
|
||||
name: 'password',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Password to join the webinar with maximum 10 characters.',
|
||||
},
|
||||
{
|
||||
displayName: 'Practice Session',
|
||||
name: 'practiceSession',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Enable Practice session.',
|
||||
},
|
||||
{
|
||||
displayName: 'Registration Type',
|
||||
name: 'registrationType',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Attendees register once and can attend any of the occurences',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Attendees need to register for every occurrence',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'Attendees register once and can choose one or more occurrences to attend',
|
||||
value: 3,
|
||||
},
|
||||
],
|
||||
default: 1,
|
||||
description: 'Registration type. Used for recurring webinar with fixed time only',
|
||||
},
|
||||
{
|
||||
displayName: 'Start Time',
|
||||
name: 'startTime',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'Start time should be used only for scheduled or recurring webinar with fixed time',
|
||||
},
|
||||
{
|
||||
displayName: 'Timezone',
|
||||
name: 'timeZone',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getTimezones',
|
||||
},
|
||||
default: '',
|
||||
description: `Time zone used in the response. The default is the time zone of the calendar.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Webinar Topic',
|
||||
name: 'topic',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: `Webinar topic.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Webinar Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Webinar',
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
name: 'Recurring webinar with no fixed time',
|
||||
value: 6,
|
||||
},
|
||||
{
|
||||
name: 'Recurring webinar with fixed time',
|
||||
value: 9,
|
||||
},
|
||||
],
|
||||
default: 5,
|
||||
description: 'Webinar type.',
|
||||
},
|
||||
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* webinar:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Webinar ID',
|
||||
name: 'webinarId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'webinar',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'Webinar ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
|
||||
],
|
||||
resource: [
|
||||
'webinar',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Occurence ID',
|
||||
name: 'occurenceId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'To view webinar details of a particular occurrence of the recurring webinar.',
|
||||
},
|
||||
{
|
||||
displayName: 'Show Previous Occurrences',
|
||||
name: 'showPreviousOccurrences',
|
||||
type: 'boolean',
|
||||
default: '',
|
||||
description: 'To view webinar details of all previous occurrences of the recurring webinar.',
|
||||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* webinar:getAll */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'webinar',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'User ID or email-ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'webinar',
|
||||
],
|
||||
},
|
||||
},
|
||||
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: [
|
||||
'webinar',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
maxValue: 300,
|
||||
},
|
||||
default: 30,
|
||||
description: 'How many results to return.',
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* webinar:delete */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Webinar ID',
|
||||
name: 'webinarId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: [
|
||||
'webinarId',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'Webinar ID.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: [
|
||||
'webinar',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Occurrence ID',
|
||||
name: 'occurrenceId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Webinar occurrence ID.',
|
||||
},
|
||||
|
||||
],
|
||||
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* webinar:update */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'Webinar ID',
|
||||
name: 'webinarId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'webinar',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'User ID or email address of user.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
|
||||
],
|
||||
resource: [
|
||||
'webinar',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Agenda',
|
||||
name: 'agenda',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Webinar agenda.',
|
||||
},
|
||||
{
|
||||
displayName: 'Alternative Hosts',
|
||||
name: 'alternativeHosts',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Alternative hosts email IDs.',
|
||||
},
|
||||
{
|
||||
displayName: 'Approval Type',
|
||||
name: 'approvalType',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Automatically Approve',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
name: 'Manually Approve',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'No Registration Required',
|
||||
value: 2,
|
||||
},
|
||||
],
|
||||
default: 2,
|
||||
description: 'Approval type.',
|
||||
},
|
||||
{
|
||||
displayName: 'Auto Recording',
|
||||
name: 'autoRecording',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Record on Local',
|
||||
value: 'local',
|
||||
},
|
||||
{
|
||||
name: 'Record on Cloud',
|
||||
value: 'cloud',
|
||||
},
|
||||
{
|
||||
name: 'Disabled',
|
||||
value: 'none',
|
||||
},
|
||||
],
|
||||
default: 'none',
|
||||
description: 'Auto recording.',
|
||||
},
|
||||
{
|
||||
displayName: 'Audio',
|
||||
name: 'audio',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Both Telephony and VoiP',
|
||||
value: 'both',
|
||||
},
|
||||
{
|
||||
name: 'Telephony',
|
||||
value: 'telephony',
|
||||
},
|
||||
{
|
||||
name: 'VOIP',
|
||||
value: 'voip',
|
||||
},
|
||||
|
||||
],
|
||||
default: 'both',
|
||||
description: 'Determine how participants can join audio portion of the webinar.',
|
||||
},
|
||||
{
|
||||
displayName: 'Duration',
|
||||
name: 'duration',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Duration.',
|
||||
},
|
||||
{
|
||||
displayName: 'Host Video',
|
||||
name: 'hostVideo',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Start video when host joins the webinar.',
|
||||
},
|
||||
{
|
||||
displayName: 'Occurrence ID',
|
||||
name: 'occurrenceId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: `Webinar occurrence ID.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Password',
|
||||
name: 'password',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Password to join the webinar with maximum 10 characters.',
|
||||
},
|
||||
{
|
||||
displayName: 'Panelists Video',
|
||||
name: 'panelistsVideo',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Start video when panelists joins the webinar.',
|
||||
},
|
||||
{
|
||||
displayName: 'Practice Session',
|
||||
name: 'practiceSession',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
description: 'Enable Practice session.',
|
||||
},
|
||||
{
|
||||
displayName: 'Registration Type',
|
||||
name: 'registrationType',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Attendees register once and can attend any of the occurrences',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
name: 'Attendees need to register for every occurrence',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
name: 'Attendees register once and can choose one or more occurrences to attend',
|
||||
value: 3,
|
||||
},
|
||||
],
|
||||
default: 1,
|
||||
description: 'Registration type. Used for recurring webinars with fixed time only.',
|
||||
},
|
||||
{
|
||||
displayName: 'Start Time',
|
||||
name: 'startTime',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
description: 'Start time should be used only for scheduled or recurring webinar with fixed time.',
|
||||
},
|
||||
{
|
||||
displayName: 'Timezone',
|
||||
name: 'timeZone',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getTimezones',
|
||||
},
|
||||
default: '',
|
||||
description: `Time zone used in the response. The default is the time zone of the calendar.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Webinar Topic',
|
||||
name: 'topic',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: `Webinar topic.`,
|
||||
},
|
||||
{
|
||||
displayName: 'Webinar Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Webinar',
|
||||
value: 5,
|
||||
},
|
||||
{
|
||||
name: 'Recurring webinar with no fixed time',
|
||||
value: 6,
|
||||
},
|
||||
{
|
||||
name: 'Recurring webinar with fixed time',
|
||||
value: 9,
|
||||
},
|
||||
],
|
||||
default: 5,
|
||||
description: 'Webinar type.'
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
] as INodeProperties[];
|
821
packages/nodes-base/nodes/Zoom/Zoom.node.ts
Normal file
821
packages/nodes-base/nodes/Zoom/Zoom.node.ts
Normal file
|
@ -0,0 +1,821 @@
|
|||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
INodeExecutionData,
|
||||
INodePropertyOptions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
zoomApiRequest,
|
||||
zoomApiRequestAllItems,
|
||||
} from './GenericFunctions';
|
||||
|
||||
import {
|
||||
meetingOperations,
|
||||
meetingFields,
|
||||
} from './MeetingDescription';
|
||||
|
||||
// import {
|
||||
// meetingRegistrantOperations,
|
||||
// meetingRegistrantFields,
|
||||
// } from './MeetingRegistrantDescription';
|
||||
|
||||
// import {
|
||||
// webinarOperations,
|
||||
// webinarFields,
|
||||
// } from './WebinarDescription';
|
||||
|
||||
import * as moment from 'moment-timezone';
|
||||
|
||||
interface Settings {
|
||||
host_video?: boolean;
|
||||
participant_video?: boolean;
|
||||
panelists_video?: boolean;
|
||||
cn_meeting?: boolean;
|
||||
in_meeting?: boolean;
|
||||
join_before_host?: boolean;
|
||||
mute_upon_entry?: boolean;
|
||||
watermark?: boolean;
|
||||
waiting_room?: boolean;
|
||||
audio?: string;
|
||||
alternative_hosts?: string;
|
||||
auto_recording?: string;
|
||||
registration_type?: number;
|
||||
approval_type?: number;
|
||||
practice_session?: boolean;
|
||||
}
|
||||
|
||||
export class Zoom implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Zoom',
|
||||
name: 'zoom',
|
||||
group: ['input'],
|
||||
version: 1,
|
||||
description: 'Consume Zoom API',
|
||||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
||||
defaults: {
|
||||
name: 'Zoom',
|
||||
color: '#0B6CF9'
|
||||
},
|
||||
icon: 'file:zoom.png',
|
||||
inputs: ['main'],
|
||||
outputs: ['main'],
|
||||
credentials: [
|
||||
{
|
||||
// create a JWT app on Zoom Marketplace
|
||||
//https://marketplace.zoom.us/develop/create
|
||||
//get the JWT token as access token
|
||||
name: 'zoomApi',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'accessToken',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
//create a account level OAuth app
|
||||
//https://marketplace.zoom.us/develop/create
|
||||
name: 'zoomOAuth2Api',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
authentication: [
|
||||
'oAuth2',
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Authentication',
|
||||
name: 'authentication',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Access Token',
|
||||
value: 'accessToken',
|
||||
},
|
||||
{
|
||||
name: 'OAuth2',
|
||||
value: 'oAuth2',
|
||||
},
|
||||
],
|
||||
default: 'accessToken',
|
||||
description: 'The resource to operate on.',
|
||||
},
|
||||
{
|
||||
displayName: 'Resource',
|
||||
name: 'resource',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Meeting',
|
||||
value: 'meeting'
|
||||
},
|
||||
// {
|
||||
// name: 'Meeting Registrant',
|
||||
// value: 'meetingRegistrant'
|
||||
// },
|
||||
// {
|
||||
// name: 'Webinar',
|
||||
// value: 'webinar'
|
||||
// }
|
||||
],
|
||||
default: 'meeting',
|
||||
description: 'The resource to operate on.'
|
||||
},
|
||||
//MEETINGS
|
||||
...meetingOperations,
|
||||
...meetingFields,
|
||||
|
||||
// //MEETING REGISTRANTS
|
||||
// ...meetingRegistrantOperations,
|
||||
// ...meetingRegistrantFields,
|
||||
|
||||
// //WEBINARS
|
||||
// ...webinarOperations,
|
||||
// ...webinarFields,
|
||||
]
|
||||
|
||||
};
|
||||
methods = {
|
||||
loadOptions: {
|
||||
// Get all the timezones to display them to user so that he can select them easily
|
||||
async getTimezones(
|
||||
this: ILoadOptionsFunctions
|
||||
): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
for (const timezone of moment.tz.names()) {
|
||||
const timezoneName = timezone;
|
||||
const timezoneId = timezone;
|
||||
returnData.push({
|
||||
name: timezoneName,
|
||||
value: timezoneId
|
||||
});
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
const returnData: IDataObject[] = [];
|
||||
let qs: IDataObject = {};
|
||||
let responseData;
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
qs = {};
|
||||
//https://marketplace.zoom.us/docs/api-reference/zoom-api/
|
||||
if (resource === 'meeting') {
|
||||
|
||||
if (operation === 'get') {
|
||||
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meeting
|
||||
const meetingId = this.getNodeParameter('meetingId', i) as string;
|
||||
const additionalFields = this.getNodeParameter(
|
||||
'additionalFields',
|
||||
i
|
||||
) as IDataObject;
|
||||
|
||||
if (additionalFields.showPreviousOccurrences) {
|
||||
qs.show_previous_occurrences = additionalFields.showPreviousOccurrences as boolean;
|
||||
}
|
||||
|
||||
if (additionalFields.occurrenceId) {
|
||||
qs.occurrence_id = additionalFields.occurrenceId as string;
|
||||
}
|
||||
|
||||
responseData = await zoomApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/meetings/${meetingId}`,
|
||||
{},
|
||||
qs
|
||||
);
|
||||
}
|
||||
if (operation === 'getAll') {
|
||||
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetings
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
const filters = this.getNodeParameter(
|
||||
'filters',
|
||||
i
|
||||
) as IDataObject;
|
||||
if (filters.type) {
|
||||
qs.type = filters.type as string;
|
||||
}
|
||||
|
||||
if (returnAll) {
|
||||
responseData = await zoomApiRequestAllItems.call(this, 'meetings', 'GET', '/users/me/meetings', {}, qs);
|
||||
} else {
|
||||
qs.page_size = this.getNodeParameter('limit', i) as number;
|
||||
responseData = await zoomApiRequest.call(this, 'GET', '/users/me/meetings', {}, qs);
|
||||
responseData = responseData.meetings;
|
||||
}
|
||||
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingdelete
|
||||
const meetingId = this.getNodeParameter('meetingId', i) as string;
|
||||
const additionalFields = this.getNodeParameter(
|
||||
'additionalFields',
|
||||
i
|
||||
) as IDataObject;
|
||||
if (additionalFields.scheduleForReminder) {
|
||||
qs.schedule_for_reminder = additionalFields.scheduleForReminder as boolean;
|
||||
}
|
||||
|
||||
if (additionalFields.occurrenceId) {
|
||||
qs.occurrence_id = additionalFields.occurrenceId;
|
||||
}
|
||||
|
||||
responseData = await zoomApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`/meetings/${meetingId}`,
|
||||
{},
|
||||
qs
|
||||
);
|
||||
responseData = { success: true };
|
||||
}
|
||||
if (operation === 'create') {
|
||||
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingcreate
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
|
||||
const body: IDataObject = {};
|
||||
|
||||
if (additionalFields.settings) {
|
||||
const settingValues: Settings = {};
|
||||
const settings = additionalFields.settings as IDataObject;
|
||||
|
||||
if (settings.cnMeeting) {
|
||||
settingValues.cn_meeting = settings.cnMeeting as boolean;
|
||||
}
|
||||
|
||||
if (settings.inMeeting) {
|
||||
settingValues.in_meeting = settings.inMeeting as boolean;
|
||||
}
|
||||
|
||||
if (settings.joinBeforeHost) {
|
||||
settingValues.join_before_host = settings.joinBeforeHost as boolean;
|
||||
}
|
||||
|
||||
if (settings.muteUponEntry) {
|
||||
settingValues.mute_upon_entry = settings.muteUponEntry as boolean;
|
||||
}
|
||||
|
||||
if (settings.watermark) {
|
||||
settingValues.watermark = settings.watermark as boolean;
|
||||
}
|
||||
|
||||
if (settings.audio) {
|
||||
settingValues.audio = settings.audio as string;
|
||||
}
|
||||
|
||||
if (settings.alternativeHosts) {
|
||||
settingValues.alternative_hosts = settings.alternativeHosts as string;
|
||||
}
|
||||
|
||||
if (settings.participantVideo) {
|
||||
settingValues.participant_video = settings.participantVideo as boolean;
|
||||
}
|
||||
|
||||
if (settings.hostVideo) {
|
||||
settingValues.host_video = settings.hostVideo as boolean;
|
||||
}
|
||||
|
||||
if (settings.autoRecording) {
|
||||
settingValues.auto_recording = settings.autoRecording as string;
|
||||
}
|
||||
|
||||
if (settings.registrationType) {
|
||||
settingValues.registration_type = settings.registrationType as number;
|
||||
}
|
||||
|
||||
body.settings = settingValues;
|
||||
}
|
||||
|
||||
body.topic = this.getNodeParameter('topic', i) as string;
|
||||
|
||||
if (additionalFields.type) {
|
||||
body.type = additionalFields.type as string;
|
||||
}
|
||||
|
||||
if (additionalFields.startTime) {
|
||||
if (additionalFields.timeZone) {
|
||||
body.start_time = moment(additionalFields.startTime as string).format('YYYY-MM-DDTHH:mm:ss');
|
||||
} else {
|
||||
// if none timezone it's defined used n8n timezone
|
||||
body.start_time = moment.tz(additionalFields.startTime as string, this.getTimezone()).format();
|
||||
}
|
||||
}
|
||||
|
||||
if (additionalFields.duration) {
|
||||
body.duration = additionalFields.duration as number;
|
||||
}
|
||||
|
||||
if (additionalFields.scheduleFor) {
|
||||
body.schedule_for = additionalFields.scheduleFor as string;
|
||||
}
|
||||
|
||||
if (additionalFields.timeZone) {
|
||||
body.timezone = additionalFields.timeZone as string;
|
||||
}
|
||||
|
||||
if (additionalFields.password) {
|
||||
body.password = additionalFields.password as string;
|
||||
}
|
||||
|
||||
if (additionalFields.agenda) {
|
||||
body.agenda = additionalFields.agenda as string;
|
||||
}
|
||||
|
||||
responseData = await zoomApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/users/me/meetings`,
|
||||
body,
|
||||
qs
|
||||
);
|
||||
}
|
||||
if (operation === 'update') {
|
||||
//https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingupdate
|
||||
const meetingId = this.getNodeParameter('meetingId', i) as string;
|
||||
const updateFields = this.getNodeParameter(
|
||||
'updateFields',
|
||||
i
|
||||
) as IDataObject;
|
||||
|
||||
const body: IDataObject = {};
|
||||
|
||||
if (updateFields.settings) {
|
||||
const settingValues: Settings = {};
|
||||
const settings = updateFields.settings as IDataObject;
|
||||
|
||||
if (settings.cnMeeting) {
|
||||
settingValues.cn_meeting = settings.cnMeeting as boolean;
|
||||
}
|
||||
|
||||
if (settings.inMeeting) {
|
||||
settingValues.in_meeting = settings.inMeeting as boolean;
|
||||
}
|
||||
|
||||
if (settings.joinBeforeHost) {
|
||||
settingValues.join_before_host = settings.joinBeforeHost as boolean;
|
||||
}
|
||||
|
||||
if (settings.muteUponEntry) {
|
||||
settingValues.mute_upon_entry = settings.muteUponEntry as boolean;
|
||||
}
|
||||
|
||||
if (settings.watermark) {
|
||||
settingValues.watermark = settings.watermark as boolean;
|
||||
}
|
||||
|
||||
if (settings.audio) {
|
||||
settingValues.audio = settings.audio as string;
|
||||
}
|
||||
|
||||
if (settings.alternativeHosts) {
|
||||
settingValues.alternative_hosts = settings.alternativeHosts as string;
|
||||
}
|
||||
|
||||
if (settings.participantVideo) {
|
||||
settingValues.participant_video = settings.participantVideo as boolean;
|
||||
}
|
||||
|
||||
if (settings.hostVideo) {
|
||||
settingValues.host_video = settings.hostVideo as boolean;
|
||||
}
|
||||
|
||||
if (settings.autoRecording) {
|
||||
settingValues.auto_recording = settings.autoRecording as string;
|
||||
}
|
||||
|
||||
if (settings.registrationType) {
|
||||
settingValues.registration_type = settings.registrationType as number;
|
||||
}
|
||||
|
||||
body.settings = settingValues;
|
||||
}
|
||||
|
||||
if (updateFields.topic) {
|
||||
body.topic = updateFields.topic as string;
|
||||
}
|
||||
|
||||
if (updateFields.type) {
|
||||
body.type = updateFields.type as string;
|
||||
}
|
||||
|
||||
if (updateFields.startTime) {
|
||||
body.start_time = updateFields.startTime as string;
|
||||
}
|
||||
|
||||
if (updateFields.duration) {
|
||||
body.duration = updateFields.duration as number;
|
||||
}
|
||||
|
||||
if (updateFields.scheduleFor) {
|
||||
body.schedule_for = updateFields.scheduleFor as string;
|
||||
}
|
||||
|
||||
if (updateFields.timeZone) {
|
||||
body.timezone = updateFields.timeZone as string;
|
||||
}
|
||||
|
||||
if (updateFields.password) {
|
||||
body.password = updateFields.password as string;
|
||||
}
|
||||
|
||||
if (updateFields.agenda) {
|
||||
body.agenda = updateFields.agenda as string;
|
||||
}
|
||||
|
||||
responseData = await zoomApiRequest.call(
|
||||
this,
|
||||
'PATCH',
|
||||
`/meetings/${meetingId}`,
|
||||
body,
|
||||
qs
|
||||
);
|
||||
|
||||
responseData = { success: true };
|
||||
|
||||
}
|
||||
}
|
||||
// if (resource === 'meetingRegistrant') {
|
||||
// if (operation === 'create') {
|
||||
// //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrantcreate
|
||||
// const meetingId = this.getNodeParameter('meetingId', i) as string;
|
||||
// const emailId = this.getNodeParameter('email', i) as string;
|
||||
// body.email = emailId;
|
||||
// const firstName = this.getNodeParameter('firstName', i) as string;
|
||||
// body.first_name = firstName;
|
||||
// const additionalFields = this.getNodeParameter(
|
||||
// 'additionalFields',
|
||||
// i
|
||||
// ) as IDataObject;
|
||||
// if (additionalFields.occurrenceId) {
|
||||
// qs.occurrence_ids = additionalFields.occurrenceId as string;
|
||||
// }
|
||||
// if (additionalFields.lastName) {
|
||||
// body.last_name = additionalFields.lastName as string;
|
||||
// }
|
||||
// if (additionalFields.address) {
|
||||
// body.address = additionalFields.address as string;
|
||||
// }
|
||||
// if (additionalFields.city) {
|
||||
// body.city = additionalFields.city as string;
|
||||
// }
|
||||
// if (additionalFields.state) {
|
||||
// body.state = additionalFields.state as string;
|
||||
// }
|
||||
// if (additionalFields.country) {
|
||||
// body.country = additionalFields.country as string;
|
||||
// }
|
||||
// if (additionalFields.zip) {
|
||||
// body.zip = additionalFields.zip as string;
|
||||
// }
|
||||
// if (additionalFields.phone) {
|
||||
// body.phone = additionalFields.phone as string;
|
||||
// }
|
||||
// if (additionalFields.comments) {
|
||||
// body.comments = additionalFields.comments as string;
|
||||
// }
|
||||
// if (additionalFields.org) {
|
||||
// body.org = additionalFields.org as string;
|
||||
// }
|
||||
// if (additionalFields.jobTitle) {
|
||||
// body.job_title = additionalFields.jobTitle as string;
|
||||
// }
|
||||
// if (additionalFields.purchasingTimeFrame) {
|
||||
// body.purchasing_time_frame = additionalFields.purchasingTimeFrame as string;
|
||||
// }
|
||||
// if (additionalFields.roleInPurchaseProcess) {
|
||||
// body.role_in_purchase_process = additionalFields.roleInPurchaseProcess as string;
|
||||
// }
|
||||
// responseData = await zoomApiRequest.call(
|
||||
// this,
|
||||
// 'POST',
|
||||
// `/meetings/${meetingId}/registrants`,
|
||||
// body,
|
||||
// qs
|
||||
// );
|
||||
// }
|
||||
// if (operation === 'getAll') {
|
||||
// //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrants
|
||||
// const meetingId = this.getNodeParameter('meetingId', i) as string;
|
||||
// const additionalFields = this.getNodeParameter(
|
||||
// 'additionalFields',
|
||||
// i
|
||||
// ) as IDataObject;
|
||||
// if (additionalFields.occurrenceId) {
|
||||
// qs.occurrence_id = additionalFields.occurrenceId as string;
|
||||
// }
|
||||
// if (additionalFields.status) {
|
||||
// qs.status = additionalFields.status as string;
|
||||
// }
|
||||
// const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
// if (returnAll) {
|
||||
// responseData = await zoomApiRequestAllItems.call(this, 'results', 'GET', `/meetings/${meetingId}/registrants`, {}, qs);
|
||||
// } else {
|
||||
// qs.page_size = this.getNodeParameter('limit', i) as number;
|
||||
// responseData = await zoomApiRequest.call(this, 'GET', `/meetings/${meetingId}/registrants`, {}, qs);
|
||||
|
||||
// }
|
||||
|
||||
// }
|
||||
// if (operation === 'update') {
|
||||
// //https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingregistrantstatus
|
||||
// const meetingId = this.getNodeParameter('meetingId', i) as string;
|
||||
// const additionalFields = this.getNodeParameter(
|
||||
// 'additionalFields',
|
||||
// i
|
||||
// ) as IDataObject;
|
||||
// if (additionalFields.occurenceId) {
|
||||
// qs.occurrence_id = additionalFields.occurrenceId as string;
|
||||
// }
|
||||
// if (additionalFields.action) {
|
||||
// body.action = additionalFields.action as string;
|
||||
// }
|
||||
// responseData = await zoomApiRequest.call(
|
||||
// this,
|
||||
// 'PUT',
|
||||
// `/meetings/${meetingId}/registrants/status`,
|
||||
// body,
|
||||
// qs
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// if (resource === 'webinar') {
|
||||
// if (operation === 'create') {
|
||||
// //https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinarcreate
|
||||
// const userId = this.getNodeParameter('userId', i) as string;
|
||||
// const additionalFields = this.getNodeParameter(
|
||||
// 'additionalFields',
|
||||
// i
|
||||
// ) as IDataObject;
|
||||
// const settings: Settings = {};
|
||||
|
||||
|
||||
// if (additionalFields.audio) {
|
||||
// settings.audio = additionalFields.audio as string;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.alternativeHosts) {
|
||||
// settings.alternative_hosts = additionalFields.alternativeHosts as string;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.panelistsVideo) {
|
||||
// settings.panelists_video = additionalFields.panelistsVideo as boolean;
|
||||
|
||||
// }
|
||||
// if (additionalFields.hostVideo) {
|
||||
// settings.host_video = additionalFields.hostVideo as boolean;
|
||||
|
||||
// }
|
||||
// if (additionalFields.practiceSession) {
|
||||
// settings.practice_session = additionalFields.practiceSession as boolean;
|
||||
|
||||
// }
|
||||
// if (additionalFields.autoRecording) {
|
||||
// settings.auto_recording = additionalFields.autoRecording as string;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.registrationType) {
|
||||
// settings.registration_type = additionalFields.registrationType as number;
|
||||
|
||||
// }
|
||||
// if (additionalFields.approvalType) {
|
||||
// settings.approval_type = additionalFields.approvalType as number;
|
||||
|
||||
// }
|
||||
|
||||
// body = {
|
||||
// settings,
|
||||
// };
|
||||
|
||||
// if (additionalFields.topic) {
|
||||
// body.topic = additionalFields.topic as string;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.type) {
|
||||
// body.type = additionalFields.type as string;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.startTime) {
|
||||
// body.start_time = additionalFields.startTime as string;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.duration) {
|
||||
// body.duration = additionalFields.duration as number;
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// if (additionalFields.timeZone) {
|
||||
// body.timezone = additionalFields.timeZone as string;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.password) {
|
||||
// body.password = additionalFields.password as string;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.agenda) {
|
||||
// body.agenda = additionalFields.agenda as string;
|
||||
|
||||
// }
|
||||
// responseData = await zoomApiRequest.call(
|
||||
// this,
|
||||
// 'POST',
|
||||
// `/users/${userId}/webinars`,
|
||||
// body,
|
||||
// qs
|
||||
// );
|
||||
// }
|
||||
// if (operation === 'get') {
|
||||
// //https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinar
|
||||
// const webinarId = this.getNodeParameter('webinarId', i) as string;
|
||||
|
||||
// const additionalFields = this.getNodeParameter(
|
||||
// 'additionalFields',
|
||||
// i
|
||||
// ) as IDataObject;
|
||||
// if (additionalFields.showPreviousOccurrences) {
|
||||
// qs.show_previous_occurrences = additionalFields.showPreviousOccurrences as boolean;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.occurrenceId) {
|
||||
// qs.occurrence_id = additionalFields.occurrenceId as string;
|
||||
|
||||
// }
|
||||
|
||||
// responseData = await zoomApiRequest.call(
|
||||
// this,
|
||||
// 'GET',
|
||||
// `/webinars/${webinarId}`,
|
||||
// {},
|
||||
// qs
|
||||
// );
|
||||
// }
|
||||
// if (operation === 'getAll') {
|
||||
// //https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinars
|
||||
// const userId = this.getNodeParameter('userId', i) as string;
|
||||
// const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
// if (returnAll) {
|
||||
// responseData = await zoomApiRequestAllItems.call(this, 'results', 'GET', `/users/${userId}/webinars`, {}, qs);
|
||||
// } else {
|
||||
// qs.page_size = this.getNodeParameter('limit', i) as number;
|
||||
// responseData = await zoomApiRequest.call(this, 'GET', `/users/${userId}/webinars`, {}, qs);
|
||||
|
||||
// }
|
||||
// }
|
||||
// if (operation === 'delete') {
|
||||
// //https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinardelete
|
||||
// const webinarId = this.getNodeParameter('webinarId', i) as string;
|
||||
// const additionalFields = this.getNodeParameter(
|
||||
// 'additionalFields',
|
||||
// i
|
||||
// ) as IDataObject;
|
||||
|
||||
|
||||
// if (additionalFields.occurrenceId) {
|
||||
// qs.occurrence_id = additionalFields.occurrenceId;
|
||||
|
||||
// }
|
||||
|
||||
// responseData = await zoomApiRequest.call(
|
||||
// this,
|
||||
// 'DELETE',
|
||||
// `/webinars/${webinarId}`,
|
||||
// {},
|
||||
// qs
|
||||
// );
|
||||
// responseData = { success: true };
|
||||
// }
|
||||
// if (operation === 'update') {
|
||||
// //https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinarupdate
|
||||
// const webinarId = this.getNodeParameter('webinarId', i) as string;
|
||||
// const additionalFields = this.getNodeParameter(
|
||||
// 'additionalFields',
|
||||
// i
|
||||
// ) as IDataObject;
|
||||
// if (additionalFields.occurrenceId) {
|
||||
// qs.occurrence_id = additionalFields.occurrenceId as string;
|
||||
|
||||
// }
|
||||
// const settings: Settings = {};
|
||||
// if (additionalFields.audio) {
|
||||
// settings.audio = additionalFields.audio as string;
|
||||
|
||||
// }
|
||||
// if (additionalFields.alternativeHosts) {
|
||||
// settings.alternative_hosts = additionalFields.alternativeHosts as string;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.panelistsVideo) {
|
||||
// settings.panelists_video = additionalFields.panelistsVideo as boolean;
|
||||
|
||||
// }
|
||||
// if (additionalFields.hostVideo) {
|
||||
// settings.host_video = additionalFields.hostVideo as boolean;
|
||||
|
||||
// }
|
||||
// if (additionalFields.practiceSession) {
|
||||
// settings.practice_session = additionalFields.practiceSession as boolean;
|
||||
|
||||
// }
|
||||
// if (additionalFields.autoRecording) {
|
||||
// settings.auto_recording = additionalFields.autoRecording as string;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.registrationType) {
|
||||
// settings.registration_type = additionalFields.registrationType as number;
|
||||
|
||||
// }
|
||||
// if (additionalFields.approvalType) {
|
||||
// settings.approval_type = additionalFields.approvalType as number;
|
||||
|
||||
// }
|
||||
|
||||
// body = {
|
||||
// settings,
|
||||
// };
|
||||
|
||||
// if (additionalFields.topic) {
|
||||
// body.topic = additionalFields.topic as string;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.type) {
|
||||
// body.type = additionalFields.type as string;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.startTime) {
|
||||
// body.start_time = additionalFields.startTime as string;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.duration) {
|
||||
// body.duration = additionalFields.duration as number;
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// if (additionalFields.timeZone) {
|
||||
// body.timezone = additionalFields.timeZone as string;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.password) {
|
||||
// body.password = additionalFields.password as string;
|
||||
|
||||
// }
|
||||
|
||||
// if (additionalFields.agenda) {
|
||||
// body.agenda = additionalFields.agenda as string;
|
||||
|
||||
// }
|
||||
// responseData = await zoomApiRequest.call(
|
||||
// this,
|
||||
// 'PATCH',
|
||||
// `webinars/${webinarId}`,
|
||||
// body,
|
||||
// qs
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
} else {
|
||||
returnData.push(responseData as IDataObject);
|
||||
}
|
||||
|
||||
return [this.helpers.returnJsonArray(returnData)];
|
||||
}
|
||||
}
|
BIN
packages/nodes-base/nodes/Zoom/zoom.png
Normal file
BIN
packages/nodes-base/nodes/Zoom/zoom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "n8n-nodes-base",
|
||||
"version": "0.65.0",
|
||||
"version": "0.67.0",
|
||||
"description": "Base nodes of n8n",
|
||||
"license": "SEE LICENSE IN LICENSE.md",
|
||||
"homepage": "https://n8n.io",
|
||||
|
@ -37,6 +37,7 @@
|
|||
"dist/credentials/BannerbearApi.credentials.js",
|
||||
"dist/credentials/BitbucketApi.credentials.js",
|
||||
"dist/credentials/BitlyApi.credentials.js",
|
||||
"dist/credentials/CircleCiApi.credentials.js",
|
||||
"dist/credentials/ChargebeeApi.credentials.js",
|
||||
"dist/credentials/ClearbitApi.credentials.js",
|
||||
"dist/credentials/ClickUpApi.credentials.js",
|
||||
|
@ -47,8 +48,10 @@
|
|||
"dist/credentials/CalendlyApi.credentials.js",
|
||||
"dist/credentials/DisqusApi.credentials.js",
|
||||
"dist/credentials/DriftApi.credentials.js",
|
||||
"dist/credentials/DriftOAuth2Api.credentials.js",
|
||||
"dist/credentials/DropboxApi.credentials.js",
|
||||
"dist/credentials/EventbriteApi.credentials.js",
|
||||
"dist/credentials/EventbriteOAuth2Api.credentials.js",
|
||||
"dist/credentials/FacebookGraphApi.credentials.js",
|
||||
"dist/credentials/FreshdeskApi.credentials.js",
|
||||
"dist/credentials/FileMaker.credentials.js",
|
||||
|
@ -120,6 +123,8 @@
|
|||
"dist/credentials/StripeApi.credentials.js",
|
||||
"dist/credentials/SalesmateApi.credentials.js",
|
||||
"dist/credentials/SegmentApi.credentials.js",
|
||||
"dist/credentials/Signl4Api.credentials.js",
|
||||
"dist/credentials/SpotifyOAuth2Api.credentials.js",
|
||||
"dist/credentials/SurveyMonkeyApi.credentials.js",
|
||||
"dist/credentials/SurveyMonkeyOAuth2Api.credentials.js",
|
||||
"dist/credentials/TelegramApi.credentials.js",
|
||||
|
@ -139,6 +144,8 @@
|
|||
"dist/credentials/ZendeskApi.credentials.js",
|
||||
"dist/credentials/ZendeskOAuth2Api.credentials.js",
|
||||
"dist/credentials/ZohoOAuth2Api.credentials.js",
|
||||
"dist/credentials/ZoomApi.credentials.js",
|
||||
"dist/credentials/ZoomOAuth2Api.credentials.js",
|
||||
"dist/credentials/ZulipApi.credentials.js"
|
||||
],
|
||||
"nodes": [
|
||||
|
@ -162,6 +169,7 @@
|
|||
"dist/nodes/Bitbucket/BitbucketTrigger.node.js",
|
||||
"dist/nodes/Bitly/Bitly.node.js",
|
||||
"dist/nodes/Calendly/CalendlyTrigger.node.js",
|
||||
"dist/nodes/CircleCi/CircleCi.node.js",
|
||||
"dist/nodes/Chargebee/Chargebee.node.js",
|
||||
"dist/nodes/Chargebee/ChargebeeTrigger.node.js",
|
||||
"dist/nodes/Clearbit/Clearbit.node.js",
|
||||
|
@ -262,9 +270,11 @@
|
|||
"dist/nodes/Set.node.js",
|
||||
"dist/nodes/Shopify/Shopify.node.js",
|
||||
"dist/nodes/Shopify/ShopifyTrigger.node.js",
|
||||
"dist/nodes/Signl4/Signl4.node.js",
|
||||
"dist/nodes/Slack/Slack.node.js",
|
||||
"dist/nodes/Sms77/Sms77.node.js",
|
||||
"dist/nodes/SplitInBatches.node.js",
|
||||
"dist/nodes/Spotify/Spotify.node.js",
|
||||
"dist/nodes/SpreadsheetFile.node.js",
|
||||
"dist/nodes/SseTrigger.node.js",
|
||||
"dist/nodes/Start.node.js",
|
||||
|
@ -294,6 +304,7 @@
|
|||
"dist/nodes/Zendesk/Zendesk.node.js",
|
||||
"dist/nodes/Zendesk/ZendeskTrigger.node.js",
|
||||
"dist/nodes/Zoho/ZohoCrm.node.js",
|
||||
"dist/nodes/Zoom/Zoom.node.js",
|
||||
"dist/nodes/Zulip/Zulip.node.js"
|
||||
]
|
||||
},
|
||||
|
@ -344,7 +355,7 @@
|
|||
"moment-timezone": "^0.5.28",
|
||||
"mongodb": "^3.5.5",
|
||||
"mysql2": "^2.0.1",
|
||||
"n8n-core": "~0.36.0",
|
||||
"n8n-core": "~0.37.0",
|
||||
"nodemailer": "^6.4.6",
|
||||
"pdf-parse": "^1.1.1",
|
||||
"pg-promise": "^9.0.3",
|
||||
|
|
|
@ -1085,18 +1085,18 @@ export class Workflow {
|
|||
* @returns {(Promise<INodeExecutionData[][] | null>)}
|
||||
* @memberof Workflow
|
||||
*/
|
||||
async runNode(node: INode, inputData: ITaskDataConnections, runExecutionData: IRunExecutionData, runIndex: number, additionalData: IWorkflowExecuteAdditionalData, nodeExecuteFunctions: INodeExecuteFunctions, mode: WorkflowExecuteMode): Promise<INodeExecutionData[][] | null> {
|
||||
async runNode(node: INode, inputData: ITaskDataConnections, runExecutionData: IRunExecutionData, runIndex: number, additionalData: IWorkflowExecuteAdditionalData, nodeExecuteFunctions: INodeExecuteFunctions, mode: WorkflowExecuteMode): Promise<INodeExecutionData[][] | null | undefined> {
|
||||
if (node.disabled === true) {
|
||||
// If node is disabled simply pass the data through
|
||||
// return NodeRunHelpers.
|
||||
if (inputData.hasOwnProperty('main') && inputData.main.length > 0) {
|
||||
// If the node is disabled simply return the data from the first main input
|
||||
if (inputData.main[0] === null) {
|
||||
return null;
|
||||
return undefined;
|
||||
}
|
||||
return [(inputData.main[0] as INodeExecutionData[])];
|
||||
}
|
||||
return null;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const nodeType = this.nodeTypes.getByName(node.type);
|
||||
|
@ -1112,7 +1112,7 @@ export class Workflow {
|
|||
|
||||
if (connectionInputData.length === 0) {
|
||||
// No data for node so return
|
||||
return null;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (runExecutionData.resultData.lastNodeExecuted === node.name && runExecutionData.resultData.error !== undefined) {
|
||||
|
|
Loading…
Reference in a new issue