# nodes

node_type: n8n-nodes-base.S3
name: S3
display_name: S3
description: Sends data to any S3-compatible service
category: output
icon: file:s3.png
code_hash: 80c075ea70231b2247f5c6f3da95d4769d94dc14792e809bb2a267a14d97e036
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.S3
documentation_title: S3 node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"s3","description":"Templates for s3"}]
related_resources: []
required_scopes: []
parameter_schemas: []
example_parameters: {"resource":"bucket","dynamic_property":null}
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:59:11
updated_at: 2025-06-12 08:59:11
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.S3 = void 0;
  const change_case_1 = require("change-case");
  const crypto_1 = require("crypto");
  const xml2js_1 = require("xml2js");
  const n8n_workflow_1 = require("n8n-workflow");
  const BucketDescription_1 = require("../Aws/S3/V1/BucketDescription");
  const FolderDescription_1 = require("../Aws/S3/V1/FolderDescription");
  const FileDescription_1 = require("../Aws/S3/V1/FileDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  class S3 {
      constructor() {
          this.description = {
              displayName: 'S3',
              name: 's3',
              icon: 'file:s3.png',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Sends data to any S3-compatible service',
              defaults: {
                  name: 'S3',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 's3',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Bucket',
                              value: 'bucket',
                          },
                          {
                              name: 'File',
                              value: 'file',
                          },
                          {
                              name: 'Folder',
                              value: 'folder',
                          },
                      ],
                      default: 'file',
                  },
                  ...BucketDescription_1.bucketOperations,
                  ...BucketDescription_1.bucketFields,
                  ...FolderDescription_1.folderOperations,
                  ...FolderDescription_1.folderFields,
                  ...FileDescription_1.fileOperations,
                  ...FileDescription_1.fileFields,
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const qs = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < items.length; i++) {
              try {
                  const headers = {};
                  if (resource === 'bucket') {
                      if (operation === 'create') {
                          let credentials;
                          try {
                              credentials = await this.getCredentials('s3');
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                          const name = this.getNodeParameter('name', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (additionalFields.acl) {
                              headers['x-amz-acl'] = (0, change_case_1.paramCase)(additionalFields.acl);
                          }
                          if (additionalFields.bucketObjectLockEnabled) {
                              headers['x-amz-bucket-object-lock-enabled'] =
                                  additionalFields.bucketObjectLockEnabled;
                          }
                          if (additionalFields.grantFullControl) {
                              headers['x-amz-grant-full-control'] = '';
                          }
                          if (additionalFields.grantRead) {
                              headers['x-amz-grant-read'] = '';
                          }
                          if (additionalFields.grantReadAcp) {
                              headers['x-amz-grant-read-acp'] = '';
                          }
                          if (additionalFields.grantWrite) {
                              headers['x-amz-grant-write'] = '';
                          }
                          if (additionalFields.grantWriteAcp) {
                              headers['x-amz-grant-write-acp'] = '';
                          }
                          let region = credentials.region;
                          if (additionalFields.region) {
                              region = additionalFields.region;
                          }
                          const body = {
                              CreateBucketConfiguration: {
                                  $: {
                                      xmlns: 'http://s3.amazonaws.com/doc/2006-03-01/',
                                  },
                              },
                          };
                          let data = '';
                          if (region !== 'us-east-1') {
                              body.CreateBucketConfiguration.LocationConstraint = [region];
                              const builder = new xml2js_1.Builder();
                              data = builder.buildObject(body);
                          }
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, `${name}`, 'PUT', '', data, qs, headers);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListAllMyBucketsResult.Buckets.Bucket', '', 'GET', '');
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListAllMyBucketsResult.Buckets.Bucket', '', 'GET', '', '', qs);
                              responseData = responseData.slice(0, qs.limit);
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'search') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          const additionalFields = this.getNodeParameter('additionalFields', 0);
                          if (additionalFields.prefix) {
                              qs.prefix = additionalFields.prefix;
                          }
                          if (additionalFields.encodingType) {
                              qs['encoding-type'] = additionalFields.encodingType;
                          }
                          if (additionalFields.delmiter) {
                              qs.delimiter = additionalFields.delmiter;
                          }
                          if (additionalFields.fetchOwner) {
                              qs['fetch-owner'] = additionalFields.fetchOwner;
                          }
                          if (additionalFields.startAfter) {
                              qs['start-after'] = additionalFields.startAfter;
                          }
                          if (additionalFields.requesterPays) {
                              qs['x-amz-request-payer'] = 'requester';
                          }
                          qs['list-type'] = 2;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          if (returnAll) {
                              responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListBucketResult.Contents', bucketName, 'GET', '', '', qs, {}, {}, region);
                          }
                          else {
                              qs['max-keys'] = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', qs, {}, {}, region);
                              responseData = responseData.ListBucketResult.Contents;
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                  }
                  if (resource === 'folder') {
                      if (operation === 'create') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const folderName = this.getNodeParameter('folderName', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          let path = `/${folderName}/`;
                          if (additionalFields.requesterPays) {
                              headers['x-amz-request-payer'] = 'requester';
                          }
                          if (additionalFields.parentFolderKey) {
                              path = `/${additionalFields.parentFolderKey}${folderName}/`;
                          }
                          if (additionalFields.storageClass) {
                              headers['x-amz-storage-class'] = (0, change_case_1.snakeCase)(additionalFields.storageClass).toUpperCase();
                          }
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'PUT', path, '', qs, headers, {}, region);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'delete') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const folderKey = this.getNodeParameter('folderKey', i);
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListBucketResult.Contents', bucketName, 'GET', '/', '', { 'list-type': 2, prefix: folderKey }, {}, {}, region);
                          if (responseData.length === 0) {
                              responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'DELETE', `/${folderKey}`, '', qs, {}, {}, region);
                              responseData = { deleted: [{ Key: folderKey }] };
                          }
                          else {
                              const body = {
                                  Delete: {
                                      $: {
                                          xmlns: 'http://s3.amazonaws.com/doc/2006-03-01/',
                                      },
                                      Object: [],
                                  },
                              };
                              for (const childObject of responseData) {
                                  body.Delete.Object.push({
                                      Key: childObject.Key,
                                  });
                              }
                              const builder = new xml2js_1.Builder();
                              const data = builder.buildObject(body);
                              headers['Content-MD5'] = (0, crypto_1.createHash)('md5').update(data).digest('base64');
                              headers['Content-Type'] = 'application/xml';
                              responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'POST', '/', data, { delete: '' }, headers, {}, region);
                              responseData = { deleted: responseData.DeleteResult.Deleted };
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'getAll') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          const options = this.getNodeParameter('options', 0);
                          if (options.folderKey) {
                              qs.prefix = options.folderKey;
                          }
                          if (options.fetchOwner) {
                              qs['fetch-owner'] = options.fetchOwner;
                          }
                          qs['list-type'] = 2;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          if (returnAll) {
                              responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListBucketResult.Contents', bucketName, 'GET', '', '', qs, {}, {}, region);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListBucketResult.Contents', bucketName, 'GET', '', '', qs, {}, {}, region);
                          }
                          if (Array.isArray(responseData)) {
                              responseData = responseData.filter((e) => e.Key.endsWith('/') && e.Size === '0' && e.Key !== options.folderKey);
                              if (qs.limit) {
                                  responseData = responseData.splice(0, qs.limit);
                              }
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                  }
                  if (resource === 'file') {
                      if (operation === 'copy') {
                          const sourcePath = this.getNodeParameter('sourcePath', i);
                          const destinationPath = this.getNodeParameter('destinationPath', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          headers['x-amz-copy-source'] = sourcePath;
                          if (additionalFields.requesterPays) {
                              headers['x-amz-request-payer'] = 'requester';
                          }
                          if (additionalFields.storageClass) {
                              headers['x-amz-storage-class'] = (0, change_case_1.snakeCase)(additionalFields.storageClass).toUpperCase();
                          }
                          if (additionalFields.acl) {
                              headers['x-amz-acl'] = (0, change_case_1.paramCase)(additionalFields.acl);
                          }
                          if (additionalFields.grantFullControl) {
                              headers['x-amz-grant-full-control'] = '';
                          }
                          if (additionalFields.grantRead) {
                              headers['x-amz-grant-read'] = '';
                          }
                          if (additionalFields.grantReadAcp) {
                              headers['x-amz-grant-read-acp'] = '';
                          }
                          if (additionalFields.grantWriteAcp) {
                              headers['x-amz-grant-write-acp'] = '';
                          }
                          if (additionalFields.lockLegalHold) {
                              headers['x-amz-object-lock-legal-hold'] = additionalFields.lockLegalHold
                                  ? 'ON'
                                  : 'OFF';
                          }
                          if (additionalFields.lockMode) {
                              headers['x-amz-object-lock-mode'] = additionalFields.lockMode.toUpperCase();
                          }
                          if (additionalFields.lockRetainUntilDate) {
                              headers['x-amz-object-lock-retain-until-date'] =
                                  additionalFields.lockRetainUntilDate;
                          }
                          if (additionalFields.serverSideEncryption) {
                              headers['x-amz-server-side-encryption'] =
                                  additionalFields.serverSideEncryption;
                          }
                          if (additionalFields.encryptionAwsKmsKeyId) {
                              headers['x-amz-server-side-encryption-aws-kms-key-id'] =
                                  additionalFields.encryptionAwsKmsKeyId;
                          }
                          if (additionalFields.serverSideEncryptionContext) {
                              headers['x-amz-server-side-encryption-context'] =
                                  additionalFields.serverSideEncryptionContext;
                          }
                          if (additionalFields.serversideEncryptionCustomerAlgorithm) {
                              headers['x-amz-server-side-encryption-customer-algorithm'] =
                                  additionalFields.serversideEncryptionCustomerAlgorithm;
                          }
                          if (additionalFields.serversideEncryptionCustomerKey) {
                              headers['x-amz-server-side-encryption-customer-key'] =
                                  additionalFields.serversideEncryptionCustomerKey;
                          }
                          if (additionalFields.serversideEncryptionCustomerKeyMD5) {
                              headers['x-amz-server-side-encryption-customer-key-MD5'] =
                                  additionalFields.serversideEncryptionCustomerKeyMD5;
                          }
                          if (additionalFields.taggingDirective) {
                              headers['x-amz-tagging-directive'] = additionalFields.taggingDirective.toUpperCase();
                          }
                          if (additionalFields.metadataDirective) {
                              headers['x-amz-metadata-directive'] = additionalFields.metadataDirective.toUpperCase();
                          }
                          const destinationParts = destinationPath.split('/');
                          const bucketName = destinationParts[1];
                          const destination = `/${destinationParts.slice(2, destinationParts.length).join('/')}`;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'PUT', destination, '', qs, headers, {}, region);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData.CopyObjectResult), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'download') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const fileKey = this.getNodeParameter('fileKey', i);
                          const fileName = fileKey.split('/')[fileKey.split('/').length - 1];
                          if (fileKey.substring(fileKey.length - 1) === '/') {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Downloding a whole directory is not yet supported, please provide a file key');
                          }
                          let region = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          region = region.LocationConstraint._;
                          const response = await GenericFunctions_1.s3ApiRequestREST.call(this, bucketName, 'GET', `/${fileKey}`, '', qs, {}, { encoding: null, resolveWithFullResponse: true }, region);
                          let mimeType;
                          if (response.headers['content-type']) {
                              mimeType = response.headers['content-type'];
                          }
                          const newItem = {
                              json: items[i].json,
                              binary: {},
                          };
                          if (items[i].binary !== undefined) {
                              Object.assign(newItem.binary, items[i].binary);
                          }
                          items[i] = newItem;
                          const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
                          const data = Buffer.from(response.body, 'utf8');
                          items[i].binary[dataPropertyNameDownload] = await this.helpers.prepareBinaryData(data, fileName, mimeType);
                      }
                      if (operation === 'delete') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const fileKey = this.getNodeParameter('fileKey', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.versionId) {
                              qs.versionId = options.versionId;
                          }
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'DELETE', `/${fileKey}`, '', qs, {}, {}, region);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'getAll') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          const options = this.getNodeParameter('options', 0);
                          if (options.folderKey) {
                              qs.prefix = options.folderKey;
                          }
                          if (options.fetchOwner) {
                              qs['fetch-owner'] = options.fetchOwner;
                          }
                          qs.delimiter = '/';
                          qs['list-type'] = 2;
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          if (returnAll) {
                              responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListBucketResult.Contents', bucketName, 'GET', '', '', qs, {}, {}, region);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.s3ApiRequestSOAPAllItems.call(this, 'ListBucketResult.Contents', bucketName, 'GET', '', '', qs, {}, {}, region);
                              responseData = responseData.splice(0, qs.limit);
                          }
                          if (Array.isArray(responseData)) {
                              responseData = responseData.filter((e) => !e.Key.endsWith('/') && e.Size !== '0');
                              if (qs.limit) {
                                  responseData = responseData.splice(0, qs.limit);
                              }
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'upload') {
                          const bucketName = this.getNodeParameter('bucketName', i);
                          const fileName = this.getNodeParameter('fileName', i);
                          const isBinaryData = this.getNodeParameter('binaryData', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const tagsValues = this.getNodeParameter('tagsUi', i)
                              .tagsValues;
                          let path = '/';
                          let body;
                          if (additionalFields.requesterPays) {
                              headers['x-amz-request-payer'] = 'requester';
                          }
                          if (additionalFields.parentFolderKey) {
                              path = `/${additionalFields.parentFolderKey}/`;
                          }
                          if (additionalFields.storageClass) {
                              headers['x-amz-storage-class'] = (0, change_case_1.snakeCase)(additionalFields.storageClass).toUpperCase();
                          }
                          if (additionalFields.acl) {
                              headers['x-amz-acl'] = (0, change_case_1.paramCase)(additionalFields.acl);
                          }
                          if (additionalFields.grantFullControl) {
                              headers['x-amz-grant-full-control'] = '';
                          }
                          if (additionalFields.grantRead) {
                              headers['x-amz-grant-read'] = '';
                          }
                          if (additionalFields.grantReadAcp) {
                              headers['x-amz-grant-read-acp'] = '';
                          }
                          if (additionalFields.grantWriteAcp) {
                              headers['x-amz-grant-write-acp'] = '';
                          }
                          if (additionalFields.lockLegalHold) {
                              headers['x-amz-object-lock-legal-hold'] = additionalFields.lockLegalHold
                                  ? 'ON'
                                  : 'OFF';
                          }
                          if (additionalFields.lockMode) {
                              headers['x-amz-object-lock-mode'] = additionalFields.lockMode.toUpperCase();
                          }
                          if (additionalFields.lockRetainUntilDate) {
                              headers['x-amz-object-lock-retain-until-date'] =
                                  additionalFields.lockRetainUntilDate;
                          }
                          if (additionalFields.serverSideEncryption) {
                              headers['x-amz-server-side-encryption'] =
                                  additionalFields.serverSideEncryption;
                          }
                          if (additionalFields.encryptionAwsKmsKeyId) {
                              headers['x-amz-server-side-encryption-aws-kms-key-id'] =
                                  additionalFields.encryptionAwsKmsKeyId;
                          }
                          if (additionalFields.serverSideEncryptionContext) {
                              headers['x-amz-server-side-encryption-context'] =
                                  additionalFields.serverSideEncryptionContext;
                          }
                          if (additionalFields.serversideEncryptionCustomerAlgorithm) {
                              headers['x-amz-server-side-encryption-customer-algorithm'] =
                                  additionalFields.serversideEncryptionCustomerAlgorithm;
                          }
                          if (additionalFields.serversideEncryptionCustomerKey) {
                              headers['x-amz-server-side-encryption-customer-key'] =
                                  additionalFields.serversideEncryptionCustomerKey;
                          }
                          if (additionalFields.serversideEncryptionCustomerKeyMD5) {
                              headers['x-amz-server-side-encryption-customer-key-MD5'] =
                                  additionalFields.serversideEncryptionCustomerKeyMD5;
                          }
                          if (tagsValues) {
                              const tags = [];
                              tagsValues.forEach((o) => {
                                  tags.push(`${o.key}=${o.value}`);
                              });
                              headers['x-amz-tagging'] = tags.join('&');
                          }
                          responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'GET', '', '', {
                              location: '',
                          });
                          const region = responseData.LocationConstraint._;
                          if (isBinaryData) {
                              const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0);
                              const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                              body = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
                              headers['Content-Type'] = binaryData.mimeType;
                              headers['Content-MD5'] = (0, crypto_1.createHash)('md5').update(body).digest('base64');
                              responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'PUT', `${path}${fileName || binaryData.fileName}`, body, qs, headers, {}, region);
                          }
                          else {
                              const fileContent = this.getNodeParameter('fileContent', i);
                              body = Buffer.from(fileContent, 'utf8');
                              headers['Content-Type'] = 'text/html';
                              headers['Content-MD5'] = (0, crypto_1.createHash)('md5').update(fileContent).digest('base64');
                              responseData = await GenericFunctions_1.s3ApiRequestSOAP.call(this, bucketName, 'PUT', `${path}${fileName}`, body, qs, headers, {}, region);
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      if (resource === 'file' && operation === 'download') {
                          items[i].json = { error: error.message };
                      }
                      else {
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      continue;
                  }
                  throw error;
              }
          }
          if (resource === 'file' && operation === 'download') {
              return [items];
          }
          return [returnData];
      }
  }
  exports.S3 = S3;
  //# sourceMappingURL=S3.node.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: S3 node documentation
  description: Learn how to use the S3 node in n8n. Follow technical documentation to integrate S3 node into your workflows.
  contentType: [integration, reference]
  priority: medium
  ---

  # S3 node

  Use the S3 node to automate work in non-AWS S3 storage and integrate S3 with other applications. n8n has built-in support for a wide range of S3 features, including creating, deleting, and getting buckets, files, and folders. For AWS S3, use [AWS S3](/integrations/builtin/app-nodes/n8n-nodes-base.awss3.md).

  Use the S3 node for non-AWS S3 solutions like:

  * [MinIO](https://min.io/){:target="_blank" .external-link}
  * [Wasabi](https://wasabi.com/){:target="_blank" .external-link}
  * [Digital Ocean spaces](https://www.digitalocean.com/products/spaces){:target="_blank" .external-link}

  On this page, you'll find a list of operations the S3 node supports and links to more resources.

  /// note | Credentials
  Refer to [S3 credentials](/integrations/builtin/credentials/s3.md) for guidance on setting up authentication.
  ///

  --8<-- "_snippets/integrations/builtin/app-nodes/ai-tools.md"

  ## Operations

  * Bucket
      * Create a bucket
      * Delete a bucket
      * Get all buckets
      * Search within a bucket
  * File
      * Copy a file
      * Delete a file
      * Download a file
      * Get all files
      * Upload a file

      /// note | Attach file for upload
      To attach a file for upload, use another node to pass the file as a data property. Nodes like the [Read/Write Files from Disk](/integrations/builtin/core-nodes/n8n-nodes-base.readwritefile.md) node or the [HTTP Request](/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/index.md) work well.
      ///

  * Folder
      * Create a folder
      * Delete a folder
      * Get all folders

  ## Templates and examples

  <!-- see https://www.notion.so/n8n/Pull-in-templates-for-the-integrations-pages-37c716837b804d30a33b47475f6e3780 -->
  [[ templatesWidget(page.title, 's3') ]]

  ## Node reference

  ### Setting file permissions in Wasabi

  When uploading files to [Wasabi](https://wasabi.com/){:target="_blank" .external-link}, you must set permissions for the files using the **ACL** dropdown and not the toggles.

  ![File permissions when using the S3 node with Wasabi](/_images/integrations/builtin/app-nodes/s3/acl_dropdown.png)

troubleshooting_info:
  [{"issue":"Setting file permissions in Wasabi","solution":"When uploading files to [Wasabi](https://wasabi.com/){:target=\"_blank\" .external-link}, you must set permissions for the files using the **ACL** dropdown and not the toggles."}]

example_workflow:
  {"name":"S3 Example Workflow","nodes":[{"parameters":{"resource":"bucket","dynamic_property":null},"id":"ebflg9ikyxatgf4hfh8y","name":"S3","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"Resource","name":"resource","type":"options","default":"file","options":[{"name":"Bucket","value":"bucket"},{"name":"File","value":"file"},{"name":"Folder","value":"folder"}]},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...BucketDescription_1.bucketOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...BucketDescription_1.bucketFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...FolderDescription_1.folderOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...FolderDescription_1.folderFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...FileDescription_1.fileOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...FileDescription_1.fileFields"}]


node_type: n8n-nodes-base.Salesforce
name: Salesforce
display_name: Salesforce
description: Consume Salesforce API
category: output
icon: file:salesforce.svg
code_hash: 6f246b98c15db36cd6ecfb303d5edf8861482d616bc7a416a74aa341105120c3
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.Salesforce
documentation_title: Salesforce node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"salesforce","description":"Templates for salesforce"}]
related_resources: []
required_scopes: []
parameter_schemas: []
example_parameters: {"authentication":"oAuth2","resource":"account","dynamic_property":null}
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:59:11
updated_at: 2025-06-12 08:59:11
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Salesforce = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const AccountDescription_1 = require("./AccountDescription");
  const AttachmentDescription_1 = require("./AttachmentDescription");
  const CaseDescription_1 = require("./CaseDescription");
  const ContactDescription_1 = require("./ContactDescription");
  const CustomObjectDescription_1 = require("./CustomObjectDescription");
  const FlowDescription_1 = require("./FlowDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  const LeadDescription_1 = require("./LeadDescription");
  const OpportunityDescription_1 = require("./OpportunityDescription");
  const SearchDescription_1 = require("./SearchDescription");
  const TaskDescription_1 = require("./TaskDescription");
  const UserDescription_1 = require("./UserDescription");
  const DocumentDescription_1 = require("./DocumentDescription");
  class Salesforce {
      constructor() {
          this.description = {
              displayName: 'Salesforce',
              name: 'salesforce',
              icon: 'file:salesforce.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Salesforce API',
              defaults: {
                  name: 'Salesforce',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'salesforceOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth2'],
                          },
                      },
                  },
                  {
                      name: 'salesforceJwtApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['jwt'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'OAuth2',
                              value: 'oAuth2',
                          },
                          {
                              name: 'OAuth2 JWT',
                              value: 'jwt',
                          },
                      ],
                      default: 'oAuth2',
                      description: 'OAuth Authorization Flow',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Account',
                              value: 'account',
                              description: 'Represents an individual account, which is an organization or person involved with your business (such as customers, competitors, and partners)',
                          },
                          {
                              name: 'Attachment',
                              value: 'attachment',
                              description: 'Represents a file that a has uploaded and attached to a parent object',
                          },
                          {
                              name: 'Case',
                              value: 'case',
                              description: 'Represents a case, which is a customer issue or problem',
                          },
                          {
                              name: 'Contact',
                              value: 'contact',
                              description: 'Represents a contact, which is an individual associated with an account',
                          },
                          {
                              name: 'Custom Object',
                              value: 'customObject',
                              description: 'Represents a custom object',
                          },
                          {
                              name: 'Document',
                              value: 'document',
                              description: 'Represents a document',
                          },
                          {
                              name: 'Flow',
                              value: 'flow',
                              description: 'Represents an autolaunched flow',
                          },
                          {
                              name: 'Lead',
                              value: 'lead',
                              description: 'Represents a prospect or potential',
                          },
                          {
                              name: 'Opportunity',
                              value: 'opportunity',
                              description: 'Represents an opportunity, which is a sale or pending deal',
                          },
                          {
                              name: 'Search',
                              value: 'search',
                              description: 'Search records',
                          },
                          {
                              name: 'Task',
                              value: 'task',
                              description: 'Represents a business activity such as making a phone call or other to-do items. In the user interface, and records are collectively referred to as activities.',
                          },
                          {
                              name: 'User',
                              value: 'user',
                              description: 'Represents a person, which is one user in system',
                          },
                      ],
                      default: 'lead',
                  },
                  ...LeadDescription_1.leadOperations,
                  ...LeadDescription_1.leadFields,
                  ...ContactDescription_1.contactOperations,
                  ...ContactDescription_1.contactFields,
                  ...CustomObjectDescription_1.customObjectOperations,
                  ...CustomObjectDescription_1.customObjectFields,
                  ...DocumentDescription_1.documentOperations,
                  ...DocumentDescription_1.documentFields,
                  ...OpportunityDescription_1.opportunityOperations,
                  ...OpportunityDescription_1.opportunityFields,
                  ...AccountDescription_1.accountOperations,
                  ...AccountDescription_1.accountFields,
                  ...SearchDescription_1.searchOperations,
                  ...SearchDescription_1.searchFields,
                  ...CaseDescription_1.caseOperations,
                  ...CaseDescription_1.caseFields,
                  ...TaskDescription_1.taskOperations,
                  ...TaskDescription_1.taskFields,
                  ...AttachmentDescription_1.attachmentOperations,
                  ...AttachmentDescription_1.attachmentFields,
                  ...UserDescription_1.userOperations,
                  ...UserDescription_1.userFields,
                  ...FlowDescription_1.flowOperations,
                  ...FlowDescription_1.flowFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getLeadStatuses() {
                      const returnData = [];
                      const qs = {
                          q: 'SELECT id, MasterLabel FROM LeadStatus',
                      };
                      const statuses = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                      for (const status of statuses) {
                          const statusName = status.MasterLabel;
                          returnData.push({
                              name: statusName,
                              value: statusName,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getUsers() {
                      const returnData = [];
                      const qs = {
                          q: 'SELECT id, Name FROM User',
                      };
                      const users = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                      for (const user of users) {
                          const userName = user.Name;
                          const userId = user.Id;
                          returnData.push({
                              name: userName,
                              value: userId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCaseOwners() {
                      const returnData = [];
                      const qsQueues = {
                          q: "SELECT Queue.Id, Queue.Name FROM QueuesObject where Queue.Type='Queue' and SobjectType = 'Case'",
                      };
                      const queues = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qsQueues);
                      for (const queue of queues) {
                          const queueName = queue.Queue.Name;
                          const queueId = queue.Queue.Id;
                          returnData.push({
                              name: `Queue: ${queueName}`,
                              value: queueId,
                          });
                      }
                      const qsUsers = {
                          q: 'SELECT id, Name FROM User',
                      };
                      const users = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qsUsers);
                      const userPrefix = returnData.length > 0 ? 'User: ' : '';
                      for (const user of users) {
                          const userName = user.Name;
                          const userId = user.Id;
                          returnData.push({
                              name: userPrefix + userName,
                              value: userId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getLeadOwners() {
                      const returnData = [];
                      const qsQueues = {
                          q: "SELECT Queue.Id, Queue.Name FROM QueuesObject where Queue.Type='Queue' and SobjectType = 'Lead'",
                      };
                      const queues = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qsQueues);
                      for (const queue of queues) {
                          const queueName = queue.Queue.Name;
                          const queueId = queue.Queue.Id;
                          returnData.push({
                              name: `Queue: ${queueName}`,
                              value: queueId,
                          });
                      }
                      const qsUsers = {
                          q: 'SELECT id, Name FROM User',
                      };
                      const users = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qsUsers);
                      const userPrefix = returnData.length > 0 ? 'User: ' : '';
                      for (const user of users) {
                          const userName = user.Name;
                          const userId = user.Id;
                          returnData.push({
                              name: userPrefix + userName,
                              value: userId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getLeadSources() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/lead/describe');
                      for (const field of fields) {
                          if (field.name === 'LeadSource') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCustomFields() {
                      const returnData = [];
                      const resource = this.getNodeParameter('resource', 0);
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/${resource}/describe`);
                      for (const field of fields) {
                          if (field.custom === true) {
                              const fieldName = field.label;
                              const fieldId = field.name;
                              returnData.push({
                                  name: fieldName,
                                  value: fieldId,
                              });
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getRecordTypes() {
                      const returnData = [];
                      let resource = this.getNodeParameter('resource', 0);
                      if (resource === 'customObject') {
                          resource = this.getNodeParameter('customObject', 0);
                      }
                      const qs = {
                          q: `SELECT Id, Name, SobjectType, IsActive FROM RecordType WHERE SobjectType = '${resource}'`,
                      };
                      const types = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                      for (const type of types) {
                          if (type.IsActive === true) {
                              returnData.push({
                                  name: type.Name,
                                  value: type.Id,
                              });
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getExternalIdFields() {
                      const returnData = [];
                      let resource = this.getCurrentNodeParameter('resource');
                      resource =
                          resource === 'customObject'
                              ? this.getCurrentNodeParameter('customObject')
                              : resource;
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/${resource}/describe`);
                      for (const field of fields) {
                          if (field.externalId === true || field.idLookup === true) {
                              const fieldName = field.label;
                              const fieldId = field.name;
                              returnData.push({
                                  name: fieldName,
                                  value: fieldId,
                              });
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getAccounts() {
                      const returnData = [];
                      const qs = {
                          q: 'SELECT id, Name FROM Account',
                      };
                      const accounts = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                      for (const account of accounts) {
                          const accountName = account.Name;
                          const accountId = account.Id;
                          returnData.push({
                              name: accountName,
                              value: accountId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCampaigns() {
                      const returnData = [];
                      const qs = {
                          q: 'SELECT id, Name FROM Campaign',
                      };
                      const campaigns = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                      for (const campaign of campaigns) {
                          const campaignName = campaign.Name;
                          const campaignId = campaign.Id;
                          returnData.push({
                              name: campaignName,
                              value: campaignId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getStages() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/opportunity/describe');
                      for (const field of fields) {
                          if (field.name === 'StageName') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getAccountTypes() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/account/describe');
                      for (const field of fields) {
                          if (field.name === 'Type') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getAccountSources() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/account/describe');
                      for (const field of fields) {
                          if (field.name === 'AccountSource') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCaseTypes() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/case/describe');
                      for (const field of fields) {
                          if (field.name === 'Type') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCaseStatuses() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/case/describe');
                      for (const field of fields) {
                          if (field.name === 'Status') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCaseReasons() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/case/describe');
                      for (const field of fields) {
                          if (field.name === 'Reason') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCaseOrigins() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/case/describe');
                      for (const field of fields) {
                          if (field.name === 'Origin') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCasePriorities() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/case/describe');
                      for (const field of fields) {
                          if (field.name === 'Priority') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskStatuses() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          if (field.name === 'Status') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskTypes() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          if (field.name === 'TaskSubtype') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskSubjects() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          if (field.name === 'Subject') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskCallTypes() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          if (field.name === 'CallType') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskPriorities() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          if (field.name === 'Priority') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskRecurrenceTypes() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          if (field.name === 'RecurrenceType') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskRecurrenceInstances() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          if (field.name === 'RecurrenceInstance') {
                              for (const pickValue of field.picklistValues) {
                                  const pickValueName = pickValue.label;
                                  const pickValueId = pickValue.value;
                                  returnData.push({
                                      name: pickValueName,
                                      value: pickValueId,
                                  });
                              }
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCustomObjects() {
                      const returnData = [];
                      const { sobjects: objects } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects');
                      for (const object of objects) {
                          if (object.custom === true) {
                              const objectName = object.label;
                              const objectId = object.name;
                              returnData.push({
                                  name: objectName,
                                  value: objectId,
                              });
                          }
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCustomObjectFields() {
                      const returnData = [];
                      const customObject = this.getCurrentNodeParameter('customObject');
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/${customObject}/describe`);
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getAccountFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/account/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getAtachmentFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/attachment/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getCaseFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/case/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getLeadFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/lead/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getOpportunityFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/opportunity/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getTaskFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getUserFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/user/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
                  async getContactFields() {
                      const returnData = [];
                      const { fields } = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/contact/describe');
                      for (const field of fields) {
                          const fieldName = field.label;
                          const fieldId = field.name;
                          returnData.push({
                              name: fieldName,
                              value: fieldId,
                          });
                      }
                      (0, GenericFunctions_1.sortOptions)(returnData);
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          let responseData;
          const qs = {};
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          this.logger.debug(`Running "Salesforce" node named "${this.getNode.name}" resource "${resource}" operation "${operation}"`);
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'lead') {
                      if (operation === 'create' || operation === 'upsert') {
                          const company = this.getNodeParameter('company', i);
                          const lastname = this.getNodeParameter('lastname', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              Company: company,
                              LastName: lastname,
                          };
                          if (additionalFields.hasOptedOutOfEmail !== undefined) {
                              body.HasOptedOutOfEmail = additionalFields.hasOptedOutOfEmail;
                          }
                          if (additionalFields.hasOptedOutOfFax !== undefined) {
                              body.HasOptedOutOfFax = additionalFields.hasOptedOutOfFax;
                          }
                          if (additionalFields.email !== undefined) {
                              body.Email = additionalFields.email;
                          }
                          if (additionalFields.city !== undefined) {
                              body.City = additionalFields.city;
                          }
                          if (additionalFields.phone !== undefined) {
                              body.Phone = additionalFields.phone;
                          }
                          if (additionalFields.state !== undefined) {
                              body.State = additionalFields.state;
                          }
                          if (additionalFields.title !== undefined) {
                              body.Title = additionalFields.title;
                          }
                          if (additionalFields.jigsaw !== undefined) {
                              body.Jigsaw = additionalFields.jigsaw;
                          }
                          if (additionalFields.rating !== undefined) {
                              body.Rating = additionalFields.rating;
                          }
                          if (additionalFields.status !== undefined) {
                              body.Status = additionalFields.status;
                          }
                          if (additionalFields.street !== undefined) {
                              body.Street = additionalFields.street;
                          }
                          if (additionalFields.country !== undefined) {
                              body.Country = additionalFields.country;
                          }
                          if (additionalFields.owner !== undefined) {
                              body.OwnerId = additionalFields.owner;
                          }
                          if (additionalFields.website !== undefined) {
                              body.Website = additionalFields.website;
                          }
                          if (additionalFields.industry !== undefined) {
                              body.Industry = additionalFields.industry;
                          }
                          if (additionalFields.fax !== undefined) {
                              body.Fax = additionalFields.fax;
                          }
                          if (additionalFields.firstname !== undefined) {
                              body.FirstName = additionalFields.firstname;
                          }
                          if (additionalFields.leadSource !== undefined) {
                              body.LeadSource = additionalFields.leadSource;
                          }
                          if (additionalFields.postalCode !== undefined) {
                              body.PostalCode = additionalFields.postalCode;
                          }
                          if (additionalFields.salutation !== undefined) {
                              body.Salutation = additionalFields.salutation;
                          }
                          if (additionalFields.description !== undefined) {
                              body.Description = additionalFields.description;
                          }
                          if (additionalFields.annualRevenue !== undefined) {
                              body.AnnualRevenue = additionalFields.annualRevenue;
                          }
                          if (additionalFields.isUnreadByOwner !== undefined) {
                              body.IsUnreadByOwner = additionalFields.isUnreadByOwner;
                          }
                          if (additionalFields.numberOfEmployees !== undefined) {
                              body.NumberOfEmployees = additionalFields.numberOfEmployees;
                          }
                          if (additionalFields.mobilePhone !== undefined) {
                              body.MobilePhone = additionalFields.mobilePhone;
                          }
                          if (additionalFields.recordTypeId !== undefined) {
                              body.RecordTypeId = additionalFields.recordTypeId;
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = additionalFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          let endpoint = '/sobjects/lead';
                          let method = 'POST';
                          if (operation === 'upsert') {
                              method = 'PATCH';
                              const externalId = this.getNodeParameter('externalId', 0);
                              const externalIdValue = this.getNodeParameter('externalIdValue', i);
                              endpoint = `/sobjects/lead/${externalId}/${externalIdValue}`;
                              if (body[externalId] !== undefined) {
                                  delete body[externalId];
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, method, endpoint, body);
                      }
                      if (operation === 'update') {
                          const leadId = this.getNodeParameter('leadId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (!Object.keys(updateFields).length) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You must add at least one update field', { itemIndex: i });
                          }
                          if (updateFields.hasOptedOutOfEmail !== undefined) {
                              body.HasOptedOutOfEmail = updateFields.hasOptedOutOfEmail;
                          }
                          if (updateFields.hasOptedOutOfFax !== undefined) {
                              body.hasOptedOutOfFax = updateFields.hasOptedOutOfFax;
                          }
                          if (updateFields.lastname !== undefined) {
                              body.LastName = updateFields.lastname;
                          }
                          if (updateFields.company !== undefined) {
                              body.Company = updateFields.company;
                          }
                          if (updateFields.email !== undefined) {
                              body.Email = updateFields.email;
                          }
                          if (updateFields.city !== undefined) {
                              body.City = updateFields.city;
                          }
                          if (updateFields.phone !== undefined) {
                              body.Phone = updateFields.phone;
                          }
                          if (updateFields.state !== undefined) {
                              body.State = updateFields.state;
                          }
                          if (updateFields.title !== undefined) {
                              body.Title = updateFields.title;
                          }
                          if (updateFields.jigsaw !== undefined) {
                              body.Jigsaw = updateFields.jigsaw;
                          }
                          if (updateFields.rating !== undefined) {
                              body.Rating = updateFields.rating;
                          }
                          if (updateFields.status !== undefined) {
                              body.Status = updateFields.status;
                          }
                          if (updateFields.street !== undefined) {
                              body.Street = updateFields.street;
                          }
                          if (updateFields.country !== undefined) {
                              body.Country = updateFields.country;
                          }
                          if (updateFields.owner !== undefined) {
                              body.OwnerId = updateFields.owner;
                          }
                          if (updateFields.website !== undefined) {
                              body.Website = updateFields.website;
                          }
                          if (updateFields.industry !== undefined) {
                              body.Industry = updateFields.industry;
                          }
                          if (updateFields.firstname !== undefined) {
                              body.FirstName = updateFields.firstname;
                          }
                          if (updateFields.fax !== undefined) {
                              body.Fax = updateFields.fax;
                          }
                          if (updateFields.leadSource !== undefined) {
                              body.LeadSource = updateFields.leadSource;
                          }
                          if (updateFields.postalCode !== undefined) {
                              body.PostalCode = updateFields.postalCode;
                          }
                          if (updateFields.salutation !== undefined) {
                              body.Salutation = updateFields.salutation;
                          }
                          if (updateFields.description !== undefined) {
                              body.Description = updateFields.description;
                          }
                          if (updateFields.annualRevenue !== undefined) {
                              body.AnnualRevenue = updateFields.annualRevenue;
                          }
                          if (updateFields.isUnreadByOwner !== undefined) {
                              body.IsUnreadByOwner = updateFields.isUnreadByOwner;
                          }
                          if (updateFields.numberOfEmployees !== undefined) {
                              body.NumberOfEmployees = updateFields.numberOfEmployees;
                          }
                          if (updateFields.mobilePhone !== undefined) {
                              body.MobilePhone = updateFields.mobilePhone;
                          }
                          if (updateFields.recordTypeId !== undefined) {
                              body.RecordTypeId = updateFields.recordTypeId;
                          }
                          if (updateFields.customFieldsUi) {
                              const customFields = updateFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/lead/${leadId}`, body);
                      }
                      if (operation === 'get') {
                          const leadId = this.getNodeParameter('leadId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/lead/${leadId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Lead', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Lead', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const leadId = this.getNodeParameter('leadId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/lead/${leadId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getSummary') {
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/lead');
                      }
                      if (operation === 'addToCampaign') {
                          const leadId = this.getNodeParameter('leadId', i);
                          const campaignId = this.getNodeParameter('campaignId', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              LeadId: leadId,
                              CampaignId: campaignId,
                          };
                          if (options.status) {
                              body.Status = options.status;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/CampaignMember', body);
                      }
                      if (operation === 'addNote') {
                          const leadId = this.getNodeParameter('leadId', i);
                          const title = this.getNodeParameter('title', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              Title: title,
                              ParentId: leadId,
                          };
                          if (options.body) {
                              body.Body = options.body;
                          }
                          if (options.owner) {
                              body.OwnerId = options.owner;
                          }
                          if (options.isPrivate) {
                              body.IsPrivate = options.isPrivate;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/note', body);
                      }
                  }
                  if (resource === 'contact') {
                      if (operation === 'create' || operation === 'upsert') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const lastname = this.getNodeParameter('lastname', i);
                          const body = {
                              LastName: lastname,
                          };
                          if (additionalFields.fax !== undefined) {
                              body.Fax = additionalFields.fax;
                          }
                          if (additionalFields.email !== undefined) {
                              body.Email = additionalFields.email;
                          }
                          if (additionalFields.phone !== undefined) {
                              body.Phone = additionalFields.phone;
                          }
                          if (additionalFields.title !== undefined) {
                              body.Title = additionalFields.title;
                          }
                          if (additionalFields.jigsaw !== undefined) {
                              body.Jigsaw = additionalFields.jigsaw;
                          }
                          if (additionalFields.recordTypeId !== undefined) {
                              body.RecordTypeId = additionalFields.recordTypeId;
                          }
                          if (additionalFields.owner !== undefined) {
                              body.OwnerId = additionalFields.owner;
                          }
                          if (additionalFields.acconuntId !== undefined) {
                              body.AccountId = additionalFields.acconuntId;
                          }
                          if (additionalFields.birthdate !== undefined) {
                              body.Birthdate = additionalFields.birthdate;
                          }
                          if (additionalFields.firstName !== undefined) {
                              body.FirstName = additionalFields.firstName;
                          }
                          if (additionalFields.homePhone !== undefined) {
                              body.HomePhone = additionalFields.homePhone;
                          }
                          if (additionalFields.otherCity !== undefined) {
                              body.OtherCity = additionalFields.otherCity;
                          }
                          if (additionalFields.department !== undefined) {
                              body.Department = additionalFields.department;
                          }
                          if (additionalFields.leadSource !== undefined) {
                              body.LeadSource = additionalFields.leadSource;
                          }
                          if (additionalFields.otherPhone !== undefined) {
                              body.OtherPhone = additionalFields.otherPhone;
                          }
                          if (additionalFields.otherState !== undefined) {
                              body.OtherState = additionalFields.otherState;
                          }
                          if (additionalFields.salutation !== undefined) {
                              body.Salutation = additionalFields.salutation;
                          }
                          if (additionalFields.description !== undefined) {
                              body.Description = additionalFields.description;
                          }
                          if (additionalFields.mailingCity !== undefined) {
                              body.MailingCity = additionalFields.mailingCity;
                          }
                          if (additionalFields.mobilePhone !== undefined) {
                              body.MobilePhone = additionalFields.mobilePhone;
                          }
                          if (additionalFields.otherStreet !== undefined) {
                              body.OtherStreet = additionalFields.otherStreet;
                          }
                          if (additionalFields.mailingState !== undefined) {
                              body.MailingState = additionalFields.mailingState;
                          }
                          if (additionalFields.otherCountry !== undefined) {
                              body.OtherCountry = additionalFields.otherCountry;
                          }
                          if (additionalFields.assistantName !== undefined) {
                              body.AssistantName = additionalFields.assistantName;
                          }
                          if (additionalFields.mailingStreet !== undefined) {
                              body.MailingStreet = additionalFields.mailingStreet;
                          }
                          if (additionalFields.assistantPhone !== undefined) {
                              body.AssistantPhone = additionalFields.assistantPhone;
                          }
                          if (additionalFields.mailingCountry !== undefined) {
                              body.MailingCountry = additionalFields.mailingCountry;
                          }
                          if (additionalFields.otherPostalCode !== undefined) {
                              body.OtherPostalCode = additionalFields.otherPostalCode;
                          }
                          if (additionalFields.emailBouncedDate !== undefined) {
                              body.EmailBouncedDate = additionalFields.emailBouncedDate;
                          }
                          if (additionalFields.mailingPostalCode !== undefined) {
                              body.MailingPostalCode = additionalFields.mailingPostalCode;
                          }
                          if (additionalFields.emailBouncedReason !== undefined) {
                              body.EmailBouncedReason = additionalFields.emailBouncedReason;
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = additionalFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          let endpoint = '/sobjects/contact';
                          let method = 'POST';
                          if (operation === 'upsert') {
                              method = 'PATCH';
                              const externalId = this.getNodeParameter('externalId', 0);
                              const externalIdValue = this.getNodeParameter('externalIdValue', i);
                              endpoint = `/sobjects/contact/${externalId}/${externalIdValue}`;
                              if (body[externalId] !== undefined) {
                                  delete body[externalId];
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, method, endpoint, body);
                      }
                      if (operation === 'update') {
                          const contactId = this.getNodeParameter('contactId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (!Object.keys(updateFields).length) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You must add at least one update field', { itemIndex: i });
                          }
                          if (updateFields.lastName !== undefined) {
                              body.LastName = updateFields.lastName;
                          }
                          if (updateFields.fax !== undefined) {
                              body.Fax = updateFields.fax;
                          }
                          if (updateFields.email !== undefined) {
                              body.Email = updateFields.email;
                          }
                          if (updateFields.recordTypeId !== undefined) {
                              body.RecordTypeId = updateFields.recordTypeId;
                          }
                          if (updateFields.phone !== undefined) {
                              body.Phone = updateFields.phone;
                          }
                          if (updateFields.title !== undefined) {
                              body.Title = updateFields.title;
                          }
                          if (updateFields.jigsaw !== undefined) {
                              body.Jigsaw = updateFields.jigsaw;
                          }
                          if (updateFields.owner !== undefined) {
                              body.OwnerId = updateFields.owner;
                          }
                          if (updateFields.acconuntId !== undefined) {
                              body.AccountId = updateFields.acconuntId;
                          }
                          if (updateFields.birthdate !== undefined) {
                              body.Birthdate = updateFields.birthdate;
                          }
                          if (updateFields.firstName !== undefined) {
                              body.FirstName = updateFields.firstName;
                          }
                          if (updateFields.homePhone !== undefined) {
                              body.HomePhone = updateFields.homePhone;
                          }
                          if (updateFields.otherCity !== undefined) {
                              body.OtherCity = updateFields.otherCity;
                          }
                          if (updateFields.department !== undefined) {
                              body.Department = updateFields.department;
                          }
                          if (updateFields.leadSource !== undefined) {
                              body.LeadSource = updateFields.leadSource;
                          }
                          if (updateFields.otherPhone !== undefined) {
                              body.OtherPhone = updateFields.otherPhone;
                          }
                          if (updateFields.otherState !== undefined) {
                              body.OtherState = updateFields.otherState;
                          }
                          if (updateFields.salutation !== undefined) {
                              body.Salutation = updateFields.salutation;
                          }
                          if (updateFields.description !== undefined) {
                              body.Description = updateFields.description;
                          }
                          if (updateFields.mailingCity !== undefined) {
                              body.MailingCity = updateFields.mailingCity;
                          }
                          if (updateFields.mobilePhone !== undefined) {
                              body.MobilePhone = updateFields.mobilePhone;
                          }
                          if (updateFields.otherStreet !== undefined) {
                              body.OtherStreet = updateFields.otherStreet;
                          }
                          if (updateFields.mailingState !== undefined) {
                              body.MailingState = updateFields.mailingState;
                          }
                          if (updateFields.otherCountry !== undefined) {
                              body.OtherCountry = updateFields.otherCountry;
                          }
                          if (updateFields.assistantName !== undefined) {
                              body.AssistantName = updateFields.assistantName;
                          }
                          if (updateFields.mailingStreet !== undefined) {
                              body.MailingStreet = updateFields.mailingStreet;
                          }
                          if (updateFields.assistantPhone !== undefined) {
                              body.AssistantPhone = updateFields.assistantPhone;
                          }
                          if (updateFields.mailingCountry !== undefined) {
                              body.MailingCountry = updateFields.mailingCountry;
                          }
                          if (updateFields.otherPostalCode !== undefined) {
                              body.OtherPostalCode = updateFields.otherPostalCode;
                          }
                          if (updateFields.emailBouncedDate !== undefined) {
                              body.EmailBouncedDate = updateFields.emailBouncedDate;
                          }
                          if (updateFields.mailingPostalCode !== undefined) {
                              body.MailingPostalCode = updateFields.mailingPostalCode;
                          }
                          if (updateFields.emailBouncedReason !== undefined) {
                              body.EmailBouncedReason = updateFields.emailBouncedReason;
                          }
                          if (updateFields.customFieldsUi) {
                              const customFields = updateFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/contact/${contactId}`, body);
                      }
                      if (operation === 'get') {
                          const contactId = this.getNodeParameter('contactId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/contact/${contactId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Contact', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Contact', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const contactId = this.getNodeParameter('contactId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/contact/${contactId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getSummary') {
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/contact');
                      }
                      if (operation === 'addToCampaign') {
                          const contactId = this.getNodeParameter('contactId', i);
                          const campaignId = this.getNodeParameter('campaignId', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              ContactId: contactId,
                              CampaignId: campaignId,
                          };
                          if (options.status) {
                              body.Status = options.status;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/CampaignMember', body);
                      }
                      if (operation === 'addNote') {
                          const contactId = this.getNodeParameter('contactId', i);
                          const title = this.getNodeParameter('title', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              Title: title,
                              ParentId: contactId,
                          };
                          if (options.body !== undefined) {
                              body.Body = options.body;
                          }
                          if (options.owner !== undefined) {
                              body.OwnerId = options.owner;
                          }
                          if (options.isPrivate !== undefined) {
                              body.IsPrivate = options.isPrivate;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/note', body);
                      }
                  }
                  if (resource === 'customObject') {
                      if (operation === 'create' || operation === 'upsert') {
                          const customObject = this.getNodeParameter('customObject', i);
                          const customFieldsUi = this.getNodeParameter('customFieldsUi', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {};
                          if (customFieldsUi) {
                              const customFields = customFieldsUi.customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          if (additionalFields.recordTypeId) {
                              body.RecordTypeId = additionalFields.recordTypeId;
                          }
                          let endpoint = `/sobjects/${customObject}`;
                          let method = 'POST';
                          if (operation === 'upsert') {
                              method = 'PATCH';
                              const externalId = this.getNodeParameter('externalId', 0);
                              const externalIdValue = this.getNodeParameter('externalIdValue', i);
                              endpoint = `/sobjects/${customObject}/${externalId}/${externalIdValue}`;
                              if (body[externalId] !== undefined) {
                                  delete body[externalId];
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, method, endpoint, body);
                      }
                      if (operation === 'update') {
                          const recordId = this.getNodeParameter('recordId', i);
                          const customObject = this.getNodeParameter('customObject', i);
                          const customFieldsUi = this.getNodeParameter('customFieldsUi', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (updateFields.recordTypeId) {
                              body.RecordTypeId = updateFields.recordTypeId;
                          }
                          if (customFieldsUi) {
                              const customFields = customFieldsUi.customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/${customObject}/${recordId}`, body);
                      }
                      if (operation === 'get') {
                          const customObject = this.getNodeParameter('customObject', i);
                          const recordId = this.getNodeParameter('recordId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/${customObject}/${recordId}`);
                      }
                      if (operation === 'getAll') {
                          const customObject = this.getNodeParameter('customObject', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, customObject, returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, customObject, returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const customObject = this.getNodeParameter('customObject', i);
                          const recordId = this.getNodeParameter('recordId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/${customObject}/${recordId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                  }
                  if (resource === 'document') {
                      if (operation === 'upload') {
                          const title = this.getNodeParameter('title', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                          const body = {
                              entity_content: {
                                  Title: title,
                                  ContentLocation: 'S',
                              },
                          };
                          if (additionalFields.ownerId) {
                              body.entity_content.ownerId = additionalFields.ownerId;
                          }
                          if (additionalFields.linkToObjectId) {
                              body.entity_content.FirstPublishLocationId =
                                  additionalFields.linkToObjectId;
                          }
                          const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                          const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
                          body.entity_content.PathOnClient = `${title}.${additionalFields.fileExtension || binaryData.fileExtension}`;
                          const data = {
                              entity_content: {
                                  value: JSON.stringify(body.entity_content),
                                  options: {
                                      contentType: 'application/json',
                                  },
                              },
                              VersionData: {
                                  value: dataBuffer,
                                  options: {
                                      filename: body.entity_content.PathOnClient,
                                  },
                              },
                          };
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/ContentVersion', {}, {}, undefined, { formData: data });
                      }
                  }
                  if (resource === 'opportunity') {
                      if (operation === 'create' || operation === 'upsert') {
                          const name = this.getNodeParameter('name', i);
                          const closeDate = this.getNodeParameter('closeDate', i);
                          const stageName = this.getNodeParameter('stageName', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              Name: name,
                              CloseDate: closeDate,
                              StageName: stageName,
                          };
                          if (additionalFields.type !== undefined) {
                              body.Type = additionalFields.type;
                          }
                          if (additionalFields.amount !== undefined) {
                              body.Amount = additionalFields.amount;
                          }
                          if (additionalFields.owner !== undefined) {
                              body.OwnerId = additionalFields.owner;
                          }
                          if (additionalFields.nextStep !== undefined) {
                              body.NextStep = additionalFields.nextStep;
                          }
                          if (additionalFields.accountId !== undefined) {
                              body.AccountId = additionalFields.accountId;
                          }
                          if (additionalFields.campaignId !== undefined) {
                              body.CampaignId = additionalFields.campaignId;
                          }
                          if (additionalFields.leadSource !== undefined) {
                              body.LeadSource = additionalFields.leadSource;
                          }
                          if (additionalFields.description !== undefined) {
                              body.Description = additionalFields.description;
                          }
                          if (additionalFields.probability !== undefined) {
                              body.Probability = additionalFields.probability;
                          }
                          if (additionalFields.pricebook2Id !== undefined) {
                              body.Pricebook2Id = additionalFields.pricebook2Id;
                          }
                          if (additionalFields.forecastCategoryName !== undefined) {
                              body.ForecastCategoryName = additionalFields.forecastCategoryName;
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = additionalFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          let endpoint = '/sobjects/opportunity';
                          let method = 'POST';
                          if (operation === 'upsert') {
                              method = 'PATCH';
                              const externalId = this.getNodeParameter('externalId', 0);
                              const externalIdValue = this.getNodeParameter('externalIdValue', i);
                              endpoint = `/sobjects/opportunity/${externalId}/${externalIdValue}`;
                              if (body[externalId] !== undefined) {
                                  delete body[externalId];
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, method, endpoint, body);
                      }
                      if (operation === 'update') {
                          const opportunityId = this.getNodeParameter('opportunityId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (updateFields.name !== undefined) {
                              body.Name = updateFields.name;
                          }
                          if (updateFields.closeDate !== undefined) {
                              body.CloseDate = updateFields.closeDate;
                          }
                          if (updateFields.stageName !== undefined) {
                              body.StageName = updateFields.stageName;
                          }
                          if (updateFields.type !== undefined) {
                              body.Type = updateFields.type;
                          }
                          if (updateFields.amount !== undefined) {
                              body.Amount = updateFields.amount;
                          }
                          if (updateFields.owner !== undefined) {
                              body.OwnerId = updateFields.owner;
                          }
                          if (updateFields.nextStep !== undefined) {
                              body.NextStep = updateFields.nextStep;
                          }
                          if (updateFields.accountId !== undefined) {
                              body.AccountId = updateFields.accountId;
                          }
                          if (updateFields.campaignId !== undefined) {
                              body.CampaignId = updateFields.campaignId;
                          }
                          if (updateFields.leadSource !== undefined) {
                              body.LeadSource = updateFields.leadSource;
                          }
                          if (updateFields.description !== undefined) {
                              body.Description = updateFields.description;
                          }
                          if (updateFields.probability !== undefined) {
                              body.Probability = updateFields.probability;
                          }
                          if (updateFields.pricebook2Id !== undefined) {
                              body.Pricebook2Id = updateFields.pricebook2Id;
                          }
                          if (updateFields.forecastCategoryName !== undefined) {
                              body.ForecastCategoryName = updateFields.forecastCategoryName;
                          }
                          if (updateFields.customFieldsUi) {
                              const customFields = updateFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/opportunity/${opportunityId}`, body);
                      }
                      if (operation === 'get') {
                          const opportunityId = this.getNodeParameter('opportunityId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/opportunity/${opportunityId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Opportunity', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Opportunity', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const opportunityId = this.getNodeParameter('opportunityId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/opportunity/${opportunityId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getSummary') {
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/opportunity');
                      }
                      if (operation === 'addNote') {
                          const opportunityId = this.getNodeParameter('opportunityId', i);
                          const title = this.getNodeParameter('title', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              Title: title,
                              ParentId: opportunityId,
                          };
                          if (options.body !== undefined) {
                              body.Body = options.body;
                          }
                          if (options.owner !== undefined) {
                              body.OwnerId = options.owner;
                          }
                          if (options.isPrivate !== undefined) {
                              body.IsPrivate = options.isPrivate;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/note', body);
                      }
                  }
                  if (resource === 'account') {
                      if (operation === 'create' || operation === 'upsert') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const name = this.getNodeParameter('name', i);
                          const body = {
                              Name: name,
                          };
                          if (additionalFields.fax !== undefined) {
                              body.Fax = additionalFields.fax;
                          }
                          if (additionalFields.type !== undefined) {
                              body.Type = additionalFields.type;
                          }
                          if (additionalFields.jigsaw !== undefined) {
                              body.Jigsaw = additionalFields.jigsaw;
                          }
                          if (additionalFields.phone !== undefined) {
                              body.Phone = additionalFields.phone;
                          }
                          if (additionalFields.owner !== undefined) {
                              body.OwnerId = additionalFields.owner;
                          }
                          if (additionalFields.sicDesc !== undefined) {
                              body.SicDesc = additionalFields.sicDesc;
                          }
                          if (additionalFields.website !== undefined) {
                              body.Website = additionalFields.website;
                          }
                          if (additionalFields.industry !== undefined) {
                              body.Industry = additionalFields.industry;
                          }
                          if (additionalFields.parentId !== undefined) {
                              body.ParentId = additionalFields.parentId;
                          }
                          if (additionalFields.billingCity !== undefined) {
                              body.BillingCity = additionalFields.billingCity;
                          }
                          if (additionalFields.description !== undefined) {
                              body.Description = additionalFields.description;
                          }
                          if (additionalFields.billingState !== undefined) {
                              body.BillingState = additionalFields.billingState;
                          }
                          if (additionalFields.shippingCity !== undefined) {
                              body.ShippingCity = additionalFields.shippingCity;
                          }
                          if (additionalFields.accountNumber !== undefined) {
                              body.AccountNumber = additionalFields.accountNumber;
                          }
                          if (additionalFields.accountSource !== undefined) {
                              body.AccountSource = additionalFields.accountSource;
                          }
                          if (additionalFields.annualRevenue !== undefined) {
                              body.AnnualRevenue = additionalFields.annualRevenue;
                          }
                          if (additionalFields.billingStreet !== undefined) {
                              body.BillingStreet = additionalFields.billingStreet;
                          }
                          if (additionalFields.shippingState !== undefined) {
                              body.ShippingState = additionalFields.shippingState;
                          }
                          if (additionalFields.billingCountry !== undefined) {
                              body.BillingCountry = additionalFields.billingCountry;
                          }
                          if (additionalFields.shippingStreet !== undefined) {
                              body.ShippingStreet = additionalFields.shippingStreet;
                          }
                          if (additionalFields.shippingCountry !== undefined) {
                              body.ShippingCountry = additionalFields.shippingCountry;
                          }
                          if (additionalFields.billingPostalCode !== undefined) {
                              body.BillingPostalCode = additionalFields.billingPostalCode;
                          }
                          if (additionalFields.numberOfEmployees !== undefined) {
                              body.NumberOfEmployees = additionalFields.numberOfEmployees;
                          }
                          if (additionalFields.shippingPostalCode !== undefined) {
                              body.ShippingPostalCode = additionalFields.shippingPostalCode;
                          }
                          if (additionalFields.shippingPostalCode !== undefined) {
                              body.ShippingPostalCode = additionalFields.shippingPostalCode;
                          }
                          if (additionalFields.recordTypeId !== undefined) {
                              body.RecordTypeId = additionalFields.recordTypeId;
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = additionalFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          let endpoint = '/sobjects/account';
                          let method = 'POST';
                          if (operation === 'upsert') {
                              method = 'PATCH';
                              const externalId = this.getNodeParameter('externalId', 0);
                              const externalIdValue = this.getNodeParameter('externalIdValue', i);
                              endpoint = `/sobjects/account/${externalId}/${externalIdValue}`;
                              if (body[externalId] !== undefined) {
                                  delete body[externalId];
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, method, endpoint, body);
                      }
                      if (operation === 'update') {
                          const accountId = this.getNodeParameter('accountId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (updateFields.name !== undefined) {
                              body.Name = updateFields.name;
                          }
                          if (updateFields.fax !== undefined) {
                              body.Fax = updateFields.fax;
                          }
                          if (updateFields.type !== undefined) {
                              body.Type = updateFields.type;
                          }
                          if (updateFields.jigsaw !== undefined) {
                              body.Jigsaw = updateFields.jigsaw;
                          }
                          if (updateFields.phone !== undefined) {
                              body.Phone = updateFields.phone;
                          }
                          if (updateFields.ownerId !== undefined) {
                              body.OwnerId = updateFields.ownerId;
                          }
                          if (updateFields.sicDesc !== undefined) {
                              body.SicDesc = updateFields.sicDesc;
                          }
                          if (updateFields.recordTypeId !== undefined) {
                              body.RecordTypeId = updateFields.recordTypeId;
                          }
                          if (updateFields.website !== undefined) {
                              body.Website = updateFields.website;
                          }
                          if (updateFields.industry !== undefined) {
                              body.Industry = updateFields.industry;
                          }
                          if (updateFields.parentId !== undefined) {
                              body.ParentId = updateFields.parentId;
                          }
                          if (updateFields.billingCity !== undefined) {
                              body.BillingCity = updateFields.billingCity;
                          }
                          if (updateFields.description !== undefined) {
                              body.Description = updateFields.description;
                          }
                          if (updateFields.billingState !== undefined) {
                              body.BillingState = updateFields.billingState;
                          }
                          if (updateFields.shippingCity !== undefined) {
                              body.ShippingCity = updateFields.shippingCity;
                          }
                          if (updateFields.accountNumber !== undefined) {
                              body.AccountNumber = updateFields.accountNumber;
                          }
                          if (updateFields.accountSource !== undefined) {
                              body.AccountSource = updateFields.accountSource;
                          }
                          if (updateFields.annualRevenue !== undefined) {
                              body.AnnualRevenue = updateFields.annualRevenue;
                          }
                          if (updateFields.billingStreet !== undefined) {
                              body.BillingStreet = updateFields.billingStreet;
                          }
                          if (updateFields.shippingState !== undefined) {
                              body.ShippingState = updateFields.shippingState;
                          }
                          if (updateFields.billingCountry !== undefined) {
                              body.BillingCountry = updateFields.billingCountry;
                          }
                          if (updateFields.shippingStreet !== undefined) {
                              body.ShippingStreet = updateFields.shippingStreet;
                          }
                          if (updateFields.shippingCountry !== undefined) {
                              body.ShippingCountry = updateFields.shippingCountry;
                          }
                          if (updateFields.billingPostalCode !== undefined) {
                              body.BillingPostalCode = updateFields.billingPostalCode;
                          }
                          if (updateFields.numberOfEmployees !== undefined) {
                              body.NumberOfEmployees = updateFields.numberOfEmployees;
                          }
                          if (updateFields.shippingPostalCode !== undefined) {
                              body.ShippingPostalCode = updateFields.shippingPostalCode;
                          }
                          if (updateFields.shippingPostalCode !== undefined) {
                              body.ShippingPostalCode = updateFields.shippingPostalCode;
                          }
                          if (updateFields.customFieldsUi) {
                              const customFields = updateFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/account/${accountId}`, body);
                      }
                      if (operation === 'get') {
                          const accountId = this.getNodeParameter('accountId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/account/${accountId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Account', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Account', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const accountId = this.getNodeParameter('accountId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/account/${accountId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getSummary') {
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/account');
                      }
                      if (operation === 'addNote') {
                          const accountId = this.getNodeParameter('accountId', i);
                          const title = this.getNodeParameter('title', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              Title: title,
                              ParentId: accountId,
                          };
                          if (options.body !== undefined) {
                              body.Body = options.body;
                          }
                          if (options.owner !== undefined) {
                              body.OwnerId = options.owner;
                          }
                          if (options.isPrivate !== undefined) {
                              body.IsPrivate = options.isPrivate;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/note', body);
                      }
                  }
                  if (resource === 'case') {
                      if (operation === 'create') {
                          const type = this.getNodeParameter('type', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              Type: type,
                          };
                          if (additionalFields.origin !== undefined) {
                              body.Origin = additionalFields.origin;
                          }
                          if (additionalFields.reason !== undefined) {
                              body.Reason = additionalFields.reason;
                          }
                          if (additionalFields.status !== undefined) {
                              body.Status = additionalFields.status;
                          }
                          if (additionalFields.owner !== undefined) {
                              body.OwnerId = additionalFields.owner;
                          }
                          if (additionalFields.subject !== undefined) {
                              body.Subject = additionalFields.subject;
                          }
                          if (additionalFields.parentId !== undefined) {
                              body.ParentId = additionalFields.parentId;
                          }
                          if (additionalFields.priority !== undefined) {
                              body.Priority = additionalFields.priority;
                          }
                          if (additionalFields.accountId !== undefined) {
                              body.AccountId = additionalFields.accountId;
                          }
                          if (additionalFields.contactId !== undefined) {
                              body.ContactId = additionalFields.contactId;
                          }
                          if (additionalFields.description !== undefined) {
                              body.Description = additionalFields.description;
                          }
                          if (additionalFields.isEscalated !== undefined) {
                              body.IsEscalated = additionalFields.isEscalated;
                          }
                          if (additionalFields.suppliedName !== undefined) {
                              body.SuppliedName = additionalFields.suppliedName;
                          }
                          if (additionalFields.suppliedEmail !== undefined) {
                              body.SuppliedEmail = additionalFields.suppliedEmail;
                          }
                          if (additionalFields.suppliedPhone !== undefined) {
                              body.SuppliedPhone = additionalFields.suppliedPhone;
                          }
                          if (additionalFields.suppliedCompany !== undefined) {
                              body.SuppliedCompany = additionalFields.suppliedCompany;
                          }
                          if (additionalFields.recordTypeId !== undefined) {
                              body.RecordTypeId = additionalFields.recordTypeId;
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = additionalFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/case', body);
                      }
                      if (operation === 'update') {
                          const caseId = this.getNodeParameter('caseId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (updateFields.type !== undefined) {
                              body.Type = updateFields.type;
                          }
                          if (updateFields.origin !== undefined) {
                              body.Origin = updateFields.origin;
                          }
                          if (updateFields.reason !== undefined) {
                              body.Reason = updateFields.reason;
                          }
                          if (updateFields.status !== undefined) {
                              body.Status = updateFields.status;
                          }
                          if (updateFields.owner !== undefined) {
                              body.OwnerId = updateFields.owner;
                          }
                          if (updateFields.subject !== undefined) {
                              body.Subject = updateFields.subject;
                          }
                          if (updateFields.parentId !== undefined) {
                              body.ParentId = updateFields.parentId;
                          }
                          if (updateFields.priority !== undefined) {
                              body.Priority = updateFields.priority;
                          }
                          if (updateFields.accountId !== undefined) {
                              body.AccountId = updateFields.accountId;
                          }
                          if (updateFields.recordTypeId !== undefined) {
                              body.RecordTypeId = updateFields.recordTypeId;
                          }
                          if (updateFields.contactId !== undefined) {
                              body.ContactId = updateFields.contactId;
                          }
                          if (updateFields.description !== undefined) {
                              body.Description = updateFields.description;
                          }
                          if (updateFields.isEscalated !== undefined) {
                              body.IsEscalated = updateFields.isEscalated;
                          }
                          if (updateFields.suppliedName !== undefined) {
                              body.SuppliedName = updateFields.suppliedName;
                          }
                          if (updateFields.suppliedEmail !== undefined) {
                              body.SuppliedEmail = updateFields.suppliedEmail;
                          }
                          if (updateFields.suppliedPhone !== undefined) {
                              body.SuppliedPhone = updateFields.suppliedPhone;
                          }
                          if (updateFields.suppliedCompany !== undefined) {
                              body.SuppliedCompany = updateFields.suppliedCompany;
                          }
                          if (updateFields.customFieldsUi) {
                              const customFields = updateFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/case/${caseId}`, body);
                      }
                      if (operation === 'get') {
                          const caseId = this.getNodeParameter('caseId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/case/${caseId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Case', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Case', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const caseId = this.getNodeParameter('caseId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/case/${caseId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getSummary') {
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/case');
                      }
                      if (operation === 'addComment') {
                          const caseId = this.getNodeParameter('caseId', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              ParentId: caseId,
                          };
                          if (options.commentBody !== undefined) {
                              body.CommentBody = options.commentBody;
                          }
                          if (options.isPublished !== undefined) {
                              body.IsPublished = options.isPublished;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/casecomment', body);
                      }
                  }
                  if (resource === 'task') {
                      if (operation === 'create') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const status = this.getNodeParameter('status', i);
                          const body = {
                              Status: status,
                          };
                          if (additionalFields.type !== undefined) {
                              body.TaskSubtype = additionalFields.type;
                          }
                          if (additionalFields.whoId !== undefined) {
                              body.WhoId = additionalFields.whoId;
                          }
                          if (additionalFields.whatId !== undefined) {
                              body.WhatId = additionalFields.whatId;
                          }
                          if (additionalFields.owner !== undefined) {
                              body.OwnerId = additionalFields.owner;
                          }
                          if (additionalFields.subject !== undefined) {
                              body.Subject = additionalFields.subject;
                          }
                          if (additionalFields.callType !== undefined) {
                              body.CallType = additionalFields.callType;
                          }
                          if (additionalFields.priority !== undefined) {
                              body.Priority = additionalFields.priority;
                          }
                          if (additionalFields.callObject !== undefined) {
                              body.CallObject = additionalFields.callObject;
                          }
                          if (additionalFields.description !== undefined) {
                              body.Description = additionalFields.description;
                          }
                          if (additionalFields.activityDate !== undefined) {
                              body.ActivityDate = additionalFields.activityDate;
                          }
                          if (additionalFields.isReminderSet !== undefined) {
                              body.IsReminderSet = additionalFields.isReminderSet;
                          }
                          if (additionalFields.recurrenceType !== undefined) {
                              body.RecurrenceType = additionalFields.recurrenceType;
                          }
                          if (additionalFields.callDisposition !== undefined) {
                              body.CallDisposition = additionalFields.callDisposition;
                          }
                          if (additionalFields.reminderDateTime !== undefined) {
                              body.ReminderDateTime = additionalFields.reminderDateTime;
                          }
                          if (additionalFields.recurrenceInstance !== undefined) {
                              body.RecurrenceInstance = additionalFields.recurrenceInstance;
                          }
                          if (additionalFields.recurrenceInterval !== undefined) {
                              body.RecurrenceInterval = additionalFields.recurrenceInterval;
                          }
                          if (additionalFields.recurrenceDayOfMonth !== undefined) {
                              body.RecurrenceDayOfMonth = additionalFields.recurrenceDayOfMonth;
                          }
                          if (additionalFields.callDurationInSeconds !== undefined) {
                              body.CallDurationInSeconds = additionalFields.callDurationInSeconds;
                          }
                          if (additionalFields.recurrenceEndDateOnly !== undefined) {
                              body.RecurrenceEndDateOnly = additionalFields.recurrenceEndDateOnly;
                          }
                          if (additionalFields.recurrenceMonthOfYear !== undefined) {
                              body.RecurrenceMonthOfYear = additionalFields.recurrenceMonthOfYear;
                          }
                          if (additionalFields.recurrenceDayOfWeekMask !== undefined) {
                              body.RecurrenceDayOfWeekMask = additionalFields.recurrenceDayOfWeekMask;
                          }
                          if (additionalFields.recurrenceStartDateOnly !== undefined) {
                              body.RecurrenceStartDateOnly = additionalFields.recurrenceStartDateOnly;
                          }
                          if (additionalFields.recurrenceTimeZoneSidKey !== undefined) {
                              body.RecurrenceTimeZoneSidKey = additionalFields.recurrenceTimeZoneSidKey;
                          }
                          if (additionalFields.recurrenceRegeneratedType !== undefined) {
                              body.RecurrenceRegeneratedType = additionalFields.recurrenceRegeneratedType;
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = additionalFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/task', body);
                      }
                      if (operation === 'update') {
                          const taskId = this.getNodeParameter('taskId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (updateFields.type !== undefined) {
                              body.TaskSubtype = updateFields.type;
                          }
                          if (updateFields.whoId !== undefined) {
                              body.WhoId = updateFields.whoId;
                          }
                          if (updateFields.status !== undefined) {
                              body.Status = updateFields.status;
                          }
                          if (updateFields.whatId !== undefined) {
                              body.WhatId = updateFields.whatId;
                          }
                          if (updateFields.owner !== undefined) {
                              body.OwnerId = updateFields.owner;
                          }
                          if (updateFields.subject !== undefined) {
                              body.Subject = updateFields.subject;
                          }
                          if (updateFields.callType !== undefined) {
                              body.CallType = updateFields.callType;
                          }
                          if (updateFields.priority !== undefined) {
                              body.Priority = updateFields.priority;
                          }
                          if (updateFields.callObject !== undefined) {
                              body.CallObject = updateFields.callObject;
                          }
                          if (updateFields.description !== undefined) {
                              body.Description = updateFields.description;
                          }
                          if (updateFields.activityDate !== undefined) {
                              body.ActivityDate = updateFields.activityDate;
                          }
                          if (updateFields.isReminderSet !== undefined) {
                              body.IsReminderSet = updateFields.isReminderSet;
                          }
                          if (updateFields.recurrenceType !== undefined) {
                              body.RecurrenceType = updateFields.recurrenceType;
                          }
                          if (updateFields.callDisposition !== undefined) {
                              body.CallDisposition = updateFields.callDisposition;
                          }
                          if (updateFields.reminderDateTime !== undefined) {
                              body.ReminderDateTime = updateFields.reminderDateTime;
                          }
                          if (updateFields.recurrenceInstance !== undefined) {
                              body.RecurrenceInstance = updateFields.recurrenceInstance;
                          }
                          if (updateFields.recurrenceInterval !== undefined) {
                              body.RecurrenceInterval = updateFields.recurrenceInterval;
                          }
                          if (updateFields.recurrenceDayOfMonth !== undefined) {
                              body.RecurrenceDayOfMonth = updateFields.recurrenceDayOfMonth;
                          }
                          if (updateFields.callDurationInSeconds !== undefined) {
                              body.CallDurationInSeconds = updateFields.callDurationInSeconds;
                          }
                          if (updateFields.recurrenceEndDateOnly !== undefined) {
                              body.RecurrenceEndDateOnly = updateFields.recurrenceEndDateOnly;
                          }
                          if (updateFields.recurrenceMonthOfYear !== undefined) {
                              body.RecurrenceMonthOfYear = updateFields.recurrenceMonthOfYear;
                          }
                          if (updateFields.recurrenceDayOfWeekMask !== undefined) {
                              body.RecurrenceDayOfWeekMask = updateFields.recurrenceDayOfWeekMask;
                          }
                          if (updateFields.recurrenceStartDateOnly !== undefined) {
                              body.RecurrenceStartDateOnly = updateFields.recurrenceStartDateOnly;
                          }
                          if (updateFields.recurrenceTimeZoneSidKey !== undefined) {
                              body.RecurrenceTimeZoneSidKey = updateFields.recurrenceTimeZoneSidKey;
                          }
                          if (updateFields.recurrenceRegeneratedType !== undefined) {
                              body.RecurrenceRegeneratedType = updateFields.recurrenceRegeneratedType;
                          }
                          if (updateFields.customFieldsUi) {
                              const customFields = updateFields.customFieldsUi
                                  .customFieldsValues;
                              if (customFields) {
                                  for (const customField of customFields) {
                                      body[customField.fieldId] = customField.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/task/${taskId}`, body);
                      }
                      if (operation === 'get') {
                          const taskId = this.getNodeParameter('taskId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/task/${taskId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Task', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Task', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const taskId = this.getNodeParameter('taskId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/task/${taskId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getSummary') {
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/task');
                      }
                  }
                  if (resource === 'attachment') {
                      if (operation === 'create') {
                          const name = this.getNodeParameter('name', i);
                          const parentId = this.getNodeParameter('parentId', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                          const body = {
                              Name: name,
                              ParentId: parentId,
                          };
                          if (items[i].binary && items[i].binary[binaryPropertyName]) {
                              body.Body = items[i].binary[binaryPropertyName].data;
                              body.ContentType = items[i].binary[binaryPropertyName].mimeType;
                          }
                          else {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The property ${binaryPropertyName} does not exist`, { itemIndex: i });
                          }
                          if (additionalFields.description !== undefined) {
                              body.Description = additionalFields.description;
                          }
                          if (additionalFields.owner !== undefined) {
                              body.OwnerId = additionalFields.owner;
                          }
                          if (additionalFields.isPrivate !== undefined) {
                              body.IsPrivate = additionalFields.isPrivate;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', '/sobjects/attachment', body);
                      }
                      if (operation === 'update') {
                          const attachmentId = this.getNodeParameter('attachmentId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (updateFields.binaryPropertyName !== undefined) {
                              const binaryPropertyName = updateFields.binaryPropertyName;
                              if (items[i].binary && items[i].binary[binaryPropertyName]) {
                                  body.Body = items[i].binary[binaryPropertyName].data;
                                  body.ContentType = items[i].binary[binaryPropertyName].mimeType;
                              }
                              else {
                                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The property ${binaryPropertyName} does not exist`, { itemIndex: i });
                              }
                          }
                          if (updateFields.name !== undefined) {
                              body.Name = updateFields.name;
                          }
                          if (updateFields.description !== undefined) {
                              body.Description = updateFields.description;
                          }
                          if (updateFields.owner !== undefined) {
                              body.OwnerId = updateFields.owner;
                          }
                          if (updateFields.isPrivate !== undefined) {
                              body.IsPrivate = updateFields.isPrivate;
                          }
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'PATCH', `/sobjects/attachment/${attachmentId}`, body);
                      }
                      if (operation === 'get') {
                          const attachmentId = this.getNodeParameter('attachmentId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/attachment/${attachmentId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Attachment', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'Attachment', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const attachmentId = this.getNodeParameter('attachmentId', i);
                          try {
                              responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'DELETE', `/sobjects/attachment/${attachmentId}`);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getSummary') {
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/sobjects/attachment');
                      }
                  }
                  if (resource === 'user') {
                      if (operation === 'get') {
                          const userId = this.getNodeParameter('userId', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', `/sobjects/user/${userId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          try {
                              if (returnAll) {
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'User', returnAll);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.q = (0, GenericFunctions_1.getQuery)(options, 'User', returnAll, limit);
                                  responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                  }
                  if (resource === 'flow') {
                      if (operation === 'invoke') {
                          const apiName = this.getNodeParameter('apiName', i);
                          const jsonParameters = this.getNodeParameter('jsonParameters', i);
                          let variables = {};
                          if (jsonParameters) {
                              variables = this.getNodeParameter('variablesJson', i);
                          }
                          else {
                              const setInputVariable = this.getNodeParameter('variablesUi', i, {});
                              if (setInputVariable.variablesValues !== undefined) {
                                  for (const inputVariableData of setInputVariable.variablesValues) {
                                      variables[inputVariableData.name] = inputVariableData.value;
                                  }
                              }
                          }
                          const body = {
                              inputs: [variables],
                          };
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'POST', `/actions/custom/flow/${apiName}`, body);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          responseData = await GenericFunctions_1.salesforceApiRequest.call(this, 'GET', '/actions/custom/flow');
                          responseData = responseData.actions;
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.splice(0, limit);
                          }
                      }
                  }
                  if (resource === 'search') {
                      if (operation === 'query') {
                          qs.q = this.getNodeParameter('query', i);
                          responseData = await GenericFunctions_1.salesforceApiRequestAllItems.call(this, 'records', 'GET', '/query', {}, qs);
                      }
                  }
                  if (!Array.isArray(responseData) && responseData === undefined) {
                      responseData = {
                          errors: [],
                          success: true,
                      };
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                  returnData.push(...executionData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionErrorData);
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.Salesforce = Salesforce;
  //# sourceMappingURL=Salesforce.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SalesforceOAuth2Api = void 0;
  class SalesforceOAuth2Api {
      constructor() {
          this.name = 'salesforceOAuth2Api';
          this.extends = ['oAuth2Api'];
          this.displayName = 'Salesforce OAuth2 API';
          this.documentationUrl = 'salesforce';
          this.properties = [
              {
                  displayName: 'Environment Type',
                  name: 'environment',
                  type: 'options',
                  options: [
                      {
                          name: 'Production',
                          value: 'production',
                      },
                      {
                          name: 'Sandbox',
                          value: 'sandbox',
                      },
                  ],
                  default: 'production',
              },
              {
                  displayName: 'Grant Type',
                  name: 'grantType',
                  type: 'hidden',
                  default: 'authorizationCode',
              },
              {
                  displayName: 'Authorization URL',
                  name: 'authUrl',
                  type: 'hidden',
                  required: true,
                  default: '={{ $self["environment"] === "sandbox" ? "https://test.salesforce.com/services/oauth2/authorize" : "https://login.salesforce.com/services/oauth2/authorize" }}',
              },
              {
                  displayName: 'Access Token URL',
                  name: 'accessTokenUrl',
                  type: 'hidden',
                  required: true,
                  default: '={{ $self["environment"] === "sandbox" ? "https://test.salesforce.com/services/oauth2/token" : "https://login.salesforce.com/services/oauth2/token" }}',
              },
              {
                  displayName: 'Scope',
                  name: 'scope',
                  type: 'hidden',
                  default: 'full refresh_token',
              },
              {
                  displayName: 'Auth URI Query Parameters',
                  name: 'authQueryParameters',
                  type: 'hidden',
                  default: '',
              },
              {
                  displayName: 'Authentication',
                  name: 'authentication',
                  type: 'hidden',
                  default: 'header',
              },
          ];
      }
  }
  exports.SalesforceOAuth2Api = SalesforceOAuth2Api;
  //# sourceMappingURL=SalesforceOAuth2Api.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SalesforceOAuth2Api = void 0;
  class SalesforceOAuth2Api {
      constructor() {
          this.name = 'salesforceOAuth2Api';
          this.extends = ['oAuth2Api'];
          this.displayName = 'Salesforce OAuth2 API';
          this.documentationUrl = 'salesforce';
          this.properties = [
              {
                  displayName: 'Environment Type',
                  name: 'environment',
                  type: 'options',
                  options: [
                      {
                          name: 'Production',
                          value: 'production',
                      },
                      {
                          name: 'Sandbox',
                          value: 'sandbox',
                      },
                  ],
                  default: 'production',
              },
              {
                  displayName: 'Grant Type',
                  name: 'grantType',
                  type: 'hidden',
                  default: 'authorizationCode',
              },
              {
                  displayName: 'Authorization URL',
                  name: 'authUrl',
                  type: 'hidden',
                  required: true,
                  default: '={{ $self["environment"] === "sandbox" ? "https://test.salesforce.com/services/oauth2/authorize" : "https://login.salesforce.com/services/oauth2/authorize" }}',
              },
              {
                  displayName: 'Access Token URL',
                  name: 'accessTokenUrl',
                  type: 'hidden',
                  required: true,
                  default: '={{ $self["environment"] === "sandbox" ? "https://test.salesforce.com/services/oauth2/token" : "https://login.salesforce.com/services/oauth2/token" }}',
              },
              {
                  displayName: 'Scope',
                  name: 'scope',
                  type: 'hidden',
                  default: 'full refresh_token',
              },
              {
                  displayName: 'Auth URI Query Parameters',
                  name: 'authQueryParameters',
                  type: 'hidden',
                  default: '',
              },
              {
                  displayName: 'Authentication',
                  name: 'authentication',
                  type: 'hidden',
                  default: 'header',
              },
          ];
      }
  }
  exports.SalesforceOAuth2Api = SalesforceOAuth2Api;
  //# sourceMappingURL=SalesforceOAuth2Api.credentials.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: Salesforce node documentation
  description: Learn how to use the Salesforce node in n8n. Follow technical documentation to integrate Salesforce node into your workflows.
  contentType: [integration, reference]
  priority: medium
  ---

  # Salesforce node

  Use the Salesforce node to automate work in Salesforce, and integrate Salesforce with other applications. n8n has built-in support for a wide range of Salesforce features, including creating, updating, deleting, and getting accounts, attachments, cases, and leads, as well as uploading documents. 

  On this page, you'll find a list of operations the Salesforce node supports and links to more resources.

  /// note | Credentials
  Refer to [Salesforce credentials](/integrations/builtin/credentials/salesforce.md) for guidance on setting up authentication. 
  ///

  --8<-- "_snippets/integrations/builtin/app-nodes/ai-tools.md"

  ## Operations

  * Account
      * Add note to an account
      * Create an account
      * Create a new account, or update the current one if it already exists (upsert)
      * Get an account
      * Get all accounts
      * Returns an overview of account's metadata.
      * Delete an account
      * Update an account
  * Attachment
      * Create a attachment
      * Delete a attachment
      * Get a attachment
      * Get all attachments
      * Returns an overview of attachment's metadata.
      * Update a attachment
  * Case
      * Add a comment to a case
      * Create a case
      * Get a case
      * Get all cases
      * Returns an overview of case's metadata
      * Delete a case
      * Update a case
  * Contact
      * Add lead to a campaign
      * Add note to a contact
      * Create a contact
      * Create a new contact, or update the current one if it already exists (upsert)
      * Delete a contact
      * Get a contact
      * Returns an overview of contact's metadata
      * Get all contacts
      * Update a contact
  * Custom Object
      * Create a custom object record
      * Create a new record, or update the current one if it already exists (upsert)
      * Get a custom object record
      * Get all custom object records
      * Delete a custom object record
      * Update a custom object record
  * Document
      * Upload a document
  * Flow
      * Get all flows
      * Invoke a flow
  * Lead
      * Add lead to a campaign
      * Add note to a lead
      * Create a lead
      * Create a new lead, or update the current one if it already exists (upsert)
      * Delete a lead
      * Get a lead
      * Get all leads
      * Returns an overview of Lead's metadata
      * Update a lead
  * Opportunity
      * Add note to an opportunity
      * Create an opportunity
      * Create a new opportunity, or update the current one if it already exists (upsert)
      * Delete an opportunity
      * Get an opportunity
      * Get all opportunities
      * Returns an overview of opportunity's metadata
      * Update an opportunity
  * Search
      * Execute a SOQL query that returns all the results in a single response
  * Task
      * Create a task
      * Delete a task
      * Get a task
      * Get all tasks
      * Returns an overview of task's metadata
      * Update a task
  * User
      * Get a user
      * Get all users

  ## Templates and examples

  <!-- see https://www.notion.so/n8n/Pull-in-templates-for-the-integrations-pages-37c716837b804d30a33b47475f6e3780 -->
  [[ templatesWidget(page.title, 'salesforce') ]]

  --8<-- "_snippets/integrations/builtin/app-nodes/operation-not-supported.md"

  ## Working with Salesforce custom fields

  To add custom fields to your request:

  1. Select **Additional Fields** > **Add Field**.
  2. In the dropdown, select **Custom Fields**.

  You can then find and add your custom fields.

troubleshooting_info:
  [{"issue":"Working with Salesforce custom fields","solution":"To add custom fields to your request:"}]

example_workflow:
  {"name":"Salesforce Example Workflow","nodes":[{"parameters":{"authentication":"oAuth2","resource":"account","dynamic_property":null},"id":"2y4irwhxw5f6m6nnkhpi0w","name":"Salesforce","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"Authentication","name":"authentication","type":"options","default":"oAuth2","description":"OAuth Authorization Flow","options":[{"name":"OAuth2","value":"oAuth2"},{"name":"OAuth2 JWT","value":"jwt"}]},{"displayName":"Resource","name":"resource","type":"options","default":"lead","description":"Represents an individual account, which is an organization or person involved with your business (such as customers, competitors, and partners)","options":[{"name":"Account","value":"account","description":"Represents an individual account, which is an organization or person involved with your business (such as customers, competitors, and partners)"},{"name":"Attachment","value":"attachment","description":"Represents a file that a has uploaded and attached to a parent object"},{"name":"Case","value":"case","description":"Represents a case, which is a customer issue or problem"},{"name":"Contact","value":"contact","description":"Represents a contact, which is an individual associated with an account"},{"name":"Custom Object","value":"customObject","description":"Represents a custom object"},{"name":"Document","value":"document","description":"Represents a document"},{"name":"Flow","value":"flow","description":"Represents an autolaunched flow"},{"name":"Lead","value":"lead","description":"Represents a prospect or potential"},{"name":"Opportunity","value":"opportunity","description":"Represents an opportunity, which is a sale or pending deal"},{"name":"Search","value":"search","description":"Search records"},{"name":"Task","value":"task","description":"Represents a business activity such as making a phone call or other to-do items. In the user interface, and records are collectively referred to as activities."},{"name":"User","value":"user","description":"Represents a person, which is one user in system"}]},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...LeadDescription_1.leadOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...LeadDescription_1.leadFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...ContactDescription_1.contactOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...ContactDescription_1.contactFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...CustomObjectDescription_1.customObjectOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...CustomObjectDescription_1.customObjectFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...DocumentDescription_1.documentOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...DocumentDescription_1.documentFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...OpportunityDescription_1.opportunityOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...OpportunityDescription_1.opportunityFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...AccountDescription_1.accountOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...AccountDescription_1.accountFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...SearchDescription_1.searchOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...SearchDescription_1.searchFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...CaseDescription_1.caseOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...CaseDescription_1.caseFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...TaskDescription_1.taskOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...TaskDescription_1.taskFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...AttachmentDescription_1.attachmentOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...AttachmentDescription_1.attachmentFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...UserDescription_1.userOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...UserDescription_1.userFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...FlowDescription_1.flowOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...FlowDescription_1.flowFields"}]


node_type: n8n-nodes-base.SeaTable
name: SeaTable
display_name: SeaTable
description: Consume the SeaTable API
category: input
icon: file:seaTable.svg
code_hash: 2838fa6931fb12f6c56a751f7251d2eed63f2f2160f055204f3a37ef31dd043a
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.SeaTable
documentation_title: SeaTable node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"seatable","description":"Templates for seatable"}]
related_resources: []
required_scopes: []
parameter_schemas: []
troubleshooting_info: []
example_parameters: {"resource":"row","dynamic_property":null}
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:59:11
updated_at: 2025-06-12 08:59:11
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SeaTable = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const RowDescription_1 = require("./RowDescription");
  class SeaTable {
      constructor() {
          this.description = {
              displayName: 'SeaTable',
              name: 'seaTable',
              icon: 'file:seaTable.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
              description: 'Consume the SeaTable API',
              defaults: {
                  name: 'SeaTable',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'seaTableApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Row',
                              value: 'row',
                          },
                      ],
                      default: 'row',
                  },
                  ...RowDescription_1.rowOperations,
                  ...RowDescription_1.rowFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getTableNames() {
                      const returnData = [];
                      const { metadata: { tables }, } = await GenericFunctions_1.seaTableApiRequest.call(this, {}, 'GET', '/dtable-server/api/v1/dtables/{{dtable_uuid}}/metadata');
                      for (const table of tables) {
                          returnData.push({
                              name: table.name,
                              value: table.name,
                          });
                      }
                      return returnData;
                  },
                  async getTableIds() {
                      const returnData = [];
                      const { metadata: { tables }, } = await GenericFunctions_1.seaTableApiRequest.call(this, {}, 'GET', '/dtable-server/api/v1/dtables/{{dtable_uuid}}/metadata');
                      for (const table of tables) {
                          returnData.push({
                              name: table.name,
                              value: table._id,
                          });
                      }
                      return returnData;
                  },
                  async getTableUpdateAbleColumns() {
                      const tableName = this.getNodeParameter('tableName');
                      const columns = await GenericFunctions_1.getTableColumns.call(this, tableName);
                      return columns
                          .filter((column) => column.editable)
                          .map((column) => ({ name: column.name, value: column.name }));
                  },
                  async getAllSortableColumns() {
                      const tableName = this.getNodeParameter('tableName');
                      const columns = await GenericFunctions_1.getTableColumns.call(this, tableName);
                      return columns
                          .filter((column) => !['file', 'image', 'url', 'collaborator', 'long-text'].includes(column.type))
                          .map((column) => ({ name: column.name, value: column.name }));
                  },
                  async getViews() {
                      const tableName = this.getNodeParameter('tableName');
                      const views = await GenericFunctions_1.getTableViews.call(this, tableName);
                      return views.map((view) => ({ name: view.name, value: view.name }));
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          const body = {};
          const qs = {};
          const ctx = {};
          if (resource === 'row') {
              if (operation === 'create') {
                  const tableName = this.getNodeParameter('tableName', 0);
                  const tableColumns = await GenericFunctions_1.getTableColumns.call(this, tableName);
                  body.table_name = tableName;
                  const fieldsToSend = this.getNodeParameter('fieldsToSend', 0);
                  let rowInput = {};
                  for (let i = 0; i < items.length; i++) {
                      rowInput = {};
                      try {
                          if (fieldsToSend === 'autoMapInputData') {
                              const incomingKeys = Object.keys(items[i].json);
                              const inputDataToIgnore = (0, GenericFunctions_1.split)(this.getNodeParameter('inputsToIgnore', i, ''));
                              for (const key of incomingKeys) {
                                  if (inputDataToIgnore.includes(key))
                                      continue;
                                  rowInput[key] = items[i].json[key];
                              }
                          }
                          else {
                              const columns = this.getNodeParameter('columnsUi.columnValues', i, []);
                              for (const column of columns) {
                                  rowInput[column.columnName] = column.columnValue;
                              }
                          }
                          body.row = (0, GenericFunctions_1.rowExport)(rowInput, (0, GenericFunctions_1.updateAble)(tableColumns));
                          responseData = await GenericFunctions_1.seaTableApiRequest.call(this, ctx, 'POST', '/dtable-server/api/v1/dtables/{{dtable_uuid}}/rows/', body);
                          const { _id: insertId } = responseData;
                          if (insertId === undefined) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'SeaTable: No identity after appending row.', { itemIndex: i });
                          }
                          const newRowInsertData = (0, GenericFunctions_1.rowMapKeyToName)(responseData, tableColumns);
                          qs.table_name = tableName;
                          qs.convert = true;
                          const newRow = await GenericFunctions_1.seaTableApiRequest.call(this, ctx, 'GET', `/dtable-server/api/v1/dtables/{{dtable_uuid}}/rows/${encodeURIComponent(insertId)}/`, body, qs);
                          if (newRow._id === undefined) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'SeaTable: No identity for appended row.', { itemIndex: i });
                          }
                          const row = (0, GenericFunctions_1.rowFormatColumns)({ ...newRowInsertData, ...newRow }, tableColumns.map(({ name }) => name).concat(['_id', '_ctime', '_mtime']));
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(row), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                              returnData.push(...executionErrorData);
                              continue;
                          }
                          throw error;
                      }
                  }
              }
              else if (operation === 'get') {
                  for (let i = 0; i < items.length; i++) {
                      try {
                          const tableId = this.getNodeParameter('tableId', 0);
                          const rowId = this.getNodeParameter('rowId', i);
                          const response = (await GenericFunctions_1.seaTableApiRequest.call(this, ctx, 'GET', `/dtable-server/api/v1/dtables/{{dtable_uuid}}/rows/${rowId}`, {}, { table_id: tableId, convert: true }));
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(response), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                              returnData.push(...executionErrorData);
                              continue;
                          }
                          throw error;
                      }
                  }
              }
              else if (operation === 'getAll') {
                  const tableName = this.getNodeParameter('tableName', 0);
                  const tableColumns = await GenericFunctions_1.getTableColumns.call(this, tableName);
                  for (let i = 0; i < items.length; i++) {
                      try {
                          const endpoint = '/dtable-server/api/v1/dtables/{{dtable_uuid}}/rows/';
                          qs.table_name = tableName;
                          const filters = this.getNodeParameter('filters', i);
                          const options = this.getNodeParameter('options', i);
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          Object.assign(qs, filters, options);
                          if (qs.convert_link_id === false) {
                              delete qs.convert_link_id;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.setableApiRequestAllItems.call(this, ctx, 'rows', 'GET', endpoint, body, qs);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.seaTableApiRequest.call(this, ctx, 'GET', endpoint, body, qs);
                              responseData = responseData.rows;
                          }
                          const rows = responseData.map((row) => (0, GenericFunctions_1.rowFormatColumns)({ ...row }, tableColumns.map(({ name }) => name).concat(['_id', '_ctime', '_mtime'])));
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(rows), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                              returnData.push(...executionErrorData);
                          }
                          throw error;
                      }
                  }
              }
              else if (operation === 'delete') {
                  for (let i = 0; i < items.length; i++) {
                      try {
                          const tableName = this.getNodeParameter('tableName', 0);
                          const rowId = this.getNodeParameter('rowId', i);
                          const requestBody = {
                              table_name: tableName,
                              row_id: rowId,
                          };
                          const response = (await GenericFunctions_1.seaTableApiRequest.call(this, ctx, 'DELETE', '/dtable-server/api/v1/dtables/{{dtable_uuid}}/rows/', requestBody, qs));
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(response), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                              returnData.push(...executionErrorData);
                              continue;
                          }
                          throw error;
                      }
                  }
              }
              else if (operation === 'update') {
                  const tableName = this.getNodeParameter('tableName', 0);
                  const tableColumns = await GenericFunctions_1.getTableColumns.call(this, tableName);
                  body.table_name = tableName;
                  const fieldsToSend = this.getNodeParameter('fieldsToSend', 0);
                  let rowInput = {};
                  for (let i = 0; i < items.length; i++) {
                      const rowId = this.getNodeParameter('rowId', i);
                      rowInput = {};
                      try {
                          if (fieldsToSend === 'autoMapInputData') {
                              const incomingKeys = Object.keys(items[i].json);
                              const inputDataToIgnore = (0, GenericFunctions_1.split)(this.getNodeParameter('inputsToIgnore', i, ''));
                              for (const key of incomingKeys) {
                                  if (inputDataToIgnore.includes(key))
                                      continue;
                                  rowInput[key] = items[i].json[key];
                              }
                          }
                          else {
                              const columns = this.getNodeParameter('columnsUi.columnValues', i, []);
                              for (const column of columns) {
                                  rowInput[column.columnName] = column.columnValue;
                              }
                          }
                          body.row = (0, GenericFunctions_1.rowExport)(rowInput, (0, GenericFunctions_1.updateAble)(tableColumns));
                          body.table_name = tableName;
                          body.row_id = rowId;
                          responseData = await GenericFunctions_1.seaTableApiRequest.call(this, ctx, 'PUT', '/dtable-server/api/v1/dtables/{{dtable_uuid}}/rows/', body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ _id: rowId, ...responseData }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                              returnData.push(...executionErrorData);
                              continue;
                          }
                          throw error;
                      }
                  }
              }
              else {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not known!`);
              }
          }
          return [returnData];
      }
  }
  exports.SeaTable = SeaTable;
  //# sourceMappingURL=SeaTable.node.js.map

credential_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SeaTableApi = void 0;
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
  const timezones = moment_timezone_1.default.tz
      .countries()
      .reduce((tz, country) => {
      const zonesForCountry = moment_timezone_1.default.tz
          .zonesForCountry(country)
          .map((zone) => ({ value: zone, name: zone }));
      return tz.concat(zonesForCountry);
  }, []);
  class SeaTableApi {
      constructor() {
          this.name = 'seaTableApi';
          this.displayName = 'SeaTable API';
          this.documentationUrl = 'seaTable';
          this.properties = [
              {
                  displayName: 'Environment',
                  name: 'environment',
                  type: 'options',
                  default: 'cloudHosted',
                  options: [
                      {
                          name: 'Cloud-Hosted',
                          value: 'cloudHosted',
                      },
                      {
                          name: 'Self-Hosted',
                          value: 'selfHosted',
                      },
                  ],
              },
              {
                  displayName: 'Self-Hosted Domain',
                  name: 'domain',
                  type: 'string',
                  default: '',
                  placeholder: 'https://www.mydomain.com',
                  displayOptions: {
                      show: {
                          environment: ['selfHosted'],
                      },
                  },
              },
              {
                  displayName: 'API Token (of a Base)',
                  name: 'token',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
              {
                  displayName: 'Timezone',
                  name: 'timezone',
                  type: 'options',
                  default: '',
                  description: "Seatable server's timezone",
                  options: [...timezones],
              },
          ];
      }
  }
  exports.SeaTableApi = SeaTableApi;
  //# sourceMappingURL=SeaTableApi.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SeaTableApi = void 0;
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
  const timezones = moment_timezone_1.default.tz
      .countries()
      .reduce((tz, country) => {
      const zonesForCountry = moment_timezone_1.default.tz
          .zonesForCountry(country)
          .map((zone) => ({ value: zone, name: zone }));
      return tz.concat(zonesForCountry);
  }, []);
  class SeaTableApi {
      constructor() {
          this.name = 'seaTableApi';
          this.displayName = 'SeaTable API';
          this.documentationUrl = 'seaTable';
          this.properties = [
              {
                  displayName: 'Environment',
                  name: 'environment',
                  type: 'options',
                  default: 'cloudHosted',
                  options: [
                      {
                          name: 'Cloud-Hosted',
                          value: 'cloudHosted',
                      },
                      {
                          name: 'Self-Hosted',
                          value: 'selfHosted',
                      },
                  ],
              },
              {
                  displayName: 'Self-Hosted Domain',
                  name: 'domain',
                  type: 'string',
                  default: '',
                  placeholder: 'https://www.mydomain.com',
                  displayOptions: {
                      show: {
                          environment: ['selfHosted'],
                      },
                  },
              },
              {
                  displayName: 'API Token (of a Base)',
                  name: 'token',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
              {
                  displayName: 'Timezone',
                  name: 'timezone',
                  type: 'options',
                  default: '',
                  description: "Seatable server's timezone",
                  options: [...timezones],
              },
          ];
      }
  }
  exports.SeaTableApi = SeaTableApi;
  //# sourceMappingURL=SeaTableApi.credentials.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: SeaTable node documentation
  description: Learn how to use the SeaTable node in n8n. Follow technical documentation to integrate SeaTable node into your workflows.
  contentType: [integration, reference]
  ---

  # SeaTable node

  Use the SeaTable node to automate work in SeaTable, and integrate SeaTable with other applications. n8n has built-in support for a wide range of SeaTable features, including creating, updating, deleting, updating, and getting rows. 

  On this page, you'll find a list of operations the SeaTable node supports and links to more resources.

  /// note | Credentials
  Refer to [SeaTable credentials](/integrations/builtin/credentials/seatable.md) for guidance on setting up authentication. 
  ///

  ## Operations

  * Row
      * Create
      * Delete
      * Get
      * Get All
      * Update

  ## Templates and examples

  <!-- see https://www.notion.so/n8n/Pull-in-templates-for-the-integrations-pages-37c716837b804d30a33b47475f6e3780 -->
  [[ templatesWidget(page.title, 'seatable') ]]

example_workflow:
  {"name":"SeaTable Example Workflow","nodes":[{"parameters":{"resource":"row","dynamic_property":null},"id":"utuxos9vzrg3u5bx70wtvp","name":"SeaTable","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"Resource","name":"resource","type":"options","default":"row","options":[{"name":"Row","value":"row"}]},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...RowDescription_1.rowOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...RowDescription_1.rowFields"}]


node_type: n8n-nodes-base.Salesmate
name: Salesmate
display_name: Salesmate
description: Consume Salesmate API
category: output
icon: file:salesmate.png
code_hash: ac0be2ad778e6daabce9912980fc92e4f611c33f6c7b4e7ba0ee80316f412075
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.Salesmate
documentation_title: Salesmate node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"salesmate","description":"Templates for salesmate"}]
related_resources: []
required_scopes: []
parameter_schemas: []
troubleshooting_info: []
example_parameters: {"resource":"activity","dynamic_property":null}
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:59:11
updated_at: 2025-06-12 08:59:11
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Salesmate = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const CompanyDescription_1 = require("./CompanyDescription");
  const ActivityDescription_1 = require("./ActivityDescription");
  const DealDescription_1 = require("./DealDescription");
  class Salesmate {
      constructor() {
          this.description = {
              displayName: 'Salesmate',
              name: 'salesmate',
              icon: 'file:salesmate.png',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ":" + $parameter["resource"]}}',
              description: 'Consume Salesmate API',
              defaults: {
                  name: 'Salesmate',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'salesmateApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Activity',
                              value: 'activity',
                          },
                          {
                              name: 'Company',
                              value: 'company',
                          },
                          {
                              name: 'Deal',
                              value: 'deal',
                          },
                      ],
                      default: 'activity',
                  },
                  ...CompanyDescription_1.companyOperations,
                  ...ActivityDescription_1.activityOperations,
                  ...DealDescription_1.dealOperations,
                  ...CompanyDescription_1.companyFields,
                  ...ActivityDescription_1.activityFields,
                  ...DealDescription_1.dealFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getUsers() {
                      const returnData = [];
                      const users = await GenericFunctions_1.salesmateApiRequest.call(this, 'GET', '/v1/users/active');
                      for (const user of users.Data) {
                          const userName = user.nickname;
                          const userId = user.id;
                          returnData.push({
                              name: userName,
                              value: userId,
                          });
                      }
                      return returnData;
                  },
                  async getContacts() {
                      const returnData = [];
                      const qs = {
                          fields: ['name', 'id'],
                          query: {},
                      };
                      const contacts = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v2/contacts/search', qs);
                      for (const contact of contacts.Data.data) {
                          const contactName = contact.name;
                          const contactId = contact.id;
                          returnData.push({
                              name: contactName,
                              value: contactId,
                          });
                      }
                      return returnData;
                  },
                  async getCompanies() {
                      const returnData = [];
                      const qs = {
                          fields: ['name', 'id'],
                          query: {},
                      };
                      const companies = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v2/companies/search', qs);
                      for (const company of companies.Data.data) {
                          const companyName = company.name;
                          const companyId = company.id;
                          returnData.push({
                              name: companyName,
                              value: companyId,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const qs = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              if (resource === 'company') {
                  if (operation === 'create') {
                      const owner = this.getNodeParameter('owner', i);
                      const name = this.getNodeParameter('name', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          name,
                          owner,
                      };
                      if (additionalFields.website) {
                          body.website = additionalFields.website;
                      }
                      if (additionalFields.phone) {
                          body.phone = additionalFields.phone;
                      }
                      if (additionalFields.otherPhone) {
                          body.otherPhone = additionalFields.otherPhone;
                      }
                      if (additionalFields.facebookHandle) {
                          body.facebookHandle = additionalFields.facebookHandle;
                      }
                      if (additionalFields.googlePlusHandle) {
                          body.googlePlusHandle = additionalFields.googlePlusHandle;
                      }
                      if (additionalFields.linkedInHandle) {
                          body.linkedInHandle = additionalFields.linkedInHandle;
                      }
                      if (additionalFields.skypeId) {
                          body.skypeId = additionalFields.skypeId;
                      }
                      if (additionalFields.twitterHandle) {
                          body.twitterHandle = additionalFields.twitterHandle;
                      }
                      if (additionalFields.currency) {
                          body.currency = additionalFields.currency;
                      }
                      if (additionalFields.billingAddressLine1) {
                          body.billingAddressLine1 = additionalFields.billingAddressLine1;
                      }
                      if (additionalFields.billingAddressLine2) {
                          body.billingAddressLine2 = additionalFields.billingAddressLine2;
                      }
                      if (additionalFields.billingCity) {
                          body.billingCity = additionalFields.billingCity;
                      }
                      if (additionalFields.billingZipCode) {
                          body.billingZipCode = additionalFields.billingZipCode;
                      }
                      if (additionalFields.billingState) {
                          body.billingState = additionalFields.billingState;
                      }
                      if (additionalFields.description) {
                          body.description = additionalFields.description;
                      }
                      if (additionalFields.tags) {
                          body.tags = additionalFields.tags;
                      }
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v1/companies', body);
                      responseData = responseData.Data;
                      if (!rawData) {
                          delete responseData.detail;
                      }
                  }
                  if (operation === 'update') {
                      const companyId = this.getNodeParameter('id', i);
                      const updateFields = this.getNodeParameter('updateFields', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      const body = {};
                      if (updateFields.owner) {
                          body.owner = updateFields.owner;
                      }
                      if (updateFields.name) {
                          body.name = updateFields.name;
                      }
                      if (updateFields.website) {
                          body.website = updateFields.website;
                      }
                      if (updateFields.phone) {
                          body.phone = updateFields.phone;
                      }
                      if (updateFields.otherPhone) {
                          body.otherPhone = updateFields.otherPhone;
                      }
                      if (updateFields.facebookHandle) {
                          body.facebookHandle = updateFields.facebookHandle;
                      }
                      if (updateFields.googlePlusHandle) {
                          body.googlePlusHandle = updateFields.googlePlusHandle;
                      }
                      if (updateFields.linkedInHandle) {
                          body.linkedInHandle = updateFields.linkedInHandle;
                      }
                      if (updateFields.skypeId) {
                          body.skypeId = updateFields.skypeId;
                      }
                      if (updateFields.twitterHandle) {
                          body.twitterHandle = updateFields.twitterHandle;
                      }
                      if (updateFields.currency) {
                          body.currency = updateFields.currency;
                      }
                      if (updateFields.billingAddressLine1) {
                          body.billingAddressLine1 = updateFields.billingAddressLine1;
                      }
                      if (updateFields.billingAddressLine2) {
                          body.billingAddressLine2 = updateFields.billingAddressLine2;
                      }
                      if (updateFields.billingCity) {
                          body.billingCity = updateFields.billingCity;
                      }
                      if (updateFields.billingZipCode) {
                          body.billingZipCode = updateFields.billingZipCode;
                      }
                      if (updateFields.billingState) {
                          body.billingState = updateFields.billingState;
                      }
                      if (updateFields.description) {
                          body.description = updateFields.description;
                      }
                      if (updateFields.tags) {
                          body.tags = updateFields.tags;
                      }
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'PUT', `/v1/companies/${companyId}`, body);
                      responseData = responseData.Data;
                      if (!rawData) {
                          delete responseData.detail;
                      }
                  }
                  if (operation === 'get') {
                      const companyId = this.getNodeParameter('id', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'GET', `/v1/companies/${companyId}`);
                      responseData = responseData.Data;
                      if (!rawData) {
                          responseData = (0, GenericFunctions_1.simplifySalesmateData)(responseData);
                      }
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      const jsonActive = this.getNodeParameter('jsonParameters', i);
                      let body = {
                          query: {
                              group: {},
                          },
                      };
                      if (options.sortBy) {
                          qs.sortBy = options.sortBy;
                      }
                      if (options.sortOrder) {
                          qs.sortOrder = options.sortOrder;
                      }
                      if (options.fields) {
                          if (options.fields.trim() === '') {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You have to add at least one field', {
                                  itemIndex: i,
                              });
                          }
                          body.fields = options.fields.split(',');
                      }
                      else {
                          body.fields = [
                              'name',
                              'description',
                              'billingAddressLine1',
                              'billingAddressLine2',
                              'billingCity',
                              'billingZipCode',
                              'billingState',
                              'billingCountry',
                              'website',
                              'owner',
                              'tags',
                              'photo',
                              'createdAt',
                          ];
                      }
                      if (!jsonActive) {
                          const filters = [];
                          const filtersUi = this.getNodeParameter('filters', i).filtersUi;
                          if (filtersUi === null || filtersUi === void 0 ? void 0 : filtersUi.conditions) {
                              const conditions = filtersUi.conditions;
                              if (conditions.conditionsUi) {
                                  for (const condition of conditions.conditionsUi) {
                                      const filter = {};
                                      filter.moduleName = 'Company';
                                      filter.field = {
                                          fieldName: condition.field,
                                      };
                                      filter.condition = condition.condition;
                                      filter.data = condition.value;
                                      filters.push(filter);
                                  }
                              }
                          }
                          if (filtersUi === null || filtersUi === void 0 ? void 0 : filtersUi.operator) {
                              body.query.group = {
                                  operator: filtersUi.operator,
                                  rules: filters,
                              };
                          }
                      }
                      else {
                          const json = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('filtersJson', i));
                          body = json;
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.salesmateApiRequestAllItems.call(this, 'Data', 'POST', '/v2/companies/search', body, qs);
                      }
                      else {
                          const limit = this.getNodeParameter('limit', i);
                          qs.rows = limit;
                          responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v2/companies/search', body, qs);
                          responseData = responseData.Data.data;
                      }
                  }
                  if (operation === 'delete') {
                      const companyId = parseInt(this.getNodeParameter('id', i), 10);
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'DELETE', `/v1/companies/${companyId}`);
                  }
              }
              if (resource === 'activity') {
                  if (operation === 'create') {
                      const owner = this.getNodeParameter('owner', i);
                      const title = this.getNodeParameter('title', i);
                      const type = this.getNodeParameter('type', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          title,
                          owner,
                          type,
                      };
                      if (additionalFields.dueDate) {
                          body.dueDate = new Date(additionalFields.dueDate).getTime();
                      }
                      if (additionalFields.duration) {
                          body.duration = additionalFields.duration;
                      }
                      if (additionalFields.isCalendarInvite) {
                          body.isCalendarInvite = additionalFields.isCalendarInvite;
                      }
                      if (additionalFields.isCompleted) {
                          body.isCompleted = additionalFields.isCompleted;
                      }
                      if (additionalFields.description) {
                          body.description = additionalFields.description;
                      }
                      if (additionalFields.tags) {
                          body.tags = additionalFields.tags;
                      }
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v1/activities', body);
                      responseData = responseData.Data;
                      if (!rawData) {
                          delete responseData.detail;
                      }
                  }
                  if (operation === 'update') {
                      const activityId = this.getNodeParameter('id', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      const updateFields = this.getNodeParameter('updateFields', i);
                      const body = {};
                      if (updateFields.title) {
                          body.title = updateFields.title;
                      }
                      if (updateFields.type) {
                          body.type = updateFields.type;
                      }
                      if (updateFields.owner) {
                          body.owner = updateFields.owner;
                      }
                      if (updateFields.dueDate) {
                          body.dueDate = new Date(updateFields.dueDate).getTime();
                      }
                      if (updateFields.duration) {
                          body.duration = updateFields.duration;
                      }
                      if (updateFields.isCalendarInvite) {
                          body.isCalendarInvite = updateFields.isCalendarInvite;
                      }
                      if (updateFields.isCompleted) {
                          body.isCompleted = updateFields.isCompleted;
                      }
                      if (updateFields.description) {
                          body.description = updateFields.description;
                      }
                      if (updateFields.tags) {
                          body.tags = updateFields.tags;
                      }
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'PUT', `/v1/activities/${activityId}`, body);
                      responseData = responseData.Data;
                      if (!rawData) {
                          delete responseData.detail;
                      }
                  }
                  if (operation === 'get') {
                      const activityId = this.getNodeParameter('id', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'GET', `/v1/activities/${activityId}`);
                      responseData = responseData.Data;
                      if (!rawData) {
                          responseData = (0, GenericFunctions_1.simplifySalesmateData)(responseData);
                      }
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      const jsonActive = this.getNodeParameter('jsonParameters', i);
                      let body = {
                          query: {
                              group: {},
                          },
                      };
                      if (options.sortBy) {
                          qs.sortBy = options.sortBy;
                      }
                      if (options.sortOrder) {
                          qs.sortOrder = options.sortOrder;
                      }
                      if (options.fields) {
                          if (options.fields.trim() === '') {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You have to add at least one field', {
                                  itemIndex: i,
                              });
                          }
                          body.fields = options.fields.split(',');
                      }
                      else {
                          body.fields = [
                              'title',
                              'dueDate',
                              'description',
                              'duration',
                              'owner',
                              'Deal.title',
                              'PrimaryContact.name',
                              'PrimaryContact.email',
                              'PrimaryCompany.name',
                              'PrimaryCompany.email',
                              'tags',
                              'type',
                              'createdAt',
                              'isCompleted',
                          ];
                      }
                      if (!jsonActive) {
                          const filters = [];
                          const filtersUi = this.getNodeParameter('filters', i).filtersUi;
                          if (filtersUi === null || filtersUi === void 0 ? void 0 : filtersUi.conditions) {
                              const conditions = filtersUi.conditions;
                              if (conditions.conditionsUi) {
                                  for (const condition of conditions.conditionsUi) {
                                      const filter = {};
                                      filter.moduleName = 'Task';
                                      filter.field = {
                                          fieldName: condition.field,
                                      };
                                      filter.condition = condition.condition;
                                      filter.data = condition.value;
                                      filters.push(filter);
                                  }
                              }
                          }
                          if (filtersUi === null || filtersUi === void 0 ? void 0 : filtersUi.operator) {
                              body.query.group = {
                                  operator: filtersUi.operator,
                                  rules: filters,
                              };
                          }
                      }
                      else {
                          const json = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('filtersJson', i));
                          body = json;
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.salesmateApiRequestAllItems.call(this, 'Data', 'POST', '/v2/activities/search', body, qs);
                      }
                      else {
                          const limit = this.getNodeParameter('limit', i);
                          qs.rows = limit;
                          responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v2/activities/search', body, qs);
                          responseData = responseData.Data.data;
                      }
                  }
                  if (operation === 'delete') {
                      const activityId = this.getNodeParameter('id', i);
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'DELETE', `/v1/activities/${activityId}`);
                  }
              }
              if (resource === 'deal') {
                  if (operation === 'create') {
                      const title = this.getNodeParameter('title', i);
                      const owner = this.getNodeParameter('owner', i);
                      const primaryContact = this.getNodeParameter('primaryContact', i);
                      const pipeline = this.getNodeParameter('pipeline', i);
                      const status = this.getNodeParameter('status', i);
                      const stage = this.getNodeParameter('stage', i);
                      const currency = this.getNodeParameter('currency', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          title,
                          owner,
                          primaryContact,
                          pipeline,
                          status,
                          stage,
                          currency,
                      };
                      if (additionalFields.description) {
                          body.description = additionalFields.description;
                      }
                      if (additionalFields.tags) {
                          body.tags = additionalFields.tags;
                      }
                      if (additionalFields.primaryCompany) {
                          body.primaryCompany = additionalFields.primaryCompany;
                      }
                      if (additionalFields.source) {
                          body.source = additionalFields.source;
                      }
                      if (additionalFields.estimatedCloseDate) {
                          body.estimatedCloseDate = additionalFields.estimatedCloseDate;
                      }
                      if (additionalFields.dealValue) {
                          body.dealValue = additionalFields.dealValue;
                      }
                      if (additionalFields.priority) {
                          body.priority = additionalFields.priority;
                      }
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v1/deals', body);
                      responseData = responseData.Data;
                      if (!rawData) {
                          delete responseData.detail;
                      }
                  }
                  if (operation === 'update') {
                      const dealId = this.getNodeParameter('id', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      const updateFields = this.getNodeParameter('updateFields', i);
                      const body = {};
                      if (updateFields.title) {
                          body.title = updateFields.title;
                      }
                      if (updateFields.owner) {
                          body.owner = updateFields.owner;
                      }
                      if (updateFields.primaryContact) {
                          body.primaryContact = updateFields.primaryContact;
                      }
                      if (updateFields.status) {
                          body.status = updateFields.status;
                      }
                      if (updateFields.currency) {
                          body.currency = updateFields.currency;
                      }
                      if (updateFields.stage) {
                          body.stage = updateFields.stage;
                      }
                      if (updateFields.pipeline) {
                          body.pipeline = updateFields.pipeline;
                      }
                      if (updateFields.description) {
                          body.description = updateFields.description;
                      }
                      if (updateFields.tags) {
                          body.tags = updateFields.tags;
                      }
                      if (updateFields.primaryCompany) {
                          body.primaryCompany = updateFields.primaryCompany;
                      }
                      if (updateFields.source) {
                          body.source = updateFields.source;
                      }
                      if (updateFields.estimatedCloseDate) {
                          body.estimatedCloseDate = updateFields.estimatedCloseDate;
                      }
                      if (updateFields.dealValue) {
                          body.dealValue = updateFields.dealValue;
                      }
                      if (updateFields.priority) {
                          body.priority = updateFields.priority;
                      }
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'PUT', `/v1/deals/${dealId}`, body);
                      responseData = responseData.Data;
                      if (!rawData) {
                          delete responseData.detail;
                      }
                  }
                  if (operation === 'get') {
                      const dealId = this.getNodeParameter('id', i);
                      const rawData = this.getNodeParameter('rawData', i);
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'GET', `/v1/deals/${dealId}`);
                      responseData = responseData.Data;
                      if (!rawData) {
                          responseData = (0, GenericFunctions_1.simplifySalesmateData)(responseData);
                      }
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      const jsonActive = this.getNodeParameter('jsonParameters', i);
                      let body = {
                          query: {
                              group: {},
                          },
                      };
                      if (options.sortBy) {
                          qs.sortBy = options.sortBy;
                      }
                      if (options.sortOrder) {
                          qs.sortOrder = options.sortOrder;
                      }
                      if (options.fields !== undefined) {
                          if (options.fields.trim() === '') {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You have to add at least one field', {
                                  itemIndex: i,
                              });
                          }
                          body.fields = options.fields.split(',');
                      }
                      else {
                          body.fields = [
                              'title',
                              'PrimaryContact.name',
                              'PrimaryContact.email',
                              'PrimaryCompany.name',
                              'PrimaryCompany.email',
                              'dealValue',
                              'priority',
                              'stage',
                              'status',
                              'owner',
                              'tags',
                              'createdAt',
                          ];
                      }
                      if (!jsonActive) {
                          const filters = [];
                          const filtersUi = this.getNodeParameter('filters', i).filtersUi;
                          if (filtersUi === null || filtersUi === void 0 ? void 0 : filtersUi.conditions) {
                              const conditions = filtersUi.conditions;
                              if (conditions.conditionsUi) {
                                  for (const condition of conditions.conditionsUi) {
                                      const filter = {};
                                      filter.moduleName = 'Task';
                                      filter.field = {
                                          fieldName: condition.field,
                                      };
                                      filter.condition = condition.condition;
                                      filter.data = condition.value;
                                      filters.push(filter);
                                  }
                              }
                          }
                          if (filtersUi === null || filtersUi === void 0 ? void 0 : filtersUi.operator) {
                              body.query.group = {
                                  operator: filtersUi.operator,
                                  rules: filters,
                              };
                          }
                      }
                      else {
                          const json = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('filtersJson', i));
                          body = json;
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.salesmateApiRequestAllItems.call(this, 'Data', 'POST', '/v2/deals/search', body, qs);
                      }
                      else {
                          const limit = this.getNodeParameter('limit', i);
                          qs.rows = limit;
                          responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'POST', '/v2/deals/search', body, qs);
                          responseData = responseData.Data.data;
                      }
                  }
                  if (operation === 'delete') {
                      const dealId = this.getNodeParameter('id', i);
                      responseData = await GenericFunctions_1.salesmateApiRequest.call(this, 'DELETE', `/v1/deals/${dealId}`);
                  }
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.Salesmate = Salesmate;
  //# sourceMappingURL=Salesmate.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SalesmateApi = void 0;
  class SalesmateApi {
      constructor() {
          this.name = 'salesmateApi';
          this.displayName = 'Salesmate API';
          this.documentationUrl = 'salesmate';
          this.properties = [
              {
                  displayName: 'Session Token',
                  name: 'sessionToken',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
              {
                  displayName: 'URL',
                  name: 'url',
                  type: 'string',
                  default: '',
                  placeholder: 'n8n.salesmate.io',
              },
          ];
      }
  }
  exports.SalesmateApi = SalesmateApi;
  //# sourceMappingURL=SalesmateApi.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SalesmateApi = void 0;
  class SalesmateApi {
      constructor() {
          this.name = 'salesmateApi';
          this.displayName = 'Salesmate API';
          this.documentationUrl = 'salesmate';
          this.properties = [
              {
                  displayName: 'Session Token',
                  name: 'sessionToken',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
              {
                  displayName: 'URL',
                  name: 'url',
                  type: 'string',
                  default: '',
                  placeholder: 'n8n.salesmate.io',
              },
          ];
      }
  }
  exports.SalesmateApi = SalesmateApi;
  //# sourceMappingURL=SalesmateApi.credentials.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: Salesmate node documentation
  description: Learn how to use the Salesmate node in n8n. Follow technical documentation to integrate Salesmate node into your workflows.
  contentType: [integration, reference]
  ---

  # Salesmate node

  Use the Salesmate node to automate work in Salesmate, and integrate Salesmate with other applications. n8n has built-in support for a wide range of Salesmate features, including creating, updating, deleting, and getting activities, companies, and deals. 

  On this page, you'll find a list of operations the Salesmate node supports and links to more resources.

  /// note | Credentials
  Refer to [Salesmate credentials](/integrations/builtin/credentials/salesmate.md) for guidance on setting up authentication. 
  ///

  ## Operations

  * Activity
      * Create an activity
      * Delete an activity
      * Get an activity
      * Get all companies
      * Update an activity
  * Company
      * Create a company
      * Delete a company
      * Get a company
      * Get all companies
      * Update a company
  * Deal
      * Create a deal
      * Delete a deal
      * Get a deal
      * Get all deals
      * Update a deal

  ## Templates and examples

  <!-- see https://www.notion.so/n8n/Pull-in-templates-for-the-integrations-pages-37c716837b804d30a33b47475f6e3780 -->
  [[ templatesWidget(page.title, 'salesmate') ]]

example_workflow:
  {"name":"Salesmate Example Workflow","nodes":[{"parameters":{"resource":"activity","dynamic_property":null},"id":"a7a0616982mcas1tr94ped","name":"Salesmate","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"Resource","name":"resource","type":"options","default":"activity","options":[{"name":"Activity","value":"activity"},{"name":"Company","value":"company"},{"name":"Deal","value":"deal"}]},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...CompanyDescription_1.companyOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...ActivityDescription_1.activityOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...DealDescription_1.dealOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...CompanyDescription_1.companyFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...ActivityDescription_1.activityFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...DealDescription_1.dealFields"}]


node_type: n8n-nodes-base.SendGrid
name: SendGrid
display_name: SendGrid
description: Consume SendGrid API
category: transform
icon: file:sendGrid.svg
code_hash: c682d47a8e16769aa94a9421671141e4f81eee92760eabbe45af312286758989
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.SendGrid
documentation_title: SendGrid node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"sendgrid","description":"Templates for sendgrid"}]
related_resources: []
required_scopes: []
parameter_schemas: []
troubleshooting_info: []
example_parameters: {"resource":"contact","dynamic_property":null}
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:59:11
updated_at: 2025-06-12 08:59:11
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SendGrid = void 0;
  const ListDescription_1 = require("./ListDescription");
  const ContactDescription_1 = require("./ContactDescription");
  const MailDescription_1 = require("./MailDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
  class SendGrid {
      constructor() {
          this.description = {
              displayName: 'SendGrid',
              name: 'sendGrid',
              icon: 'file:sendGrid.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ":" + $parameter["resource"]}}',
              description: 'Consume SendGrid API',
              defaults: {
                  name: 'SendGrid',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'sendGridApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Contact',
                              value: 'contact',
                          },
                          {
                              name: 'List',
                              value: 'list',
                          },
                          {
                              name: 'Mail',
                              value: 'mail',
                          },
                      ],
                      default: 'list',
                      required: true,
                  },
                  ...ListDescription_1.listOperations,
                  ...ListDescription_1.listFields,
                  ...ContactDescription_1.contactOperations,
                  ...ContactDescription_1.contactFields,
                  ...MailDescription_1.mailOperations,
                  ...MailDescription_1.mailFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getCustomFields() {
                      const returnData = [];
                      const { custom_fields } = await GenericFunctions_1.sendGridApiRequest.call(this, '/marketing/field_definitions', 'GET', {}, {});
                      if (custom_fields !== undefined) {
                          for (const customField of custom_fields) {
                              returnData.push({
                                  name: customField.name,
                                  value: customField.id,
                              });
                          }
                      }
                      return returnData;
                  },
                  async getListIds() {
                      const returnData = [];
                      const lists = await GenericFunctions_1.sendGridApiRequestAllItems.call(this, '/marketing/lists', 'GET', 'result', {}, {});
                      for (const list of lists) {
                          returnData.push({
                              name: list.name,
                              value: list.id,
                          });
                      }
                      return returnData;
                  },
                  async getTemplateIds() {
                      const responseData = await GenericFunctions_1.sendGridApiRequest.call(this, '/templates', 'GET', {}, { generations: 'dynamic' });
                      return responseData.templates.map(({ id, name }) => ({
                          name,
                          value: id,
                      }));
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const length = items.length;
          const qs = {};
          let responseData;
          const timezone = this.getTimezone();
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          if (resource === 'contact') {
              if (operation === 'getAll') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const filters = this.getNodeParameter('filters', i);
                          let endpoint = '/marketing/contacts';
                          let method = 'GET';
                          const body = {};
                          if (filters.query && filters.query !== '') {
                              endpoint = '/marketing/contacts/search';
                              method = 'POST';
                              Object.assign(body, { query: filters.query });
                          }
                          responseData = await GenericFunctions_1.sendGridApiRequestAllItems.call(this, endpoint, method, 'result', body, qs);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.splice(0, limit);
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                              returnData.push(...executionData);
                              continue;
                          }
                          throw error;
                      }
                  }
              }
              if (operation === 'get') {
                  const by = this.getNodeParameter('by', 0);
                  let endpoint;
                  let method;
                  const body = {};
                  for (let i = 0; i < length; i++) {
                      try {
                          if (by === 'id') {
                              method = 'GET';
                              const contactId = this.getNodeParameter('contactId', i);
                              endpoint = `/marketing/contacts/${contactId}`;
                          }
                          else {
                              const email = this.getNodeParameter('email', i);
                              endpoint = '/marketing/contacts/search';
                              method = 'POST';
                              Object.assign(body, { query: `email LIKE '${email}' ` });
                          }
                          responseData = await GenericFunctions_1.sendGridApiRequest.call(this, endpoint, method, body, qs);
                          responseData = responseData.result || responseData;
                          if (Array.isArray(responseData)) {
                              responseData = responseData[0];
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                              returnData.push(...executionData);
                              continue;
                          }
                          throw error;
                      }
                  }
              }
              if (operation === 'upsert') {
                  try {
                      const contacts = [];
                      let lists;
                      for (let i = 0; i < length; i++) {
                          const email = this.getNodeParameter('email', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const contact = {
                              email,
                          };
                          if (additionalFields.addressUi) {
                              const addressValues = additionalFields.addressUi
                                  .addressValues;
                              const addressLine1 = addressValues.address1;
                              const addressLine2 = addressValues.address2;
                              if (addressLine2) {
                                  Object.assign(contact, { address_line_2: addressLine2 });
                              }
                              Object.assign(contact, { address_line_1: addressLine1 });
                          }
                          if (additionalFields.city) {
                              const city = additionalFields.city;
                              Object.assign(contact, { city });
                          }
                          if (additionalFields.country) {
                              const country = additionalFields.country;
                              Object.assign(contact, { country });
                          }
                          if (additionalFields.firstName) {
                              const firstName = additionalFields.firstName;
                              Object.assign(contact, { first_name: firstName });
                          }
                          if (additionalFields.lastName) {
                              const lastName = additionalFields.lastName;
                              Object.assign(contact, { last_name: lastName });
                          }
                          if (additionalFields.postalCode) {
                              const postalCode = additionalFields.postalCode;
                              Object.assign(contact, { postal_code: postalCode });
                          }
                          if (additionalFields.stateProvinceRegion) {
                              const stateProvinceRegion = additionalFields.stateProvinceRegion;
                              Object.assign(contact, { state_province_region: stateProvinceRegion });
                          }
                          if (additionalFields.alternateEmails) {
                              const alternateEmails = additionalFields.alternateEmails
                                  .split(',')
                                  .filter((mail) => !!mail);
                              if (alternateEmails.length !== 0) {
                                  Object.assign(contact, { alternate_emails: alternateEmails });
                              }
                          }
                          if (additionalFields.listIdsUi) {
                              const listIdValues = additionalFields.listIdsUi
                                  .listIdValues;
                              const listIds = listIdValues.listIds;
                              lists = listIds;
                          }
                          if (additionalFields.customFieldsUi) {
                              const customFields = additionalFields.customFieldsUi
                                  .customFieldValues;
                              if (customFields) {
                                  const data = customFields.reduce((obj, value) => Object.assign(obj, { [`${value.fieldId}`]: value.fieldValue }), {});
                                  Object.assign(contact, { custom_fields: data });
                              }
                          }
                          contacts.push(contact);
                      }
                      responseData = await GenericFunctions_1.sendGridApiRequest.call(this, '/marketing/contacts', 'PUT', { list_ids: lists, contacts }, qs);
                      returnData.push(responseData);
                  }
                  catch (error) {
                      if (this.continueOnFail()) {
                          returnData.push({ json: { error: error.message } });
                      }
                      else {
                          throw error;
                      }
                  }
              }
              if (operation === 'delete') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const deleteAll = this.getNodeParameter('deleteAll', i);
                          if (deleteAll) {
                              qs.delete_all_contacts = 'true';
                          }
                          qs.ids = this.getNodeParameter('ids', i).replace(/\s/g, '');
                          responseData = await GenericFunctions_1.sendGridApiRequest.call(this, '/marketing/contacts', 'DELETE', {}, qs);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                              returnData.push(...executionData);
                              continue;
                          }
                          throw error;
                      }
                  }
              }
          }
          if (resource === 'list') {
              if (operation === 'getAll') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          responseData = await GenericFunctions_1.sendGridApiRequestAllItems.call(this, '/marketing/lists', 'GET', 'result', {}, qs);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.splice(0, limit);
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                              returnData.push(...executionData);
                              continue;
                          }
                          throw error;
                      }
                  }
              }
              if (operation === 'get') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const listId = this.getNodeParameter('listId', i);
                          qs.contact_sample = this.getNodeParameter('contactSample', i);
                          responseData = await GenericFunctions_1.sendGridApiRequest.call(this, `/marketing/lists/${listId}`, 'GET', {}, qs);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                              returnData.push(...executionData);
                              continue;
                          }
                          throw error;
                      }
                  }
              }
              if (operation === 'create') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const name = this.getNodeParameter('name', i);
                          responseData = await GenericFunctions_1.sendGridApiRequest.call(this, '/marketing/lists', 'POST', { name }, qs);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                              returnData.push(...executionData);
                              continue;
                          }
                          throw error;
                      }
                  }
              }
              if (operation === 'delete') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const listId = this.getNodeParameter('listId', i);
                          qs.delete_contacts = this.getNodeParameter('deleteContacts', i);
                          responseData = await GenericFunctions_1.sendGridApiRequest.call(this, `/marketing/lists/${listId}`, 'DELETE', {}, qs);
                          responseData = { success: true };
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                              returnData.push(...executionData);
                              continue;
                          }
                          throw error;
                      }
                  }
              }
              if (operation === 'update') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const name = this.getNodeParameter('name', i);
                          const listId = this.getNodeParameter('listId', i);
                          responseData = await GenericFunctions_1.sendGridApiRequest.call(this, `/marketing/lists/${listId}`, 'PATCH', { name }, qs);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                              returnData.push(...executionData);
                              continue;
                          }
                          throw error;
                      }
                  }
              }
          }
          if (resource === 'mail') {
              if (operation === 'send') {
                  for (let i = 0; i < length; i++) {
                      try {
                          const toEmail = this.getNodeParameter('toEmail', i);
                          const parsedToEmail = toEmail.includes(',')
                              ? toEmail.split(',').map((entry) => ({ email: entry.trim() }))
                              : [{ email: toEmail.trim() }];
                          const { bccEmail, ccEmail, enableSandbox, sendAt, headers, attachments, categories, ipPoolName, } = this.getNodeParameter('additionalFields', i);
                          const body = {
                              personalizations: [
                                  {
                                      to: parsedToEmail,
                                  },
                              ],
                              from: {
                                  email: this.getNodeParameter('fromEmail', i).trim(),
                                  name: this.getNodeParameter('fromName', i),
                              },
                              mail_settings: {
                                  sandbox_mode: {
                                      enable: enableSandbox || false,
                                  },
                              },
                          };
                          const dynamicTemplateEnabled = this.getNodeParameter('dynamicTemplate', i);
                          if (dynamicTemplateEnabled) {
                              body.template_id = this.getNodeParameter('templateId', i);
                              const { fields } = this.getNodeParameter('dynamicTemplateFields', i);
                              if (fields) {
                                  body.personalizations[0].dynamic_template_data = {};
                                  fields.forEach((field) => {
                                      body.personalizations[0].dynamic_template_data[field.key] = field.value;
                                  });
                              }
                          }
                          else {
                              body.personalizations[0].subject = this.getNodeParameter('subject', i);
                              body.content = [
                                  {
                                      type: this.getNodeParameter('contentType', i),
                                      value: this.getNodeParameter('contentValue', i),
                                  },
                              ];
                          }
                          if (attachments) {
                              const attachmentsToSend = [];
                              const binaryProperties = attachments.split(',').map((p) => p.trim());
                              for (const property of binaryProperties) {
                                  const binaryData = this.helpers.assertBinaryData(i, property);
                                  const dataBuffer = await this.helpers.getBinaryDataBuffer(i, property);
                                  attachmentsToSend.push({
                                      content: dataBuffer.toString('base64'),
                                      filename: binaryData.fileName || 'unknown',
                                      type: binaryData.mimeType,
                                  });
                              }
                              if (attachmentsToSend.length) {
                                  body.attachments = attachmentsToSend;
                              }
                          }
                          if (bccEmail) {
                              body.personalizations[0].bcc = bccEmail
                                  .split(',')
                                  .map((entry) => ({ email: entry.trim() }));
                          }
                          if (ccEmail) {
                              body.personalizations[0].cc = ccEmail
                                  .split(',')
                                  .map((entry) => ({ email: entry.trim() }));
                          }
                          if (headers === null || headers === void 0 ? void 0 : headers.details.length) {
                              const parsedHeaders = {};
                              headers.details.forEach((obj) => (parsedHeaders[obj.key] = obj.value));
                              body.headers = parsedHeaders;
                          }
                          if (categories) {
                              body.categories = categories.split(',');
                          }
                          if (ipPoolName) {
                              body.ip_pool_name = ipPoolName;
                          }
                          if (sendAt) {
                              body.personalizations[0].send_at = moment_timezone_1.default.tz(sendAt, timezone).unix();
                          }
                          const data = await GenericFunctions_1.sendGridApiRequest.call(this, '/mail/send', 'POST', body, qs, {
                              resolveWithFullResponse: true,
                          });
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ messageId: data.headers['x-message-id'] }), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                              returnData.push(...executionData);
                              continue;
                          }
                          throw error;
                      }
                  }
              }
          }
          return [returnData];
      }
  }
  exports.SendGrid = SendGrid;
  //# sourceMappingURL=SendGrid.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SendGridApi = void 0;
  class SendGridApi {
      constructor() {
          this.name = 'sendGridApi';
          this.displayName = 'SendGrid API';
          this.documentationUrl = 'sendgrid';
          this.properties = [
              {
                  displayName: 'API Key',
                  name: 'apiKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
          ];
          this.authenticate = {
              type: 'generic',
              properties: {
                  headers: {
                      Authorization: '=Bearer {{$credentials.apiKey}}',
                  },
              },
          };
          this.test = {
              request: {
                  baseURL: 'https://api.sendgrid.com/v3',
                  url: '/marketing/contacts',
              },
          };
      }
  }
  exports.SendGridApi = SendGridApi;
  //# sourceMappingURL=SendGridApi.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SendGridApi = void 0;
  class SendGridApi {
      constructor() {
          this.name = 'sendGridApi';
          this.displayName = 'SendGrid API';
          this.documentationUrl = 'sendgrid';
          this.properties = [
              {
                  displayName: 'API Key',
                  name: 'apiKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
          ];
          this.authenticate = {
              type: 'generic',
              properties: {
                  headers: {
                      Authorization: '=Bearer {{$credentials.apiKey}}',
                  },
              },
          };
          this.test = {
              request: {
                  baseURL: 'https://api.sendgrid.com/v3',
                  url: '/marketing/contacts',
              },
          };
      }
  }
  exports.SendGridApi = SendGridApi;
  //# sourceMappingURL=SendGridApi.credentials.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: SendGrid node documentation
  description: Learn how to use the SendGrid node in n8n. Follow technical documentation to integrate SendGrid node into your workflows.
  contentType: [integration, reference]
  priority: medium
  ---

  # SendGrid node

  Use the SendGrid node to automate work in SendGrid, and integrate SendGrid with other applications. n8n has built-in support for a wide range of SendGrid features, including creating, updating, deleting, and getting contacts, and lists, as well as sending emails. 

  On this page, you'll find a list of operations the SendGrid node supports and links to more resources.

  /// note | Credentials
  Refer to [SendGrid credentials](/integrations/builtin/credentials/sendgrid.md) for guidance on setting up authentication. 
  ///

  --8<-- "_snippets/integrations/builtin/app-nodes/ai-tools.md"

  ## Operations

  * Contact
      * Create/update a contact
      * Delete a contact
      * Get a contact by ID
      * Get all contacts
  * List
      * Create a list
      * Delete a list
      * Get a list
      * Get all lists
      * Update a list
  * Mail
      * Send an email.

  ## Templates and examples

  <!-- see https://www.notion.so/n8n/Pull-in-templates-for-the-integrations-pages-37c716837b804d30a33b47475f6e3780 -->
  [[ templatesWidget(page.title, 'sendgrid') ]]

  --8<-- "_snippets/integrations/builtin/app-nodes/operation-not-supported.md"

example_workflow:
  {"name":"SendGrid Example Workflow","nodes":[{"parameters":{"resource":"contact","dynamic_property":null},"id":"sxhvy6yj1ni8771md8ru8","name":"SendGrid","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"Resource","name":"resource","type":"options","default":"list","required":true,"options":[{"name":"Contact","value":"contact"},{"name":"List","value":"list"},{"name":"Mail","value":"mail"}]},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...ListDescription_1.listOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...ListDescription_1.listFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...ContactDescription_1.contactOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...ContactDescription_1.contactFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...MailDescription_1.mailOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...MailDescription_1.mailFields"}]


node_type: n8n-nodes-base.SecurityScorecard
name: SecurityScorecard
display_name: SecurityScorecard
description: Consume SecurityScorecard API
category: transform
icon: file:securityScorecard.svg
code_hash: 126925cdb415faf27b54c0587590eb72f3a0a7a7be4adb9f5ffbc6121152ca14
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.SecurityScorecard
documentation_title: SecurityScorecard node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"securityscorecard","description":"Templates for securityscorecard"}]
related_resources: []
required_scopes: []
parameter_schemas: []
troubleshooting_info: []
example_parameters: {"resource":"company","dynamic_property":null}
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:59:11
updated_at: 2025-06-12 08:59:11
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SecurityScorecard = void 0;
  const CompanyDescription_1 = require("./descriptions/CompanyDescription");
  const IndustryDescription_1 = require("./descriptions/IndustryDescription");
  const InviteDescription_1 = require("./descriptions/InviteDescription");
  const PortfolioDescription_1 = require("./descriptions/PortfolioDescription");
  const PortfolioCompanyDescription_1 = require("./descriptions/PortfolioCompanyDescription");
  const ReportDescription_1 = require("./descriptions/ReportDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  const moment_1 = __importDefault(require("moment"));
  class SecurityScorecard {
      constructor() {
          this.description = {
              displayName: 'SecurityScorecard',
              name: 'securityScorecard',
              icon: 'file:securityScorecard.svg',
              group: ['transform'],
              subtitle: '={{$parameter["operation"]}} : {{$parameter["resource"]}}',
              version: 1,
              description: 'Consume SecurityScorecard API',
              defaults: {
                  name: 'SecurityScorecard',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'securityScorecardApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      required: true,
                      options: [
                          {
                              name: 'Company',
                              value: 'company',
                          },
                          {
                              name: 'Industry',
                              value: 'industry',
                          },
                          {
                              name: 'Invite',
                              value: 'invite',
                          },
                          {
                              name: 'Portfolio',
                              value: 'portfolio',
                          },
                          {
                              name: 'Portfolio Company',
                              value: 'portfolioCompany',
                          },
                          {
                              name: 'Report',
                              value: 'report',
                          },
                      ],
                      default: 'company',
                  },
                  ...CompanyDescription_1.companyOperations,
                  ...CompanyDescription_1.companyFields,
                  ...IndustryDescription_1.industryOperations,
                  ...IndustryDescription_1.industryFields,
                  ...InviteDescription_1.inviteOperations,
                  ...InviteDescription_1.inviteFields,
                  ...PortfolioDescription_1.portfolioOperations,
                  ...PortfolioDescription_1.portfolioFields,
                  ...PortfolioCompanyDescription_1.portfolioCompanyOperations,
                  ...PortfolioCompanyDescription_1.portfolioCompanyFields,
                  ...ReportDescription_1.reportOperations,
                  ...ReportDescription_1.reportFields,
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          let responseData;
          const length = items.length;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              if (resource === 'portfolio') {
                  if (operation === 'create') {
                      const name = this.getNodeParameter('name', i);
                      const description = this.getNodeParameter('description', i);
                      const privacy = this.getNodeParameter('privacy', i);
                      const body = {
                          name,
                          description,
                          privacy,
                      };
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'POST', 'portfolios', body);
                      returnData.push(responseData);
                  }
                  if (operation === 'delete') {
                      const portfolioId = this.getNodeParameter('portfolioId', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'DELETE', `portfolios/${portfolioId}`);
                      returnData.push({ success: true });
                  }
                  if (operation === 'update') {
                      const portfolioId = this.getNodeParameter('portfolioId', i);
                      const name = this.getNodeParameter('name', i);
                      const description = this.getNodeParameter('description', i);
                      const privacy = this.getNodeParameter('privacy', i);
                      const body = {
                          name,
                          description,
                          privacy,
                      };
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'PUT', `portfolios/${portfolioId}`, body);
                      returnData.push(responseData);
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', 0);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', 'portfolios');
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', 0);
                          responseData = responseData.splice(0, limit);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
              }
              if (resource === 'portfolioCompany') {
                  if (operation === 'add') {
                      const portfolioId = this.getNodeParameter('portfolioId', i);
                      const domain = this.getNodeParameter('domain', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'PUT', `portfolios/${portfolioId}/companies/${domain}`);
                      returnData.push(responseData);
                  }
                  if (operation === 'remove') {
                      const portfolioId = this.getNodeParameter('portfolioId', i);
                      const domain = this.getNodeParameter('domain', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'DELETE', `portfolios/${portfolioId}/companies/${domain}`);
                      returnData.push({ success: true });
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', 0);
                      const portfolioId = this.getNodeParameter('portfolioId', i);
                      const filterParams = this.getNodeParameter('filters', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `portfolios/${portfolioId}/companies`, {}, filterParams);
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', 0);
                          responseData = responseData.splice(0, limit);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
              }
              if (resource === 'report') {
                  if (operation === 'download') {
                      const reportUrl = this.getNodeParameter('url', i);
                      const response = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', '', {}, {}, reportUrl, {
                          encoding: null,
                          resolveWithFullResponse: true,
                      });
                      let mimeType;
                      if (response.headers['content-type']) {
                          mimeType = response.headers['content-type'];
                      }
                      const newItem = {
                          json: items[i].json,
                          binary: {},
                      };
                      if (items[i].binary !== undefined && newItem.binary) {
                          Object.assign(newItem.binary, items[i].binary);
                      }
                      items[i] = newItem;
                      const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
                      const fileName = reportUrl.split('/').pop();
                      const data = Buffer.from(response.body, 'utf8');
                      items[i].binary[dataPropertyNameDownload] = await this.helpers.prepareBinaryData(data, fileName, mimeType);
                  }
                  if (operation === 'generate') {
                      const reportType = this.getNodeParameter('report', i);
                      let body = {};
                      if (reportType !== 'portfolio') {
                          body.scorecard_identifier = this.getNodeParameter('scorecardIdentifier', i);
                      }
                      else {
                          body.portfolio_id = this.getNodeParameter('portfolioId', i);
                      }
                      if (reportType === 'events-json') {
                          body.date = this.getNodeParameter('date', i);
                      }
                      if (['issues', 'portfolio'].indexOf(reportType) > -1) {
                          body.format = this.getNodeParameter('options.format', i) || 'pdf';
                      }
                      if (['detailed', 'summary'].indexOf(reportType) > -1) {
                          body.branding = this.getNodeParameter('branding', i);
                      }
                      if (['events-json', 'full-scorecard-json'].indexOf(reportType) > -1) {
                          body = { params: body };
                      }
                      if (reportType === 'scorecard-footprint') {
                          const options = this.getNodeParameter('options', i);
                          Object.assign(body, options);
                      }
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'POST', `reports/${reportType}`, body);
                      returnData.push(responseData);
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', 0);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', 'reports/recent');
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.splice(0, limit);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
              }
              if (resource === 'invite') {
                  if (operation === 'create') {
                      const body = {
                          email: this.getNodeParameter('email', i),
                          first_name: this.getNodeParameter('firstName', i),
                          last_name: this.getNodeParameter('lastName', i),
                          message: this.getNodeParameter('message', i),
                      };
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      Object.assign(body, additionalFields);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'POST', 'invitations', body);
                      returnData.push(responseData);
                  }
              }
              if (resource === 'industry') {
                  if (operation === 'getScore') {
                      const industry = this.getNodeParameter('industry', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `industries/${industry}/score`);
                      returnData.push(responseData);
                  }
                  if (operation === 'getFactor') {
                      const simple = this.getNodeParameter('simple', 0);
                      const returnAll = this.getNodeParameter('returnAll', 0);
                      const industry = this.getNodeParameter('industry', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `industries/${industry}/history/factors`);
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.splice(0, limit);
                      }
                      if (simple) {
                          responseData = (0, GenericFunctions_1.simplify)(responseData);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
                  if (operation === 'getFactorHistorical') {
                      const simple = this.getNodeParameter('simple', 0);
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const industry = this.getNodeParameter('industry', i);
                      const options = this.getNodeParameter('options', i);
                      if (options.from) {
                          options.from = (0, moment_1.default)(options.from).format('YYYY-MM-DD');
                      }
                      if (options.to) {
                          options.to = (0, moment_1.default)(options.to).format('YYYY-MM-DD');
                      }
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `industries/${industry}/history/factors`, {}, options);
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.splice(0, limit);
                      }
                      if (simple) {
                          responseData = (0, GenericFunctions_1.simplify)(responseData);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
              }
              if (resource === 'company') {
                  if (operation === 'getScorecard') {
                      const scorecardIdentifier = this.getNodeParameter('scorecardIdentifier', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `companies/${scorecardIdentifier}`);
                      returnData.push(responseData);
                  }
                  if (operation === 'getFactor') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const scorecardIdentifier = this.getNodeParameter('scorecardIdentifier', i);
                      const filterParams = this.getNodeParameter('filters', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `companies/${scorecardIdentifier}/factors`, {}, filterParams);
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.splice(0, limit);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
                  if (operation === 'getFactorHistorical') {
                      const simple = this.getNodeParameter('simple', 0);
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const scorecardIdentifier = this.getNodeParameter('scorecardIdentifier', i);
                      const options = this.getNodeParameter('options', i);
                      if (options.date_from) {
                          options.date_from = (0, moment_1.default)(options.date_from).format('YYYY-MM-DD');
                      }
                      if (options.date_to) {
                          options.date_to = (0, moment_1.default)(options.date_to).format('YYYY-MM-DD');
                      }
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `companies/${scorecardIdentifier}/history/factors/score`, {}, options);
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.splice(0, limit);
                      }
                      if (simple) {
                          responseData = (0, GenericFunctions_1.simplify)(responseData);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
                  if (operation === 'getHistoricalScore') {
                      const simple = this.getNodeParameter('simple', 0);
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const scorecardIdentifier = this.getNodeParameter('scorecardIdentifier', i);
                      const options = this.getNodeParameter('options', i);
                      if (options.date_from) {
                          options.from = (0, moment_1.default)(options.date_from).format('YYYY-MM-DD');
                          delete options.date_from;
                      }
                      if (options.date_to) {
                          options.to = (0, moment_1.default)(options.date_to).format('YYYY-MM-DD');
                          delete options.date_to;
                      }
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `companies/${scorecardIdentifier}/history/factors/score`, {}, options);
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.splice(0, limit);
                      }
                      if (simple) {
                          responseData = (0, GenericFunctions_1.simplify)(responseData);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
                  if (operation === 'getScorePlan') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const scorecardIdentifier = this.getNodeParameter('scorecardIdentifier', i);
                      const targetScore = this.getNodeParameter('score', i);
                      responseData = await GenericFunctions_1.scorecardApiRequest.call(this, 'GET', `companies/${scorecardIdentifier}/score-plans/by-target/${targetScore}`);
                      responseData = responseData.entries;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.splice(0, limit);
                      }
                      returnData.push.apply(returnData, responseData);
                  }
              }
          }
          if (resource === 'report' && operation === 'download') {
              return [items];
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.SecurityScorecard = SecurityScorecard;
  //# sourceMappingURL=SecurityScorecard.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SecurityScorecardApi = void 0;
  class SecurityScorecardApi {
      constructor() {
          this.name = 'securityScorecardApi';
          this.displayName = 'SecurityScorecard API';
          this.documentationUrl = 'securityScorecard';
          this.properties = [
              {
                  displayName: 'API Key',
                  name: 'apiKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
                  required: true,
              },
          ];
      }
  }
  exports.SecurityScorecardApi = SecurityScorecardApi;
  //# sourceMappingURL=SecurityScorecardApi.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SecurityScorecardApi = void 0;
  class SecurityScorecardApi {
      constructor() {
          this.name = 'securityScorecardApi';
          this.displayName = 'SecurityScorecard API';
          this.documentationUrl = 'securityScorecard';
          this.properties = [
              {
                  displayName: 'API Key',
                  name: 'apiKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
                  required: true,
              },
          ];
      }
  }
  exports.SecurityScorecardApi = SecurityScorecardApi;
  //# sourceMappingURL=SecurityScorecardApi.credentials.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: SecurityScorecard node documentation
  description: Learn how to use the SecurityScorecard node in n8n. Follow technical documentation to integrate SecurityScorecard node into your workflows.
  contentType: [integration, reference]
  ---

  # SecurityScorecard node

  Use the SecurityScorecard node to automate work in SecurityScorecard, and integrate SecurityScorecard with other applications. n8n has built-in support for a wide range of SecurityScorecard features, including creating, updating, deleting, and getting portfolio, as well as getting a company's data.

  On this page, you'll find a list of operations the SecurityScorecard node supports and links to more resources.

  /// note | Credentials
  Refer to [SecurityScorecard credentials](/integrations/builtin/credentials/securityscorecard.md) for guidance on setting up authentication. 
  ///

  ## Operations

  * Company
      * Get company factor scores and issue counts
      * Get company's historical factor scores
      * Get company's historical scores
      * Get company information and summary of their scorecard
      * Get company's score improvement plan
  * Industry
      * Get Factor Scores
      * Get Historical Factor Scores
      * Get Score
  * Invite
      * Create an invite for a company/user
  * Portfolio
      * Create a portfolio
      * Delete a portfolio
      * Get all portfolios
      * Update a portfolio
  * Portfolio Company
      * Add a company to portfolio
      * Get all companies in a portfolio
      * Remove a company from portfolio
  * Report
      * Download a generated report
      * Generate a report
      * Get list of recently generated report

  ## Templates and examples

  <!-- see https://www.notion.so/n8n/Pull-in-templates-for-the-integrations-pages-37c716837b804d30a33b47475f6e3780 -->
  [[ templatesWidget(page.title, 'securityscorecard') ]]

example_workflow:
  {"name":"SecurityScorecard Example Workflow","nodes":[{"parameters":{"resource":"company","dynamic_property":null},"id":"x0eky4zlpa9figl9z587h","name":"SecurityScorecard","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"Resource","name":"resource","type":"options","default":"company","required":true,"options":[{"name":"Company","value":"company"},{"name":"Industry","value":"industry"},{"name":"Invite","value":"invite"},{"name":"Portfolio","value":"portfolio"},{"name":"Portfolio Company","value":"portfolioCompany"},{"name":"Report","value":"report"}]},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...CompanyDescription_1.companyOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...CompanyDescription_1.companyFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...IndustryDescription_1.industryOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...IndustryDescription_1.industryFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...InviteDescription_1.inviteOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...InviteDescription_1.inviteFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...PortfolioDescription_1.portfolioOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...PortfolioDescription_1.portfolioFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...PortfolioCompanyDescription_1.portfolioCompanyOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...PortfolioCompanyDescription_1.portfolioCompanyFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...ReportDescription_1.reportOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...ReportDescription_1.reportFields"}]


node_type: n8n-nodes-base.Rundeck
name: Rundeck
display_name: Rundeck
description: Manage Rundeck API
category: transform
icon: file:rundeck.png
code_hash: 0aa78fa1476a33315899eb61c27e295d593c94d115557ab432a7b1b98023786e
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.Rundeck
documentation_title: Rundeck node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"rundeck","description":"Templates for rundeck"}]
related_resources: []
required_scopes: []
parameter_schemas: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:59:11
updated_at: 2025-06-12 08:59:11
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Rundeck = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const RundeckApi_1 = require("./RundeckApi");
  class Rundeck {
      constructor() {
          this.description = {
              displayName: 'Rundeck',
              name: 'rundeck',
              icon: 'file:rundeck.png',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Manage Rundeck API',
              defaults: {
                  name: 'Rundeck',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'rundeckApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Job',
                              value: 'job',
                          },
                      ],
                      default: 'job',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Execute',
                              value: 'execute',
                              description: 'Execute a job',
                              action: 'Execute a job',
                          },
                          {
                              name: 'Get Metadata',
                              value: 'getMetadata',
                              description: 'Get metadata of a job',
                              action: 'Get metadata of a job',
                          },
                      ],
                      default: 'execute',
                  },
                  {
                      displayName: 'Job ID',
                      name: 'jobid',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['execute'],
                              resource: ['job'],
                          },
                      },
                      default: '',
                      placeholder: 'Rundeck Job ID',
                      required: true,
                      description: 'The job ID to execute',
                  },
                  {
                      displayName: 'Arguments',
                      name: 'arguments',
                      placeholder: 'Add Argument',
                      type: 'fixedCollection',
                      typeOptions: {
                          multipleValues: true,
                      },
                      displayOptions: {
                          show: {
                              operation: ['execute'],
                              resource: ['job'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              name: 'arguments',
                              displayName: 'Arguments',
                              values: [
                                  {
                                      displayName: 'Name',
                                      name: 'name',
                                      type: 'string',
                                      default: '',
                                  },
                                  {
                                      displayName: 'Value',
                                      name: 'value',
                                      type: 'string',
                                      default: '',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Filter',
                      name: 'filter',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['execute'],
                              resource: ['job'],
                          },
                      },
                      default: '',
                      placeholder: 'Add Filters',
                      description: 'Filter Rundeck nodes by name',
                  },
                  {
                      displayName: 'Job ID',
                      name: 'jobid',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['getMetadata'],
                              resource: ['job'],
                          },
                      },
                      default: '',
                      placeholder: 'Rundeck Job ID',
                      required: true,
                      description: 'The job ID to get metadata off',
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const operation = this.getNodeParameter('operation', 0);
          const resource = this.getNodeParameter('resource', 0);
          const rundeckApi = new RundeckApi_1.RundeckApi(this);
          await rundeckApi.init();
          for (let i = 0; i < length; i++) {
              if (resource === 'job') {
                  if (operation === 'execute') {
                      const jobid = this.getNodeParameter('jobid', i);
                      const rundeckArguments = this.getNodeParameter('arguments', i)
                          .arguments;
                      const filter = this.getNodeParameter('filter', i);
                      const response = await rundeckApi.executeJob(jobid, rundeckArguments, filter);
                      returnData.push(response);
                  }
                  else if (operation === 'getMetadata') {
                      const jobid = this.getNodeParameter('jobid', i);
                      const response = await rundeckApi.getJobMetadata(jobid);
                      returnData.push(response);
                  }
                  else {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not supported!`, { itemIndex: i });
                  }
              }
              else {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not supported!`, { itemIndex: i });
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Rundeck = Rundeck;
  //# sourceMappingURL=Rundeck.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.RundeckApi = void 0;
  class RundeckApi {
      constructor() {
          this.name = 'rundeckApi';
          this.displayName = 'Rundeck API';
          this.documentationUrl = 'rundeck';
          this.properties = [
              {
                  displayName: 'Url',
                  name: 'url',
                  type: 'string',
                  default: '',
                  placeholder: 'http://127.0.0.1:4440',
              },
              {
                  displayName: 'Token',
                  name: 'token',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
          ];
          this.authenticate = {
              type: 'generic',
              properties: {
                  headers: {
                      'user-agent': 'n8n',
                      'X-Rundeck-Auth-Token': '={{$credentials?.token}}',
                  },
              },
          };
          this.test = {
              request: {
                  baseURL: '={{$credentials.url}}',
                  url: '/api/14/system/info',
                  method: 'GET',
              },
          };
      }
  }
  exports.RundeckApi = RundeckApi;
  //# sourceMappingURL=RundeckApi.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.RundeckApi = void 0;
  class RundeckApi {
      constructor() {
          this.name = 'rundeckApi';
          this.displayName = 'Rundeck API';
          this.documentationUrl = 'rundeck';
          this.properties = [
              {
                  displayName: 'Url',
                  name: 'url',
                  type: 'string',
                  default: '',
                  placeholder: 'http://127.0.0.1:4440',
              },
              {
                  displayName: 'Token',
                  name: 'token',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
          ];
          this.authenticate = {
              type: 'generic',
              properties: {
                  headers: {
                      'user-agent': 'n8n',
                      'X-Rundeck-Auth-Token': '={{$credentials?.token}}',
                  },
              },
          };
          this.test = {
              request: {
                  baseURL: '={{$credentials.url}}',
                  url: '/api/14/system/info',
                  method: 'GET',
              },
          };
      }
  }
  exports.RundeckApi = RundeckApi;
  //# sourceMappingURL=RundeckApi.credentials.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: Rundeck node documentation
  description: Learn how to use the Rundeck node in n8n. Follow technical documentation to integrate Rundeck node into your workflows.
  contentType: [integration, reference]
  ---

  # Rundeck node

  Use the Rundeck node to automate work in Rundeck, and integrate Rundeck with other applications. n8n has built-in support for executing jobs and getting metadata.

  On this page, you'll find a list of operations the Rundeck node supports and links to more resources.

  /// note | Credentials
  Refer to [Rundeck credentials](/integrations/builtin/credentials/rundeck.md) for guidance on setting up authentication. 
  ///

  ## Operations

  - **Job**
      - Execute a job
      - Get metadata of a job

  ## Templates and examples

  <!-- see https://www.notion.so/n8n/Pull-in-templates-for-the-integrations-pages-37c716837b804d30a33b47475f6e3780 -->
  [[ templatesWidget(page.title, 'rundeck') ]]

  --8<-- "_snippets/integrations/builtin/app-nodes/operation-not-supported.md"

  ## Find the job ID

  1. Access your Rundeck dashboard.
  2. Open the project that contains the job you want to use with n8n.
  3. In the sidebar, select **JOBS**.
  4. Under **All Jobs**, select the name of the job you want to use with n8n.
  5. In the top left corner, under the name of the job, copy the string that's displayed in smaller font below the job name. This is your job ID.
  6. Paste this job ID in the **Job Id** field in n8n.

troubleshooting_info:
  [{"issue":"Find the job ID","solution":"1. Access your Rundeck dashboard.\n2. Open the project that contains the job you want to use with n8n.\n3. In the sidebar, select **JOBS**.\n4. Under **All Jobs**, select the name of the job you want to use with n8n.\n5. In the top left corner, under the name of the job, copy the string that's displayed in smaller font below the job name. This is your job ID.\n6. Paste this job ID in the **Job Id** field in n8n."}]

example_workflow:
  {"name":"Rundeck Example Workflow","nodes":[{"parameters":{"resource":"job","operation":"execute","jobid":"example-value","arguments":{},"filter":"example-value"},"id":"ohsb4ywft26h2efksr3k5","name":"Rundeck","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

example_parameters:
  {"resource":"job","operation":"execute","jobid":"example-value","arguments":{},"filter":"example-value"}

properties_schema:
  [{"displayName":"Resource","name":"resource","type":"options","default":"job","options":[{"name":"Job","value":"job"}]},{"displayName":"Operation","name":"operation","type":"options","default":"execute","description":"Execute a job","options":[{"name":"Execute","value":"execute","description":"Execute a job"},{"name":"Get Metadata","value":"getMetadata","description":"Get metadata of a job"}]},{"displayName":"Job ID","name":"jobid","type":"string","default":"","required":true,"description":"The job ID to execute","placeholder":"Rundeck Job ID"},{"displayName":"Arguments","name":"arguments","type":"fixedCollection","default":"{","placeholder":"Add Argument"},{"displayName":"Filter","name":"filter","type":"string","default":"","description":"Filter Rundeck nodes by name","placeholder":"Add Filters"},{"displayName":"Job ID","name":"jobid","type":"string","default":"","required":true,"description":"The job ID to get metadata off","placeholder":"Rundeck Job ID"}]


node_type: n8n-nodes-base.Segment
name: Segment
display_name: Segment
description: Consume Segment API
category: output
icon: file:segment.svg
code_hash: 9fc9d8949d7a2d9b8ae94a10b699705756e1f9f2cb2e6a0feeff301b5108b19d
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.Segment
documentation_title: Segment node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"segment","description":"Templates for segment"}]
related_resources: []
required_scopes: []
parameter_schemas: []
troubleshooting_info: []
example_parameters: {"resource":"group","dynamic_property":null}
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-12 08:59:11
updated_at: 2025-06-12 08:59:11
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Segment = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const GroupDescription_1 = require("./GroupDescription");
  const IdentifyDescription_1 = require("./IdentifyDescription");
  const TrackDescription_1 = require("./TrackDescription");
  const uuid_1 = require("uuid");
  class Segment {
      constructor() {
          this.description = {
              displayName: 'Segment',
              name: 'segment',
              icon: 'file:segment.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ":" + $parameter["resource"]}}',
              description: 'Consume Segment API',
              defaults: {
                  name: 'Segment',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'segmentApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Group',
                              value: 'group',
                              description: 'Group lets you associate an identified user with a group',
                          },
                          {
                              name: 'Identify',
                              value: 'identify',
                              description: 'Identify lets you tie a user to their actions',
                          },
                          {
                              name: 'Track',
                              value: 'track',
                              description: 'Track lets you record events',
                          },
                      ],
                      default: 'identify',
                  },
                  ...GroupDescription_1.groupOperations,
                  ...GroupDescription_1.groupFields,
                  ...IdentifyDescription_1.identifyOperations,
                  ...TrackDescription_1.trackOperations,
                  ...IdentifyDescription_1.identifyFields,
                  ...TrackDescription_1.trackFields,
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'group') {
                      if (operation === 'add') {
                          const userId = this.getNodeParameter('userId', i);
                          const groupId = this.getNodeParameter('groupId', i);
                          const traits = this.getNodeParameter('traits', i)
                              .traitsUi;
                          const context = this.getNodeParameter('context', i)
                              .contextUi;
                          const integrations = this.getNodeParameter('integrations', i)
                              .integrationsUi;
                          const body = {
                              groupId,
                              traits: {
                                  company: {},
                                  address: {},
                              },
                              context: {
                                  app: {},
                                  campaign: {},
                                  device: {},
                              },
                              integrations: {},
                          };
                          if (userId) {
                              body.userId = userId;
                          }
                          else {
                              body.anonymousId = (0, uuid_1.v4)();
                          }
                          if (traits) {
                              if (traits && traits.length !== 0) {
                                  for (const trait of traits) {
                                      body.traits[trait.key] = trait.value;
                                  }
                              }
                          }
                          if (context) {
                              if (context.active) {
                                  body.context.active = context.active;
                              }
                              if (context.ip) {
                                  body.context.ip = context.ip;
                              }
                              if (context.locate) {
                                  body.context.locate = context.locate;
                              }
                              if (context.page) {
                                  body.context.page = context.page;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.app) {
                                  const app = context.app.appUi;
                                  if (app) {
                                      if (app.name) {
                                          body.context.app.name = app.name;
                                      }
                                      if (app.version) {
                                          body.context.app.version = app.version;
                                      }
                                      if (app.build) {
                                          body.context.app.build = app.build;
                                      }
                                  }
                              }
                              if (context.campaign) {
                                  const campaign = context.campaign.campaignUi;
                                  if (campaign) {
                                      if (campaign.name) {
                                          body.context.campaign.name = campaign.name;
                                      }
                                      if (campaign.source) {
                                          body.context.campaign.source = campaign.source;
                                      }
                                      if (campaign.medium) {
                                          body.context.campaign.medium = campaign.medium;
                                      }
                                      if (campaign.term) {
                                          body.context.campaign.term = campaign.term;
                                      }
                                      if (campaign.content) {
                                          body.context.campaign.content = campaign.content;
                                      }
                                  }
                              }
                              if (context.device) {
                                  const device = context.device.deviceUi;
                                  if (device) {
                                      if (device.id) {
                                          body.context.device.id = device.id;
                                      }
                                      if (device.manufacturer) {
                                          body.context.device.manufacturer = device.manufacturer;
                                      }
                                      if (device.model) {
                                          body.context.device.model = device.model;
                                      }
                                      if (device.type) {
                                          body.context.device.type = device.type;
                                      }
                                      if (device.version) {
                                          body.context.device.version = device.version;
                                      }
                                  }
                              }
                          }
                          if (integrations) {
                              if (integrations.all) {
                                  body.integrations.all = integrations.all;
                              }
                              if (integrations.salesforce) {
                                  body.integrations.salesforce = integrations.salesforce;
                              }
                          }
                          responseData = await GenericFunctions_1.segmentApiRequest.call(this, 'POST', '/group', body);
                      }
                  }
                  if (resource === 'identify') {
                      if (operation === 'create') {
                          const userId = this.getNodeParameter('userId', i);
                          const context = this.getNodeParameter('context', i)
                              .contextUi;
                          const traits = this.getNodeParameter('traits', i)
                              .traitsUi;
                          const integrations = this.getNodeParameter('integrations', i)
                              .integrationsUi;
                          const body = {
                              context: {
                                  app: {},
                                  campaign: {},
                                  device: {},
                              },
                              traits: {},
                              integrations: {},
                          };
                          if (userId) {
                              body.userId = userId;
                          }
                          else {
                              body.anonymousId = (0, uuid_1.v4)();
                          }
                          if (context) {
                              if (context.active) {
                                  body.context.active = context.active;
                              }
                              if (context.ip) {
                                  body.context.ip = context.ip;
                              }
                              if (context.locate) {
                                  body.context.locate = context.locate;
                              }
                              if (context.page) {
                                  body.context.page = context.page;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.app) {
                                  const app = context.app.appUi;
                                  if (app) {
                                      if (app.name) {
                                          body.context.app.name = app.name;
                                      }
                                      if (app.version) {
                                          body.context.app.version = app.version;
                                      }
                                      if (app.build) {
                                          body.context.app.build = app.build;
                                      }
                                  }
                              }
                              if (context.campaign) {
                                  const campaign = context.campaign.campaignUi;
                                  if (campaign) {
                                      if (campaign.name) {
                                          body.context.campaign.name = campaign.name;
                                      }
                                      if (campaign.source) {
                                          body.context.campaign.source = campaign.source;
                                      }
                                      if (campaign.medium) {
                                          body.context.campaign.medium = campaign.medium;
                                      }
                                      if (campaign.term) {
                                          body.context.campaign.term = campaign.term;
                                      }
                                      if (campaign.content) {
                                          body.context.campaign.content = campaign.content;
                                      }
                                  }
                              }
                              if (context.device) {
                                  const device = context.device.deviceUi;
                                  if (device) {
                                      if (device.id) {
                                          body.context.device.id = device.id;
                                      }
                                      if (device.manufacturer) {
                                          body.context.device.manufacturer = device.manufacturer;
                                      }
                                      if (device.model) {
                                          body.context.device.model = device.model;
                                      }
                                      if (device.type) {
                                          body.context.device.type = device.type;
                                      }
                                      if (device.version) {
                                          body.context.device.version = device.version;
                                      }
                                  }
                              }
                          }
                          if (integrations) {
                              if (integrations.all) {
                                  body.integrations.all = integrations.all;
                              }
                              if (integrations.salesforce) {
                                  body.integrations.salesforce = integrations.salesforce;
                              }
                          }
                          if (traits) {
                              if (traits && traits.length !== 0) {
                                  for (const trait of traits) {
                                      body.traits[trait.key] = trait.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.segmentApiRequest.call(this, 'POST', '/identify', body);
                      }
                  }
                  if (resource === 'track') {
                      if (operation === 'event') {
                          const userId = this.getNodeParameter('userId', i);
                          const event = this.getNodeParameter('event', i);
                          const context = this.getNodeParameter('context', i)
                              .contextUi;
                          const integrations = this.getNodeParameter('integrations', i)
                              .integrationsUi;
                          const properties = this.getNodeParameter('properties', i)
                              .propertiesUi;
                          const body = {
                              event,
                              traits: {},
                              context: {
                                  app: {},
                                  campaign: {},
                                  device: {},
                              },
                              integrations: {},
                              properties: {},
                          };
                          if (userId) {
                              body.userId = userId;
                          }
                          else {
                              body.anonymousId = (0, uuid_1.v4)();
                          }
                          if (context) {
                              if (context.active) {
                                  body.context.active = context.active;
                              }
                              if (context.ip) {
                                  body.context.ip = context.ip;
                              }
                              if (context.locate) {
                                  body.context.locate = context.locate;
                              }
                              if (context.page) {
                                  body.context.page = context.page;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.app) {
                                  const app = context.app.appUi;
                                  if (app) {
                                      if (app.name) {
                                          body.context.app.name = app.name;
                                      }
                                      if (app.version) {
                                          body.context.app.version = app.version;
                                      }
                                      if (app.build) {
                                          body.context.app.build = app.build;
                                      }
                                  }
                              }
                              if (context.campaign) {
                                  const campaign = context.campaign.campaignUi;
                                  if (campaign) {
                                      if (campaign.name) {
                                          body.context.campaign.name = campaign.name;
                                      }
                                      if (campaign.source) {
                                          body.context.campaign.source = campaign.source;
                                      }
                                      if (campaign.medium) {
                                          body.context.campaign.medium = campaign.medium;
                                      }
                                      if (campaign.term) {
                                          body.context.campaign.term = campaign.term;
                                      }
                                      if (campaign.content) {
                                          body.context.campaign.content = campaign.content;
                                      }
                                  }
                              }
                              if (context.device) {
                                  const device = context.device.deviceUi;
                                  if (device) {
                                      if (device.id) {
                                          body.context.device.id = device.id;
                                      }
                                      if (device.manufacturer) {
                                          body.context.device.manufacturer = device.manufacturer;
                                      }
                                      if (device.model) {
                                          body.context.device.model = device.model;
                                      }
                                      if (device.type) {
                                          body.context.device.type = device.type;
                                      }
                                      if (device.version) {
                                          body.context.device.version = device.version;
                                      }
                                  }
                              }
                          }
                          if (integrations) {
                              if (integrations.all) {
                                  body.integrations.all = integrations.all;
                              }
                              if (integrations.salesforce) {
                                  body.integrations.salesforce = integrations.salesforce;
                              }
                          }
                          if (properties) {
                              if (properties && properties.length !== 0) {
                                  for (const property of properties) {
                                      body.properties[property.key] = property.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.segmentApiRequest.call(this, 'POST', '/track', body);
                      }
                      if (operation === 'page') {
                          const userId = this.getNodeParameter('userId', i);
                          const name = this.getNodeParameter('name', i);
                          const context = this.getNodeParameter('context', i)
                              .contextUi;
                          const integrations = this.getNodeParameter('integrations', i)
                              .integrationsUi;
                          const properties = this.getNodeParameter('properties', i)
                              .propertiesUi;
                          const body = {
                              name,
                              traits: {},
                              context: {
                                  app: {},
                                  campaign: {},
                                  device: {},
                              },
                              integrations: {},
                              properties: {},
                          };
                          if (userId) {
                              body.userId = userId;
                          }
                          else {
                              body.anonymousId = (0, uuid_1.v4)();
                          }
                          if (context) {
                              if (context.active) {
                                  body.context.active = context.active;
                              }
                              if (context.ip) {
                                  body.context.ip = context.ip;
                              }
                              if (context.locate) {
                                  body.context.locate = context.locate;
                              }
                              if (context.page) {
                                  body.context.page = context.page;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.timezone) {
                                  body.context.timezone = context.timezone;
                              }
                              if (context.app) {
                                  const app = context.app.appUi;
                                  if (app) {
                                      if (app.name) {
                                          body.context.app.name = app.name;
                                      }
                                      if (app.version) {
                                          body.context.app.version = app.version;
                                      }
                                      if (app.build) {
                                          body.context.app.build = app.build;
                                      }
                                  }
                              }
                              if (context.campaign) {
                                  const campaign = context.campaign.campaignUi;
                                  if (campaign) {
                                      if (campaign.name) {
                                          body.context.campaign.name = campaign.name;
                                      }
                                      if (campaign.source) {
                                          body.context.campaign.source = campaign.source;
                                      }
                                      if (campaign.medium) {
                                          body.context.campaign.medium = campaign.medium;
                                      }
                                      if (campaign.term) {
                                          body.context.campaign.term = campaign.term;
                                      }
                                      if (campaign.content) {
                                          body.context.campaign.content = campaign.content;
                                      }
                                  }
                              }
                              if (context.device) {
                                  const device = context.device.deviceUi;
                                  if (device) {
                                      if (device.id) {
                                          body.context.device.id = device.id;
                                      }
                                      if (device.manufacturer) {
                                          body.context.device.manufacturer = device.manufacturer;
                                      }
                                      if (device.model) {
                                          body.context.device.model = device.model;
                                      }
                                      if (device.type) {
                                          body.context.device.type = device.type;
                                      }
                                      if (device.version) {
                                          body.context.device.version = device.version;
                                      }
                                  }
                              }
                          }
                          if (integrations) {
                              if (integrations.all) {
                                  body.integrations.all = integrations.all;
                              }
                              if (integrations.salesforce) {
                                  body.integrations.salesforce = integrations.salesforce;
                              }
                          }
                          if (properties) {
                              if (properties && properties.length !== 0) {
                                  for (const property of properties) {
                                      body.properties[property.key] = property.value;
                                  }
                              }
                          }
                          responseData = await GenericFunctions_1.segmentApiRequest.call(this, 'POST', '/page', body);
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ error: error.message });
                      continue;
                  }
                  throw error;
              }
              if (Array.isArray(responseData)) {
                  returnData.push.apply(returnData, responseData);
              }
              else {
                  returnData.push(responseData);
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Segment = Segment;
  //# sourceMappingURL=Segment.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SegmentApi = void 0;
  class SegmentApi {
      constructor() {
          this.name = 'segmentApi';
          this.displayName = 'Segment API';
          this.documentationUrl = 'segment';
          this.properties = [
              {
                  displayName: 'Write Key',
                  name: 'writekey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
          ];
      }
      async authenticate(credentials, requestOptions) {
          const base64Key = Buffer.from(`${credentials.writekey}:`).toString('base64');
          requestOptions.headers.Authorization = `Basic ${base64Key}`;
          return requestOptions;
      }
  }
  exports.SegmentApi = SegmentApi;
  //# sourceMappingURL=SegmentApi.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SegmentApi = void 0;
  class SegmentApi {
      constructor() {
          this.name = 'segmentApi';
          this.displayName = 'Segment API';
          this.documentationUrl = 'segment';
          this.properties = [
              {
                  displayName: 'Write Key',
                  name: 'writekey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
          ];
      }
      async authenticate(credentials, requestOptions) {
          const base64Key = Buffer.from(`${credentials.writekey}:`).toString('base64');
          requestOptions.headers.Authorization = `Basic ${base64Key}`;
          return requestOptions;
      }
  }
  exports.SegmentApi = SegmentApi;
  //# sourceMappingURL=SegmentApi.credentials.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: Segment node documentation
  description: Learn how to use the Segment node in n8n. Follow technical documentation to integrate Segment node into your workflows.
  contentType: [integration, reference]
  ---

  # Segment node

  Use the Segment node to automate work in Segment, and integrate Segment with other applications. n8n has built-in support for a wide range of Segment features, including adding users to groups, creating identities, and tracking activities. 

  On this page, you'll find a list of operations the Segment node supports and links to more resources.

  /// note | Credentials
  Refer to [Segment credentials](/integrations/builtin/credentials/segment.md) for guidance on setting up authentication. 
  ///

  ## Operations

  * Group
      * Add a user to a group
  * Identify
      * Create an identity
  * Track
      * Record the actions your users perform. Every action triggers an event, which can also have associated properties.
      * Record page views on your website, along with optional extra information about the page being viewed.

  ## Templates and examples

  <!-- see https://www.notion.so/n8n/Pull-in-templates-for-the-integrations-pages-37c716837b804d30a33b47475f6e3780 -->
  [[ templatesWidget(page.title, 'segment') ]]

  --8<-- "_snippets/integrations/builtin/app-nodes/operation-not-supported.md"

example_workflow:
  {"name":"Segment Example Workflow","nodes":[{"parameters":{"resource":"group","dynamic_property":null},"id":"kx7dspq0q1gblyw5055zx","name":"Segment","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}

properties_schema:
  [{"displayName":"Resource","name":"resource","type":"options","default":"identify","description":"Group lets you associate an identified user with a group","options":[{"name":"Group","value":"group","description":"Group lets you associate an identified user with a group"},{"name":"Identify","value":"identify","description":"Identify lets you tie a user to their actions"},{"name":"Track","value":"track","description":"Track lets you record events"}]},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...GroupDescription_1.groupOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...GroupDescription_1.groupFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...IdentifyDescription_1.identifyOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...TrackDescription_1.trackOperations"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...IdentifyDescription_1.identifyFields"},{"name":"dynamic_property","type":"unknown","displayName":"Dynamic Property","_source":"...TrackDescription_1.trackFields"}]


node_type: n8n-nodes-base.Set
name: Set
display_name: Set
description: Add or edit fields on an input item and optionally remove other fields
category: input
icon: fa:pen
code_hash: 4414ad216090aa4ae629fc2ed5ae175c48bde7392d1133b82f472edcd1620065
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.Set
documentation_title: Edit Fields (Set)
operations: []
api_methods: []
templates: [{"name":"set","description":"Templates for set"}]
related_resources: []
required_scopes: []
parameter_schemas: []
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-12 08:59:13
updated_at: 2025-06-12 08:59:13
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Set = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const SetV1_node_1 = require("./v1/SetV1.node");
  const SetV2_node_1 = require("./v2/SetV2.node");
  class Set extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'Set',
              name: 'set',
              icon: 'fa:pen',
              group: ['input'],
              description: 'Add or edit fields on an input item and optionally remove other fields',
              defaultVersion: 3.2,
          };
          const nodeVersions = {
              1: new SetV1_node_1.SetV1(baseDescription),
              2: new SetV1_node_1.SetV1(baseDescription),
              3: new SetV2_node_1.SetV2(baseDescription),
              3.1: new SetV2_node_1.SetV2(baseDescription),
              3.2: new SetV2_node_1.SetV2(baseDescription),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.Set = Set;
  //# sourceMappingURL=Set.node.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: Edit Fields (Set)
  description: Documentation for the Edit Fields node in n8n, a workflow automation platform. Includes guidance on usage, and links to examples.
  contentType: [integration, reference]
  priority: critical
  ---

  # Edit Fields (Set)

  Use the Edit Fields node to set workflow data. This node can set new data as well as overwrite data that already exists. This node is crucial in workflows which expect incoming data from previous nodes, such as when inserting values to Google Sheets or databases.

  ## Node parameters

  These are the settings and options available in the Edit Fields node.

  ### Mode

  You can either use **Manual Mapping** to edit fields using the GUI or **JSON Output** to write JSON that n8n adds to the input data.

  ### Fields to Set

  If you select **Mode** > **Manual Mapping**, you can configure the fields by dragging and dropping values from **INPUT**.

  The default behavior when you drag a value is:

  * n8n sets the value's name as the field name.
  * The field value contains an expression which accesses the value.

  If you don't want to use expressions:

  1. Hover over a field. n8n displays the **Fixed | Expressions** toggle. 
  1. Select **Fixed**.

  You can do this for both the name and value of the field.

  ![A gif showing the drag and drop action, as well as changing a field to fixed](/_images/integrations/builtin/core-nodes/set/drag-drop-fixed-toggle.gif)

  ### Keep Only Set Fields

  Enable this to discard any input data that you don't use in **Fields to Set**.

  ### Include in Output

  Choose which input data to include in the node's output data.

  ## Node options

  Use these options to customize the behavior of the node.

  ### Include Binary Data

  If the input data includes binary data, choose whether to include it in the Edit Fields node's output data.

  ### Ignore Type Conversion Errors

  Manual Mapping only.

  Enabling this allows n8n to ignore some data type errors when mapping fields.

  ### Support Dot Notation

  By default, n8n supports dot notation.

  For example, when using manual mapping, the node follows the dot notation for the **Name** field. That means if you set the name in the **Name** field as `number.one` and the value in the **Value** field as `20`, the resulting JSON is:

  ```json
  { "number": { "one": 20} }
  ```

  You can prevent this behavior by selecting **Add Option** > **Support Dot Notation**, and setting the **Dot Notion** field to off. Now the resulting JSON is:

  ```json
  { "number.one": 20 }
  ```
  ## Templates and examples

  <!-- see https://www.notion.so/n8n/Pull-in-templates-for-the-integrations-pages-37c716837b804d30a33b47475f6e3780 -->
  [[ templatesWidget(page.title, 'set') ]]

  ## Arrays and expressions in JSON Output mode

  You can use arrays and expressions when creating your JSON Output.

  For example, given this input data generated by the Customer Datastore node:

  ```json
  [
    {
      "id": "23423532",
      "name": "Jay Gatsby",
      "email": "gatsby@west-egg.com",
      "notes": "Keeps asking about a green light??",
      "country": "US",
      "created": "1925-04-10"
    },
    {
      "id": "23423533",
      "name": "José Arcadio Buendía",
      "email": "jab@macondo.co",
      "notes": "Lots of people named after him. Very confusing",
      "country": "CO",
      "created": "1967-05-05"
    },
    {
      "id": "23423534",
      "name": "Max Sendak",
      "email": "info@in-and-out-of-weeks.org",
      "notes": "Keeps rolling his terrible eyes",
      "country": "US",
      "created": "1963-04-09"
    },
    {
      "id": "23423535",
      "name": "Zaphod Beeblebrox",
      "email": "captain@heartofgold.com",
      "notes": "Felt like I was talking to more than one person",
      "country": null,
      "created": "1979-10-12"
    },
    {
      "id": "23423536",
      "name": "Edmund Pevensie",
      "email": "edmund@narnia.gov",
      "notes": "Passionate sailor",
      "country": "UK",
      "created": "1950-10-16"
    }
  ]
  ```

  Add the following JSON in the **JSON Output** field, with **Include in Output** set to **All Input Fields**:

  ```json
  {
    "newKey": "new value",
    "array": [{{ $json.id }},"{{ $json.name }}"],
    "object": {
      "innerKey1": "new value",
      "innerKey2": "{{ $json.id }}",
      "innerKey3": "{{ $json.name }}",
   }
  }
  ```

  You get this output:

  ```json
  [
    {
      "id": "23423532",
      "name": "Jay Gatsby",
      "email": "gatsby@west-egg.com",
      "notes": "Keeps asking about a green light??",
      "country": "US",
      "created": "1925-04-10",
      "newKey": "new value",
      "array": [
        23423532,
        "Jay Gatsby"
      ],
      "object": {
        "innerKey1": "new value",
        "innerKey2": "23423532",
        "innerKey3": "Jay Gatsby"
      }
    },
    {
      "id": "23423533",
      "name": "José Arcadio Buendía",
      "email": "jab@macondo.co",
      "notes": "Lots of people named after him. Very confusing",
      "country": "CO",
      "created": "1967-05-05",
      "newKey": "new value",
      "array": [
        23423533,
        "José Arcadio Buendía"
      ],
      "object": {
        "innerKey1": "new value",
        "innerKey2": "23423533",
        "innerKey3": "José Arcadio Buendía"
      }
    },
    {
      "id": "23423534",
      "name": "Max Sendak",
      "email": "info@in-and-out-of-weeks.org",
      "notes": "Keeps rolling his terrible eyes",
      "country": "US",
      "created": "1963-04-09",
      "newKey": "new value",
      "array": [
        23423534,
        "Max Sendak"
      ],
      "object": {
        "innerKey1": "new value",
        "innerKey2": "23423534",
        "innerKey3": "Max Sendak"
      }
    },
    {
      "id": "23423535",
      "name": "Zaphod Beeblebrox",
      "email": "captain@heartofgold.com",
      "notes": "Felt like I was talking to more than one person",
      "country": null,
      "created": "1979-10-12",
      "newKey": "new value",
      "array": [
        23423535,
        "Zaphod Beeblebrox"
      ],
      "object": {
        "innerKey1": "new value",
        "innerKey2": "23423535",
        "innerKey3": "Zaphod Beeblebrox"
      }
    },
    {
      "id": "23423536",
      "name": "Edmund Pevensie",
      "email": "edmund@narnia.gov",
      "notes": "Passionate sailor",
      "country": "UK",
      "created": "1950-10-16",
      "newKey": "new value",
      "array": [
        23423536,
        "Edmund Pevensie"
      ],
      "object": {
        "innerKey1": "new value",
        "innerKey2": "23423536",
        "innerKey3": "Edmund Pevensie"
      }
    }
  ]
  ```

documentation_examples:
  [{"type":"json","language":"json","code":"{ \"number\": { \"one\": 20} }","title":"g, the node follows the dot notation for the **Name** field. That means if you set the name in the **Name** field as `number.one` and the value in the **Value** field as `20`, the resulting JSON is"},{"type":"json","language":"json","code":"{ \"number.one\": 20 }","title":"You can prevent this behavior by selecting **Add Option** > **Support Dot Notation**, and setting the **Dot Notion** field to off. Now the resulting JSON is"},{"type":"json","language":"json","code":"[\n  {\n    \"id\": \"23423532\",\n    \"name\": \"Jay Gatsby\",\n    \"email\": \"gatsby@west-egg.com\",\n    \"notes\": \"Keeps asking about a green light??\",\n    \"country\": \"US\",\n    \"created\": \"1925-04-10\"\n  },\n  {\n    \"id\": \"23423533\",\n    \"name\": \"José Arcadio Buendía\",\n    \"email\": \"jab@macondo.co\",\n    \"notes\": \"Lots of people named after him. Very confusing\",\n    \"country\": \"CO\",\n    \"created\": \"1967-05-05\"\n  },\n  {\n    \"id\": \"23423534\",\n    \"name\": \"Max Sendak\",\n    \"email\": \"info@in-and-out-of-weeks.org\",\n    \"notes\": \"Keeps rolling his terrible eyes\",\n    \"country\": \"US\",\n    \"created\": \"1963-04-09\"\n  },\n  {\n    \"id\": \"23423535\",\n    \"name\": \"Zaphod Beeblebrox\",\n    \"email\": \"captain@heartofgold.com\",\n    \"notes\": \"Felt like I was talking to more than one person\",\n    \"country\": null,\n    \"created\": \"1979-10-12\"\n  },\n  {\n    \"id\": \"23423536\",\n    \"name\": \"Edmund Pevensie\",\n    \"email\": \"edmund@narnia.gov\",\n    \"notes\": \"Passionate sailor\",\n    \"country\": \"UK\",\n    \"created\": \"1950-10-16\"\n  }\n]","title":"For example, given this input data generated by the Customer Datastore node"},{"type":"json","language":"json","code":"[\n  {\n    \"id\": \"23423532\",\n    \"name\": \"Jay Gatsby\",\n    \"email\": \"gatsby@west-egg.com\",\n    \"notes\": \"Keeps asking about a green light??\",\n    \"country\": \"US\",\n    \"created\": \"1925-04-10\",\n    \"newKey\": \"new value\",\n    \"array\": [\n      23423532,\n      \"Jay Gatsby\"\n    ],\n    \"object\": {\n      \"innerKey1\": \"new value\",\n      \"innerKey2\": \"23423532\",\n      \"innerKey3\": \"Jay Gatsby\"\n    }\n  },\n  {\n    \"id\": \"23423533\",\n    \"name\": \"José Arcadio Buendía\",\n    \"email\": \"jab@macondo.co\",\n    \"notes\": \"Lots of people named after him. Very confusing\",\n    \"country\": \"CO\",\n    \"created\": \"1967-05-05\",\n    \"newKey\": \"new value\",\n    \"array\": [\n      23423533,\n      \"José Arcadio Buendía\"\n    ],\n    \"object\": {\n      \"innerKey1\": \"new value\",\n      \"innerKey2\": \"23423533\",\n      \"innerKey3\": \"José Arcadio Buendía\"\n    }\n  },\n  {\n    \"id\": \"23423534\",\n    \"name\": \"Max Sendak\",\n    \"email\": \"info@in-and-out-of-weeks.org\",\n    \"notes\": \"Keeps rolling his terrible eyes\",\n    \"country\": \"US\",\n    \"created\": \"1963-04-09\",\n    \"newKey\": \"new value\",\n    \"array\": [\n      23423534,\n      \"Max Sendak\"\n    ],\n    \"object\": {\n      \"innerKey1\": \"new value\",\n      \"innerKey2\": \"23423534\",\n      \"innerKey3\": \"Max Sendak\"\n    }\n  },\n  {\n    \"id\": \"23423535\",\n    \"name\": \"Zaphod Beeblebrox\",\n    \"email\": \"captain@heartofgold.com\",\n    \"notes\": \"Felt like I was talking to more than one person\",\n    \"country\": null,\n    \"created\": \"1979-10-12\",\n    \"newKey\": \"new value\",\n    \"array\": [\n      23423535,\n      \"Zaphod Beeblebrox\"\n    ],\n    \"object\": {\n      \"innerKey1\": \"new value\",\n      \"innerKey2\": \"23423535\",\n      \"innerKey3\": \"Zaphod Beeblebrox\"\n    }\n  },\n  {\n    \"id\": \"23423536\",\n    \"name\": \"Edmund Pevensie\",\n    \"email\": \"edmund@narnia.gov\",\n    \"notes\": \"Passionate sailor\",\n    \"country\": \"UK\",\n    \"created\": \"1950-10-16\",\n    \"newKey\": \"new value\",\n    \"array\": [\n      23423536,\n      \"Edmund Pevensie\"\n    ],\n    \"object\": {\n      \"innerKey1\": \"new value\",\n      \"innerKey2\": \"23423536\",\n      \"innerKey3\": \"Edmund Pevensie\"\n    }\n  }\n]","title":"You get this output"}]

workflow_examples:
  [{"name":"chat_with_google_sheets_docs_version","workflow":{"name":"Chat with Google Sheets (docs version)","nodes":[{"parameters":{},"id":"e96a5e41-f0d6-49c1-977e-ff724a857212","name":"Execute Workflow Trigger","type":"n8n-nodes-base.executeWorkflowTrigger","position":[540,1240],"typeVersion":1},{"parameters":{"content":"### Sub-workflow: Custom tool\nThe agent above can call this workflow. It returns three different types of data from the Google Sheet, which can be used together for more complex queries without returning the whole sheet (which might be too big for GPT to handle).","height":612.0936015224503,"width":1449.2963504228514,"color":7},"id":"67facef0-e9c6-4280-8232-78f654b420d5","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[461.9740563285368,970.616715060075],"typeVersion":1},{"parameters":{"content":"### Main workflow: AI agent using custom tool","height":486.5625,"width":927.5,"color":7},"id":"bc448102-954b-451e-9bf7-bcadbc53bdbc","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[460,460],"typeVersion":1},{"parameters":{"content":"## Try it out\n\nSelect **Chat** at the bottom and enter:\n\n_Which is our biggest customer?_","height":183.85014518022527,"width":185.9375,"color":4},"id":"afb2da2f-8da2-4ee8-bff9-55a99eeecc5c","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[300,540],"typeVersion":1},{"parameters":{},"id":"5d56d128-9a83-45ee-a34c-bc1190d59322","name":"Chat Trigger","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[600,560],"webhookId":"e3f23177-c7c1-417b-a513-1c1090dda0a2","typeVersion":1},{"parameters":{"authentication":"serviceAccount","documentId":{"__rl":true,"mode":"url","value":"={{ $json.sheetUrl }}"},"sheetName":{"__rl":true,"mode":"url","value":"={{ $json.sheetUrl }}"},"options":{}},"id":"3c0e4b48-a27b-472f-948e-9aa001c49149","name":"Get Google sheet contents","type":"n8n-nodes-base.googleSheets","position":[980,1240],"typeVersion":4.2},{"parameters":{"fields":{"values":[{"name":"sheetUrl"}]},"options":{}},"id":"67f9c172-e70f-4a0f-afd3-513cfeae09db","name":"Set Google Sheet URL","type":"n8n-nodes-base.set","position":[760,1240],"typeVersion":3.2},{"parameters":{"fields":{"values":[{"name":"response","stringValue":"={{ Object.keys($json) }}"}]},"include":"none","options":{}},"id":"d49223eb-2927-4ddd-bd2c-cd439f927341","name":"Get column names","type":"n8n-nodes-base.set","position":[1440,1060],"executeOnce":true,"typeVersion":3.2},{"parameters":{"jsCode":"return {\n  'response': JSON.stringify($input.all().map(x => x.json))\n}"},"id":"37ceba7a-1f0b-4de7-ae4a-d29a18dabaf6","name":"Prepare output","type":"n8n-nodes-base.code","position":[1720,1240],"typeVersion":2},{"parameters":{"name":"list_columns_tool","description":"=### List all column names in customer data\nThis is useful to find out what data is available for each customer. Returns a JSON array containing all the column names.","workflowId":"={{ $workflow.id }}","fields":{"values":[{"name":"operation","stringValue":"column_names"}]}},"id":"94516eb1-89fc-4d3f-8000-d0fa43cd71cd","name":"List columns tool","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[940,780],"typeVersion":1},{"parameters":{"name":"get_customer_tool","description":"=### Get all columns for a given customer\nTo use this mode, pass the row number of the customer. Returns a JSON object with all the column names and their values.","workflowId":"={{ $workflow.id }}","fields":{"values":[{"name":"operation","stringValue":"row"}]}},"id":"006745a1-3df7-4de9-9483-c6e133272c55","name":"Get customer tool","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[1220,780],"typeVersion":1},{"parameters":{},"id":"c3d20569-1374-4f8d-8779-23b98952d124","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[800,780],"typeVersion":1.1},{"parameters":{"name":"column_values_tool","description":"=### Get the specified column value for all customers\nThis is useful if you want to find out which customers have a certain value for a given column. Returns an array of JSON objects, one per customer. Each JSON object includes the column being requested, plus the row_number column. (The row_number column can be used to request the full customer data in a second step.). To use this mode, pass the name of the column to fetch.\n\nYou may want to call the 'list columns' tool first to find out which columns you could be fetching.","workflowId":"={{ $workflow.id }}","fields":{"values":[{"name":"operation","stringValue":"column_values"}]}},"id":"3a370ae9-eaf8-4e84-948b-848c461ac9eb","name":"Get column values tool","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[1080,780],"typeVersion":1},{"parameters":{"text":"={{ $json.chatInput }}","options":{"maxIterations":10}},"id":"8f2a4854-2177-4ac8-9501-fa36cf2a3d73","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[820,560],"typeVersion":1.1},{"parameters":{"content":"**These tools all call the sub-workflow below**","height":179.21380662202682,"width":432.3271051132649,"color":5},"id":"2576563b-a104-4d99-b3c8-b53bff4c740c","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[900,740.8693557231958],"typeVersion":1},{"parameters":{"content":"**Change the URL of the Google Sheet**","height":226.64416053838073,"width":179.99762227826224,"color":2},"id":"5b623d9e-e188-403d-a702-9ece6172a487","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[723,1172],"typeVersion":1},{"parameters":{"model":"gpt-4","options":{"temperature":0}},"id":"2b8c8a67-a4df-4f5c-8c13-3cb2d25d2c5f","name":"GPT4 Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[660,780],"typeVersion":1},{"parameters":{"content":"**Set your credentials**","height":171,"width":150,"color":2},"id":"f39d0c9b-4055-4331-83c8-3dbffb43478e","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[620,720]},{"parameters":{"content":"**Set your credentials**","height":237,"width":176,"color":2},"id":"a8e09ef8-4dc6-4918-9194-047de402a8fa","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[940,1172]},{"parameters":{"content":"## Next steps\n\nLearn more about [Advanced AI in n8n](https://docs.n8n.io/advanced-ai/)","height":126.0084096222716,"width":291.1204551358572},"id":"a391dfb1-f408-4498-99cd-d35a258d6c9a","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[1740,1540]},{"parameters":{"rules":{"values":[{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"leftValue":"={{ $('Execute Workflow Trigger').item.json.operation }}","rightValue":"column_names","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"renameOutput":true,"outputKey":"col names"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"9fe58592-72e2-4379-9bdb-10da19c8218b","leftValue":"={{ $('Execute Workflow Trigger').item.json.operation }}","rightValue":"column_values","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"renameOutput":true,"outputKey":"col values"},{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict"},"conditions":[{"id":"c1836f93-7874-43a4-98ff-cc487b276600","leftValue":"={{ $('Execute Workflow Trigger').item.json.operation }}","rightValue":"row","operator":{"type":"string","operation":"equals","name":"filter.operator.equals"}}],"combinator":"and"},"renameOutput":true,"outputKey":"rows"}]},"options":{}},"id":"907deea9-26cc-427e-93fc-52ce6b67e5e1","name":"Check operations","type":"n8n-nodes-base.switch","typeVersion":3,"position":[1220,1240]},{"parameters":{"fields":{"values":[{"name":"={{ $('Execute Workflow Trigger').item.json.query }}","stringValue":"={{ $json[$('Execute Workflow Trigger').item.json.query] }}"},{"name":"row_number","stringValue":"={{ $json.row_number }}"}]},"include":"none","options":{}},"id":"f2ebcae6-3cfb-4862-a927-dc66bd24f197","name":"Prepare column data","type":"n8n-nodes-base.set","position":[1440,1240],"typeVersion":3.2},{"parameters":{"conditions":{"options":{"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"bf712098-97e4-42cb-8e08-2ee32d19d3e7","operator":{"type":"number","operation":"equals"},"leftValue":"={{ $json.row_number }}","rightValue":"={{ $('Execute Workflow Trigger').item.json.query }}"}]},"options":{"looseTypeValidation":true}},"id":"f40acb04-ef06-4670-b8b1-86b04f066af8","name":"Filter out other rows","type":"n8n-nodes-base.filter","position":[1440,1420],"typeVersion":2}],"pinData":{},"connections":{"GPT4 Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Chat Trigger":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Get column names":{"main":[[{"node":"Prepare output","type":"main","index":0}]]},"Get customer tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"List columns tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Set Google Sheet URL":{"main":[[{"node":"Get Google sheet contents","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Get column values tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Execute Workflow Trigger":{"main":[[{"node":"Set Google Sheet URL","type":"main","index":0}]]},"Get Google sheet contents":{"main":[[{"node":"Check operations","type":"main","index":0}]]},"Check operations":{"main":[[{"node":"Get column names","type":"main","index":0}],[{"node":"Prepare column data","type":"main","index":0}],[{"node":"Filter out other rows","type":"main","index":0}]]},"Prepare column data":{"main":[[{"node":"Prepare output","type":"main","index":0}]]},"Filter out other rows":{"main":[[{"node":"Prepare output","type":"main","index":0}]]}}},"nodeConfigurations":[{"nodeType":"n8n-nodes-base.set","version":3.2,"parameters":{"fields":{"values":[{"name":"sheetUrl"}]},"options":{}},"position":[760,1240]},{"nodeType":"n8n-nodes-base.set","version":3.2,"parameters":{"fields":{"values":[{"name":"response","stringValue":"={{ Object.keys($json) }}"}]},"include":"none","options":{}},"position":[1440,1060]},{"nodeType":"n8n-nodes-base.set","version":3.2,"parameters":{"fields":{"values":[{"name":"={{ $('Execute Workflow Trigger').item.json.query }}","stringValue":"={{ $json[$('Execute Workflow Trigger').item.json.query] }}"},{"name":"row_number","stringValue":"={{ $json.row_number }}"}]},"include":"none","options":{}},"position":[1440,1240]}],"connections":{"GPT4 Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Chat Trigger":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Get column names":{"main":[[{"node":"Prepare output","type":"main","index":0}]]},"Get customer tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"List columns tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Set Google Sheet URL":{"main":[[{"node":"Get Google sheet contents","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Get column values tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Execute Workflow Trigger":{"main":[[{"node":"Set Google Sheet URL","type":"main","index":0}]]},"Get Google sheet contents":{"main":[[{"node":"Check operations","type":"main","index":0}]]},"Check operations":{"main":[[{"node":"Get column names","type":"main","index":0}],[{"node":"Prepare column data","type":"main","index":0}],[{"node":"Filter out other rows","type":"main","index":0}]]},"Prepare column data":{"main":[[{"node":"Prepare output","type":"main","index":0}]]},"Filter out other rows":{"main":[[{"node":"Prepare output","type":"main","index":0}]]}},"source":"docs/_workflows/advanced-ai/examples/chat_with_google_sheets_docs_version.json"},{"name":"let_your_ai_call_an_api","workflow":{"name":"Let your AI call an API","nodes":[{"parameters":{},"id":"35ce49a9-eda1-4da5-a6cb-39a39680111b","name":"Execute Workflow Trigger","type":"n8n-nodes-base.executeWorkflowTrigger","position":[520,1140],"typeVersion":1},{"parameters":{"content":"### Sub-workflow: Custom tool\nThe agent above can call this workflow. It calls an example API called \"Bored API\" and returns a string with an activity idea.","height":775.3931210698682,"width":1180.0825159534493,"color":7},"id":"ec6e261b-922f-401c-9392-12ff73488a5f","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[460,960],"typeVersion":1},{"parameters":{"content":"### Main workflow: AI agent using custom tool","height":486.5625,"width":927.5,"color":7},"id":"25780e87-0ae0-4bee-9582-75f98bf66635","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[460,460],"typeVersion":1},{"parameters":{},"id":"f262f04b-964c-47c0-b7dc-a86b82b0184b","name":"Chat Trigger","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[600,560],"webhookId":"e3f23177-c7c1-417b-a513-1c1090dda0a2","typeVersion":1},{"parameters":{},"id":"29678c05-9a48-41ec-9c5c-af36ee0d7fc6","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[860,780],"typeVersion":1.1},{"parameters":{"content":"**This tool calls the sub-workflow below**","height":179.21380662202682,"width":197.45572294791873,"color":5},"id":"e078f88b-489c-42ea-9544-6bdaeae213a0","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[1020,720],"typeVersion":1},{"parameters":{"content":"**Set your credentials**","height":171,"width":150,"color":2},"id":"1d1d1a4e-0d1d-4094-81c7-e01f2674df0d","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[620,720]},{"parameters":{"content":"**Set your credentials**","height":170.10898979087855,"width":152.85917676941358,"color":2},"id":"8c83d554-bf1f-4b3c-abb9-a6bb76846698","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[880,1540.2624287261167]},{"parameters":{"name":"activity_tool","description":"=Suggest an activity for a person to do. Use this tool if someone is bored, or asking for ideas of things to do.","workflowId":"={{ $workflow.id }}","fields":{"values":[{"name":"chatInput","stringValue":"={{ $('Chat Trigger').item.json.chatInput }}"}]}},"id":"82a3c606-0d7a-4b45-aae7-df35525615f7","name":"Activity tool","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[1080,780],"typeVersion":1},{"parameters":{"text":"={{ $json.chatInput }}","options":{"maxIterations":10}},"id":"716dea0d-a987-4cf7-ae4a-bf0f7c7d7da9","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[820,560],"typeVersion":1.1},{"parameters":{},"id":"f469fba8-07ae-4c79-a79c-2c49946d94e2","name":"Auto-fixing Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserAutofixing","typeVersion":1,"position":[920,1380]},{"parameters":{"content":"**Set your credentials**","height":189.79768930311286,"width":150,"color":2},"id":"e6d252d3-d78e-4827-b911-0528c3b80794","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[648.9502850955331,1340]},{"parameters":{"model":"gpt-4","options":{}},"id":"f65054a9-771c-47f8-94cc-4ed766f89d19","name":"GPT4 Model 1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[660,780],"typeVersion":1},{"parameters":{"model":"gpt-4","options":{}},"id":"94c2a6d8-cab9-48c2-8801-4306f0957f50","name":"GPT4 Model 2","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","typeVersion":1,"position":[700,1420]},{"parameters":{"model":"gpt-4","options":{}},"id":"5f423800-2eaf-43f5-bd59-dc1212cb55ad","name":"GPT4 Model 3","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","typeVersion":1,"position":[920,1600]},{"parameters":{"content":"## Try it out\n\nSelect **Chat** at the bottom and enter:\n\n_Hi! Please suggest something to do. I feel like learning something new._","height":214.8397420554627,"width":185.9375,"color":4},"id":"8ba60ef6-c375-41d9-bf79-1f19f1495adb","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[300,540],"typeVersion":1},{"parameters":{"content":"## Next steps\n\nLearn more about [Advanced AI in n8n](https://docs.n8n.io/advanced-ai/)","height":144.50520156238127},"id":"4bbd5942-4f2a-4a9a-a26c-61f95ad57549","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[1500,1540]},{"parameters":{"jsonSchema":"{\n  \"type\": \"object\",\n  \"properties\": {\n    \"type\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"data\": {\n          \"enum\": [\"education\", \"recreational\",\"social\",\"diy\",\"charity\",\"cooking\",\"relaxation\",\"music\",\"busywork\"]\n        }\n      }\n    },\n    \"participants\": {\n      \"type\": \"number\"\n    }\n  }\n}"},"id":"a50c7858-b0fd-44d6-898d-452ffc5cbd72","name":"Structure as JSON","type":"@n8n/n8n-nodes-langchain.outputParserStructured","typeVersion":1,"position":[1120,1520]},{"parameters":{"url":"http://www.boredapi.com/api/activity/","sendQuery":true,"queryParameters":{"parameters":[{"name":"type","value":"={{ $json.output.type.data }}"},{"name":"participants","value":"={{ $json.output.participants }}"}]},"options":{}},"id":"340c2536-6e79-4af6-9cd0-5cbf6eae1983","name":"Call the API","type":"n8n-nodes-base.httpRequest","typeVersion":4.1,"position":[1120,1140]},{"parameters":{"prompt":"={{ $('Execute Workflow Trigger').item.json.chatInput }}"},"id":"d7d5455c-2e46-4896-853c-6b527e9403e4","name":"Work out activity type and number of people","type":"@n8n/n8n-nodes-langchain.chainLlm","typeVersion":1.3,"position":[740,1140]},{"parameters":{"assignments":{"assignments":[{"id":"e37e64f6-64e7-4fbd-9ea1-e9d3ef99b39c","name":"response","value":"={{ $json.activity }}","type":"string"}]},"options":{}},"id":"83f9ac05-4583-4cc4-bcc8-29ae450c95cb","name":"Set 'response' value","type":"n8n-nodes-base.set","typeVersion":3.3,"position":[1340,1140]}],"pinData":{},"connections":{"Chat Trigger":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Execute Workflow Trigger":{"main":[[{"node":"Work out activity type and number of people","type":"main","index":0}]]},"Activity tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Auto-fixing Output Parser":{"ai_outputParser":[[{"node":"Work out activity type and number of people","type":"ai_outputParser","index":0}]]},"GPT4 Model 1":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"GPT4 Model 2":{"ai_languageModel":[[{"node":"Work out activity type and number of people","type":"ai_languageModel","index":0}]]},"GPT4 Model 3":{"ai_languageModel":[[{"node":"Auto-fixing Output Parser","type":"ai_languageModel","index":0}]]},"Structure as JSON":{"ai_outputParser":[[{"node":"Auto-fixing Output Parser","type":"ai_outputParser","index":0}]]},"Call the API":{"main":[[{"node":"Set 'response' value","type":"main","index":0}]]},"Work out activity type and number of people":{"main":[[{"node":"Call the API","type":"main","index":0}]]}}},"nodeConfigurations":[{"nodeType":"n8n-nodes-base.set","version":3.3,"parameters":{"assignments":{"assignments":[{"id":"e37e64f6-64e7-4fbd-9ea1-e9d3ef99b39c","name":"response","value":"={{ $json.activity }}","type":"string"}]},"options":{}},"position":[1340,1140]}],"connections":{"Chat Trigger":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Execute Workflow Trigger":{"main":[[{"node":"Work out activity type and number of people","type":"main","index":0}]]},"Activity tool":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Auto-fixing Output Parser":{"ai_outputParser":[[{"node":"Work out activity type and number of people","type":"ai_outputParser","index":0}]]},"GPT4 Model 1":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"GPT4 Model 2":{"ai_languageModel":[[{"node":"Work out activity type and number of people","type":"ai_languageModel","index":0}]]},"GPT4 Model 3":{"ai_languageModel":[[{"node":"Auto-fixing Output Parser","type":"ai_languageModel","index":0}]]},"Structure as JSON":{"ai_outputParser":[[{"node":"Auto-fixing Output Parser","type":"ai_outputParser","index":0}]]},"Call the API":{"main":[[{"node":"Set 'response' value","type":"main","index":0}]]},"Work out activity type and number of people":{"main":[[{"node":"Call the API","type":"main","index":0}]]}},"source":"docs/_workflows/advanced-ai/examples/let_your_ai_call_an_api.json"},{"name":"chapter-5.4","workflow":{"nodes":[{"parameters":{"url":"https://internal.users.n8n.cloud/webhook/custom-erp","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","sendHeaders":true,"headerParameters":{"parameters":[{"name":"unique_id","value":"<YOUR_UNIQUE_ID_HERE>"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[300,-520],"id":"ada6becf-c320-41a7-bdca-a842ea3ee769","name":"HTTP Request1","credentials":{"httpHeaderAuth":{"id":"sMuanZ4xGobAurzY","name":"Nathan's ABCorp data warehouse account"}}},{"parameters":{"operation":"create","base":{"__rl":true,"value":"app9nOVsRxdypoknP","mode":"list","cachedResultName":"beginner course"},"table":{"__rl":true,"value":"tblTIOsm4BLJD9Tql","mode":"list","cachedResultName":"processingOrders"},"columns":{"mappingMode":"autoMapInputData","value":{},"matchingColumns":[],"schema":[{"id":"orderID","displayName":"orderID","required":false,"defaultMatch":false,"canBeUsedToMatch":true,"display":true,"type":"number","readOnly":false,"removed":false},{"id":"employeeName","displayName":"employeeName","required":false,"defaultMatch":false,"canBeUsedToMatch":true,"display":true,"type":"string","readOnly":false,"removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{}},"type":"n8n-nodes-base.airtable","typeVersion":2.1,"position":[1020,-600],"id":"5e60ca72-d773-439c-b39a-4b14c54f795b","name":"Airtable1","credentials":{"airtableTokenApi":{"id":"UT32NHUYnp4pn1H3","name":"Airtable Personal Access Token account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"526cb30c-0f90-4f66-8f98-b64ceb2e52f2","leftValue":"={{ $json.orderStatus }}","rightValue":"processing","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[520,-520],"id":"70e4db65-f827-4e4f-8673-b405b7986d6e","name":"If1"},{"parameters":{"assignments":{"assignments":[{"id":"20d37948-763a-4d7b-b725-e65f3802af03","name":"orderID","value":"={{ $json.orderID }}","type":"number"},{"id":"9df108a7-6b13-42ab-a6dd-9ca582ba8b49","name":"employeeName","value":"={{ $json.employeeName }}","type":"string"}]},"options":{}},"type":"n8n-nodes-base.set","typeVersion":3.4,"position":[800,-600],"id":"a3d3dc53-32f1-4f44-bf95-50bc5450d601","name":"Edit Fields1"},{"parameters":{},"type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[80,-520],"id":"ffa1a8ce-1a1e-48c4-8a0d-6af28c0447a5","name":"When clicking ‘Execute workflow’"}],"connections":{"HTTP Request1":{"main":[[{"node":"If1","type":"main","index":0}]]},"If1":{"main":[[{"node":"Edit Fields1","type":"main","index":0}],[]]},"Edit Fields1":{"main":[[{"node":"Airtable1","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"HTTP Request1","type":"main","index":0}]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"24789c4d5aa56ca018d140332e7a43fd37dd7af0409453314fff12dc1aeebfa8"}},"nodeConfigurations":[{"nodeType":"n8n-nodes-base.set","version":3.4,"parameters":{"assignments":{"assignments":[{"id":"20d37948-763a-4d7b-b725-e65f3802af03","name":"orderID","value":"={{ $json.orderID }}","type":"number"},{"id":"9df108a7-6b13-42ab-a6dd-9ca582ba8b49","name":"employeeName","value":"={{ $json.employeeName }}","type":"string"}]},"options":{}},"position":[800,-600]}],"connections":{"HTTP Request1":{"main":[[{"node":"If1","type":"main","index":0}]]},"If1":{"main":[[{"node":"Edit Fields1","type":"main","index":0}],[]]},"Edit Fields1":{"main":[[{"node":"Airtable1","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"HTTP Request1","type":"main","index":0}]]}},"source":"docs/_workflows/courses/level-one/chapter-5/chapter-5.4.json","description":"Workflow example from docs/_workflows/courses/level-one/chapter-5/chapter-5.4.json"},{"name":"chapter-5.5","workflow":{"nodes":[{"parameters":{"url":"https://internal.users.n8n.cloud/webhook/custom-erp","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","sendHeaders":true,"headerParameters":{"parameters":[{"name":"unique_id","value":"<YOUR_UNIQUE_ID_HERE>"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[300,-520],"id":"ada6becf-c320-41a7-bdca-a842ea3ee769","name":"HTTP Request1","credentials":{"httpHeaderAuth":{"id":"sMuanZ4xGobAurzY","name":"Nathan's ABCorp data warehouse account"}}},{"parameters":{"operation":"create","base":{"__rl":true,"value":"app9nOVsRxdypoknP","mode":"list","cachedResultName":"beginner course"},"table":{"__rl":true,"value":"tblTIOsm4BLJD9Tql","mode":"list","cachedResultName":"processingOrders"},"columns":{"mappingMode":"autoMapInputData","value":{},"matchingColumns":[],"schema":[{"id":"orderID","displayName":"orderID","required":false,"defaultMatch":false,"canBeUsedToMatch":true,"display":true,"type":"number","readOnly":false,"removed":false},{"id":"employeeName","displayName":"employeeName","required":false,"defaultMatch":false,"canBeUsedToMatch":true,"display":true,"type":"string","readOnly":false,"removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{}},"type":"n8n-nodes-base.airtable","typeVersion":2.1,"position":[1020,-600],"id":"5e60ca72-d773-439c-b39a-4b14c54f795b","name":"Airtable1","credentials":{"airtableTokenApi":{"id":"UT32NHUYnp4pn1H3","name":"Airtable Personal Access Token account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"526cb30c-0f90-4f66-8f98-b64ceb2e52f2","leftValue":"={{ $json.orderStatus }}","rightValue":"processing","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[520,-520],"id":"70e4db65-f827-4e4f-8673-b405b7986d6e","name":"If1"},{"parameters":{"assignments":{"assignments":[{"id":"20d37948-763a-4d7b-b725-e65f3802af03","name":"orderID","value":"={{ $json.orderID }}","type":"number"},{"id":"9df108a7-6b13-42ab-a6dd-9ca582ba8b49","name":"employeeName","value":"={{ $json.employeeName }}","type":"string"}]},"options":{}},"type":"n8n-nodes-base.set","typeVersion":3.4,"position":[800,-600],"id":"a3d3dc53-32f1-4f44-bf95-50bc5450d601","name":"Edit Fields1"},{"parameters":{"jsCode":"let items = $input.all();\nlet totalBooked = items.length;\nlet bookedSum = 0;\n\nfor (let i=0; i < items.length; i++) {\n  bookedSum = bookedSum + items[i].json.orderPrice;\n}\n\nreturn [{ json: {totalBooked, bookedSum} }];"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[760,-420],"id":"d24ea5e9-c9e6-4d06-b6ee-8db1abd42bc0","name":"Code1"},{"parameters":{},"type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[80,-520],"id":"ffa1a8ce-1a1e-48c4-8a0d-6af28c0447a5","name":"When clicking ‘Execute workflow’"}],"connections":{"HTTP Request1":{"main":[[{"node":"If1","type":"main","index":0}]]},"If1":{"main":[[{"node":"Edit Fields1","type":"main","index":0}],[{"node":"Code1","type":"main","index":0}]]},"Edit Fields1":{"main":[[{"node":"Airtable1","type":"main","index":0}]]},"Code1":{"main":[[]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"HTTP Request1","type":"main","index":0}]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"24789c4d5aa56ca018d140332e7a43fd37dd7af0409453314fff12dc1aeebfa8"}},"nodeConfigurations":[{"nodeType":"n8n-nodes-base.set","version":3.4,"parameters":{"assignments":{"assignments":[{"id":"20d37948-763a-4d7b-b725-e65f3802af03","name":"orderID","value":"={{ $json.orderID }}","type":"number"},{"id":"9df108a7-6b13-42ab-a6dd-9ca582ba8b49","name":"employeeName","value":"={{ $json.employeeName }}","type":"string"}]},"options":{}},"position":[800,-600]}],"connections":{"HTTP Request1":{"main":[[{"node":"If1","type":"main","index":0}]]},"If1":{"main":[[{"node":"Edit Fields1","type":"main","index":0}],[{"node":"Code1","type":"main","index":0}]]},"Edit Fields1":{"main":[[{"node":"Airtable1","type":"main","index":0}]]},"Code1":{"main":[[]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"HTTP Request1","type":"main","index":0}]]}},"source":"docs/_workflows/courses/level-one/chapter-5/chapter-5.5.json","description":"Workflow example from docs/_workflows/courses/level-one/chapter-5/chapter-5.5.json"},{"name":"chapter-5.6","workflow":{"nodes":[{"parameters":{"url":"https://internal.users.n8n.cloud/webhook/custom-erp","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","sendHeaders":true,"headerParameters":{"parameters":[{"name":"unique_id","value":"<YOUR_UNIQUE_ID_HERE>"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[300,-520],"id":"ada6becf-c320-41a7-bdca-a842ea3ee769","name":"HTTP Request1","credentials":{"httpHeaderAuth":{"id":"sMuanZ4xGobAurzY","name":"Nathan's ABCorp data warehouse account"}}},{"parameters":{"operation":"create","base":{"__rl":true,"value":"app9nOVsRxdypoknP","mode":"list","cachedResultName":"beginner course"},"table":{"__rl":true,"value":"tblTIOsm4BLJD9Tql","mode":"list","cachedResultName":"processingOrders"},"columns":{"mappingMode":"autoMapInputData","value":{},"matchingColumns":[],"schema":[{"id":"orderID","displayName":"orderID","required":false,"defaultMatch":false,"canBeUsedToMatch":true,"display":true,"type":"number","readOnly":false,"removed":false},{"id":"employeeName","displayName":"employeeName","required":false,"defaultMatch":false,"canBeUsedToMatch":true,"display":true,"type":"string","readOnly":false,"removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{}},"type":"n8n-nodes-base.airtable","typeVersion":2.1,"position":[1020,-600],"id":"5e60ca72-d773-439c-b39a-4b14c54f795b","name":"Airtable1","credentials":{"airtableTokenApi":{"id":"UT32NHUYnp4pn1H3","name":"Airtable Personal Access Token account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"526cb30c-0f90-4f66-8f98-b64ceb2e52f2","leftValue":"={{ $json.orderStatus }}","rightValue":"processing","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[520,-520],"id":"70e4db65-f827-4e4f-8673-b405b7986d6e","name":"If1"},{"parameters":{"assignments":{"assignments":[{"id":"20d37948-763a-4d7b-b725-e65f3802af03","name":"orderID","value":"={{ $json.orderID }}","type":"number"},{"id":"9df108a7-6b13-42ab-a6dd-9ca582ba8b49","name":"employeeName","value":"={{ $json.employeeName }}","type":"string"}]},"options":{}},"type":"n8n-nodes-base.set","typeVersion":3.4,"position":[800,-600],"id":"a3d3dc53-32f1-4f44-bf95-50bc5450d601","name":"Edit Fields1"},{"parameters":{"jsCode":"let items = $input.all();\nlet totalBooked = items.length;\nlet bookedSum = 0;\n\nfor (let i=0; i < items.length; i++) {\n  bookedSum = bookedSum + items[i].json.orderPrice;\n}\n\nreturn [{ json: {totalBooked, bookedSum} }];"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[760,-420],"id":"d24ea5e9-c9e6-4d06-b6ee-8db1abd42bc0","name":"Code1"},{"parameters":{"authentication":"webhook","content":"=This week we've {{$json[\"totalBooked\"]}} booked orders with a total value of {{$json[\"bookedSum\"]}}. My Unique ID: {{ $('HTTP Request1').params[\"headerParameters\"][\"parameters\"][0][\"value\"] }}","options":{}},"type":"n8n-nodes-base.discord","typeVersion":2,"position":[1000,-420],"id":"ed380465-c655-4c38-8eb3-2008b9e7869f","name":"Discord1","webhookId":"eff0b651-f0be-4cae-8f18-7d831385be3c","credentials":{"discordWebhookApi":{"id":"lOieo0mIb6h1Wi9R","name":"Discord Webhook account"}}},{"parameters":{},"type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[80,-520],"id":"ffa1a8ce-1a1e-48c4-8a0d-6af28c0447a5","name":"When clicking ‘Execute workflow’"}],"connections":{"HTTP Request1":{"main":[[{"node":"If1","type":"main","index":0}]]},"If1":{"main":[[{"node":"Edit Fields1","type":"main","index":0}],[{"node":"Code1","type":"main","index":0}]]},"Edit Fields1":{"main":[[{"node":"Airtable1","type":"main","index":0}]]},"Code1":{"main":[[{"node":"Discord1","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"HTTP Request1","type":"main","index":0}]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"24789c4d5aa56ca018d140332e7a43fd37dd7af0409453314fff12dc1aeebfa8"}},"nodeConfigurations":[{"nodeType":"n8n-nodes-base.set","version":3.4,"parameters":{"assignments":{"assignments":[{"id":"20d37948-763a-4d7b-b725-e65f3802af03","name":"orderID","value":"={{ $json.orderID }}","type":"number"},{"id":"9df108a7-6b13-42ab-a6dd-9ca582ba8b49","name":"employeeName","value":"={{ $json.employeeName }}","type":"string"}]},"options":{}},"position":[800,-600]}],"connections":{"HTTP Request1":{"main":[[{"node":"If1","type":"main","index":0}]]},"If1":{"main":[[{"node":"Edit Fields1","type":"main","index":0}],[{"node":"Code1","type":"main","index":0}]]},"Edit Fields1":{"main":[[{"node":"Airtable1","type":"main","index":0}]]},"Code1":{"main":[[{"node":"Discord1","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"HTTP Request1","type":"main","index":0}]]}},"source":"docs/_workflows/courses/level-one/chapter-5/chapter-5.6.json","description":"Workflow example from docs/_workflows/courses/level-one/chapter-5/chapter-5.6.json"},{"name":"finished","workflow":{"nodes":[{"parameters":{"url":"https://internal.users.n8n.cloud/webhook/custom-erp","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","sendHeaders":true,"headerParameters":{"parameters":[{"name":"unique_id","value":"4d259ec5241587a0d2820670fc048f0d"}]},"options":{}},"type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[220,-40],"id":"e1fb70b3-0212-4e78-9976-cb77c69f1a92","name":"HTTP Request","credentials":{"httpHeaderAuth":{"id":"sMuanZ4xGobAurzY","name":"Nathan's ABCorp data warehouse account"}}},{"parameters":{"operation":"create","base":{"__rl":true,"value":"app9nOVsRxdypoknP","mode":"list","cachedResultName":"beginner course"},"table":{"__rl":true,"value":"tblTIOsm4BLJD9Tql","mode":"list","cachedResultName":"processingOrders"},"columns":{"mappingMode":"autoMapInputData","value":{},"matchingColumns":[],"schema":[{"id":"orderID","displayName":"orderID","required":false,"defaultMatch":false,"canBeUsedToMatch":true,"display":true,"type":"number","readOnly":false,"removed":false},{"id":"employeeName","displayName":"employeeName","required":false,"defaultMatch":false,"canBeUsedToMatch":true,"display":true,"type":"string","readOnly":false,"removed":false}],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{}},"type":"n8n-nodes-base.airtable","typeVersion":2.1,"position":[880,-140],"id":"5cef2ef7-98a6-4dc6-bc30-667eba06fd7b","name":"Airtable","credentials":{"airtableTokenApi":{"id":"UT32NHUYnp4pn1H3","name":"Airtable Personal Access Token account"}}},{"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"526cb30c-0f90-4f66-8f98-b64ceb2e52f2","leftValue":"={{ $json.orderStatus }}","rightValue":"processing","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"options":{}},"type":"n8n-nodes-base.if","typeVersion":2.2,"position":[440,-40],"id":"448b2e3c-569d-42e6-a4b9-57c08b2cac1a","name":"If"},{"parameters":{"assignments":{"assignments":[{"id":"20d37948-763a-4d7b-b725-e65f3802af03","name":"orderID","value":"={{ $json.orderID }}","type":"number"},{"id":"9df108a7-6b13-42ab-a6dd-9ca582ba8b49","name":"employeeName","value":"={{ $json.employeeName }}","type":"string"}]},"options":{}},"type":"n8n-nodes-base.set","typeVersion":3.4,"position":[660,-140],"id":"7e2a8092-fb0f-4260-84e8-d796cf14d309","name":"Edit Fields"},{"parameters":{"jsCode":"let items = $input.all();\nlet totalBooked = items.length;\nlet bookedSum = 0;\n\nfor (let i=0; i < items.length; i++) {\n  bookedSum = bookedSum + items[i].json.orderPrice;\n}\n\nreturn [{ json: {totalBooked, bookedSum} }];"},"type":"n8n-nodes-base.code","typeVersion":2,"position":[660,60],"id":"26ce1d53-794b-4457-9aa8-0ecf9093b838","name":"Code"},{"parameters":{"authentication":"webhook","content":"=This week we've {{$json[\"totalBooked\"]}} booked orders with a total value of {{$json[\"bookedSum\"]}}. My Unique ID: {{ $('HTTP Request').params[\"headerParameters\"][\"parameters\"][0][\"value\"] }}","options":{}},"type":"n8n-nodes-base.discord","typeVersion":2,"position":[880,60],"id":"d8c0b4b6-3bf1-4055-a03f-f0023337777c","name":"Discord","webhookId":"eff0b651-f0be-4cae-8f18-7d831385be3c","credentials":{"discordWebhookApi":{"id":"lOieo0mIb6h1Wi9R","name":"Discord Webhook account"}}},{"parameters":{"rule":{"interval":[{"field":"weeks","triggerAtDay":[1],"triggerAtHour":9}]}},"type":"n8n-nodes-base.scheduleTrigger","typeVersion":1.2,"position":[0,-40],"id":"15f0b179-6a43-483b-a522-2b8ba834b795","name":"Schedule Trigger"}],"connections":{"HTTP Request":{"main":[[{"node":"If","type":"main","index":0}]]},"If":{"main":[[{"node":"Edit Fields","type":"main","index":0}],[{"node":"Code","type":"main","index":0}]]},"Edit Fields":{"main":[[{"node":"Airtable","type":"main","index":0}]]},"Code":{"main":[[{"node":"Discord","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"24789c4d5aa56ca018d140332e7a43fd37dd7af0409453314fff12dc1aeebfa8"}},"nodeConfigurations":[{"nodeType":"n8n-nodes-base.set","version":3.4,"parameters":{"assignments":{"assignments":[{"id":"20d37948-763a-4d7b-b725-e65f3802af03","name":"orderID","value":"={{ $json.orderID }}","type":"number"},{"id":"9df108a7-6b13-42ab-a6dd-9ca582ba8b49","name":"employeeName","value":"={{ $json.employeeName }}","type":"string"}]},"options":{}},"position":[660,-140]}],"connections":{"HTTP Request":{"main":[[{"node":"If","type":"main","index":0}]]},"If":{"main":[[{"node":"Edit Fields","type":"main","index":0}],[{"node":"Code","type":"main","index":0}]]},"Edit Fields":{"main":[[{"node":"Airtable","type":"main","index":0}]]},"Code":{"main":[[{"node":"Discord","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"HTTP Request","type":"main","index":0}]]}},"source":"docs/_workflows/courses/level-one/finished.json","description":"Workflow example from docs/_workflows/courses/level-one/finished.json"},{"name":"very-quick-quickstart-workflow","workflow":{"nodes":[{"parameters":{"operation":"getAllPeople","returnAll":true},"id":"ed1fd9cd-cc4f-4e0e-ba73-9f842db382c3","name":"Customer Datastore","type":"n8n-nodes-base.n8nTrainingCustomerDatastore","position":[540,280],"typeVersion":1},{"parameters":{"content":"**Get fake sample data**","height":300,"width":220},"id":"5ddf393f-62b8-4240-adf8-f9a8f539df4b","name":"Note1","type":"n8n-nodes-base.stickyNote","position":[480,180],"typeVersion":1},{"parameters":{"content":"**Extract data and prepare it for use in the next node**","height":300,"width":220},"id":"6ad194ea-9821-40eb-ae2c-f50cc030300b","name":"Note2","type":"n8n-nodes-base.stickyNote","position":[760,180],"typeVersion":1},{"parameters":{},"id":"5af4b83b-31b6-4c29-aa55-3449f3851e2a","name":"When clicking \"Test Workflow\"","type":"n8n-nodes-base.manualTrigger","position":[300,280],"typeVersion":1},{"parameters":{"assignments":{"assignments":[{"id":"df041e3c-fc09-4ba2-8e6b-37f2c6a02526","name":"customer_id","type":"string","value":"={{ $json.id }}"},{"id":"bf288953-4fef-4f55-a45f-c223714919c0","name":"customer_name","type":"string","value":"={{ $json.name }}"},{"id":"1cff0b21-6740-4697-9d2c-9bcb045af0be","name":"customer_description","type":"string","value":"={{ $json.notes }}"}]},"options":{}},"id":"5dcd5776-5137-4f97-8b76-9f38e1d9ff9e","name":"Edit Fields1","type":"n8n-nodes-base.set","position":[820,280],"typeVersion":3.3},{"parameters":{"customerId":"={{ $json.customer_id }}","message":"=Hi {{ $json.customer_name }}. Your description is: {{  $json.customer_description }}"},"type":"n8n-nodes-base.n8nTrainingCustomerMessenger","typeVersion":1,"position":[1040,280],"id":"a726dcfd-f491-440f-ad64-6ba17472352f","name":"Customer Messenger (n8n training)"}],"connections":{"Customer Datastore":{"main":[[{"node":"Edit Fields1","type":"main","index":0}]]},"When clicking \"Test Workflow\"":{"main":[[{"node":"Customer Datastore","type":"main","index":0}]]},"Edit Fields1":{"main":[[{"node":"Customer Messenger (n8n training)","type":"main","index":0}]]}},"pinData":{},"meta":{"instanceId":"cb484ba7b742928a2048bf8829668bed5b5ad9787579adea888f05980292a4a7"}},"nodeConfigurations":[{"nodeType":"n8n-nodes-base.set","version":3.3,"parameters":{"assignments":{"assignments":[{"id":"df041e3c-fc09-4ba2-8e6b-37f2c6a02526","name":"customer_id","type":"string","value":"={{ $json.id }}"},{"id":"bf288953-4fef-4f55-a45f-c223714919c0","name":"customer_name","type":"string","value":"={{ $json.name }}"},{"id":"1cff0b21-6740-4697-9d2c-9bcb045af0be","name":"customer_description","type":"string","value":"={{ $json.notes }}"}]},"options":{}},"position":[820,280]}],"connections":{"Customer Datastore":{"main":[[{"node":"Edit Fields1","type":"main","index":0}]]},"When clicking \"Test Workflow\"":{"main":[[{"node":"Customer Datastore","type":"main","index":0}]]},"Edit Fields1":{"main":[[{"node":"Customer Messenger (n8n training)","type":"main","index":0}]]}},"source":"docs/_workflows/try-it-out/quickstart/very-quick-quickstart-workflow.json","description":"Workflow example from docs/_workflows/try-it-out/quickstart/very-quick-quickstart-workflow.json"}]

troubleshooting_info:
  [{"issue":"Node parameters","solution":"These are the settings and options available in the Edit Fields node."},{"issue":"Mode","solution":"You can either use **Manual Mapping** to edit fields using the GUI or **JSON Output** to write JSON that n8n adds to the input data."},{"issue":"Fields to Set","solution":"If you select **Mode** > **Manual Mapping**, you can configure the fields by dragging and dropping values from **INPUT**."},{"issue":"Keep Only Set Fields","solution":"Enable this to discard any input data that you don't use in **Fields to Set**."},{"issue":"Include in Output","solution":"Choose which input data to include in the node's output data."},{"issue":"Node options","solution":"Use these options to customize the behavior of the node."},{"issue":"Include Binary Data","solution":"If the input data includes binary data, choose whether to include it in the Edit Fields node's output data."},{"issue":"Ignore Type Conversion Errors","solution":"Manual Mapping only."},{"issue":"Support Dot Notation","solution":"By default, n8n supports dot notation."},{"issue":"Arrays and expressions in JSON Output mode","solution":"You can use arrays and expressions when creating your JSON Output."}]

node_connections:
  [{"fromNode":"GPT4 Model","toNode":"AI Agent","connectionType":"ai_languageModel"},{"fromNode":"Chat Trigger","toNode":"AI Agent","connectionType":"main"},{"fromNode":"Get column names","toNode":"Prepare output","connectionType":"main"},{"fromNode":"Get customer tool","toNode":"AI Agent","connectionType":"ai_tool"},{"fromNode":"List columns tool","toNode":"AI Agent","connectionType":"ai_tool"},{"fromNode":"Set Google Sheet URL","toNode":"Get Google sheet contents","connectionType":"main"},{"fromNode":"Simple Memory","toNode":"AI Agent","connectionType":"ai_memory"},{"fromNode":"Get column values tool","toNode":"AI Agent","connectionType":"ai_tool"},{"fromNode":"Execute Workflow Trigger","toNode":"Set Google Sheet URL","connectionType":"main"},{"fromNode":"Get Google sheet contents","toNode":"Check operations","connectionType":"main"},{"fromNode":"Check operations","toNode":"Get column names","connectionType":"main"},{"fromNode":"Check operations","toNode":"Prepare column data","connectionType":"main"},{"fromNode":"Check operations","toNode":"Filter out other rows","connectionType":"main"},{"fromNode":"Prepare column data","toNode":"Prepare output","connectionType":"main"},{"fromNode":"Filter out other rows","toNode":"Prepare output","connectionType":"main"},{"fromNode":"Execute Workflow Trigger","toNode":"Work out activity type and number of people","connectionType":"main"},{"fromNode":"Activity tool","toNode":"AI Agent","connectionType":"ai_tool"},{"fromNode":"Auto-fixing Output Parser","toNode":"Work out activity type and number of people","connectionType":"ai_outputParser"},{"fromNode":"GPT4 Model 1","toNode":"AI Agent","connectionType":"ai_languageModel"},{"fromNode":"GPT4 Model 2","toNode":"Work out activity type and number of people","connectionType":"ai_languageModel"},{"fromNode":"GPT4 Model 3","toNode":"Auto-fixing Output Parser","connectionType":"ai_languageModel"},{"fromNode":"Structure as JSON","toNode":"Auto-fixing Output Parser","connectionType":"ai_outputParser"},{"fromNode":"Call the API","toNode":"Set 'response' value","connectionType":"main"},{"fromNode":"Work out activity type and number of people","toNode":"Call the API","connectionType":"main"},{"fromNode":"HTTP Request1","toNode":"If1","connectionType":"main"},{"fromNode":"If1","toNode":"Edit Fields1","connectionType":"main"},{"fromNode":"Edit Fields1","toNode":"Airtable1","connectionType":"main"},{"fromNode":"When clicking ‘Execute workflow’","toNode":"HTTP Request1","connectionType":"main"},{"fromNode":"If1","toNode":"Code1","connectionType":"main"},{"fromNode":"Code1","toNode":"Discord1","connectionType":"main"},{"fromNode":"HTTP Request","toNode":"If","connectionType":"main"},{"fromNode":"If","toNode":"Edit Fields","connectionType":"main"},{"fromNode":"If","toNode":"Code","connectionType":"main"},{"fromNode":"Edit Fields","toNode":"Airtable","connectionType":"main"},{"fromNode":"Code","toNode":"Discord","connectionType":"main"},{"fromNode":"Schedule Trigger","toNode":"HTTP Request","connectionType":"main"},{"fromNode":"Customer Datastore","toNode":"Edit Fields1","connectionType":"main"},{"fromNode":"When clicking \"Test Workflow\"","toNode":"Customer Datastore","connectionType":"main"},{"fromNode":"Edit Fields1","toNode":"Customer Messenger (n8n training)","connectionType":"main"}]

example_workflow:
  {"name":"Set Example Workflow","nodes":[{"parameters":{},"id":"3oytqfdw01rfuuua4hm01","name":"Set","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}


