# nodes

node_type: n8n-nodes-base.QuickBase
name: QuickBase
display_name: Quick Base
description: Integrate with the Quick Base RESTful API
category: input
icon: file:quickbase.png
code_hash: bfd2ee929fc7e48c79cc4f0913b3f3978c18ae98191cbce71e2b6c95fdc8c1c5
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.QuickBase
documentation_title: Quick Base node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"quick-base","description":"Templates for quick-base"}]
related_resources: []
required_scopes: []
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-09 15:18:29
updated_at: 2025-06-09 15:18:29
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.QuickBase = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const FieldDescription_1 = require("./FieldDescription");
  const FileDescription_1 = require("./FileDescription");
  const RecordDescription_1 = require("./RecordDescription");
  const ReportDescription_1 = require("./ReportDescription");
  const utilities_1 = require("../../utils/utilities");
  class QuickBase {
      constructor() {
          this.description = {
              displayName: 'Quick Base',
              name: 'quickbase',
              icon: 'file:quickbase.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Integrate with the Quick Base RESTful API',
              defaults: {
                  name: 'Quick Base',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'quickbaseApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Field',
                              value: 'field',
                          },
                          {
                              name: 'File',
                              value: 'file',
                          },
                          {
                              name: 'Record',
                              value: 'record',
                          },
                          {
                              name: 'Report',
                              value: 'report',
                          },
                      ],
                      default: 'record',
                  },
                  ...FieldDescription_1.fieldOperations,
                  ...FieldDescription_1.fieldFields,
                  ...FileDescription_1.fileOperations,
                  ...FileDescription_1.fileFields,
                  ...RecordDescription_1.recordOperations,
                  ...RecordDescription_1.recordFields,
                  ...ReportDescription_1.reportOperations,
                  ...ReportDescription_1.reportFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getTableFields() {
                      const returnData = [];
                      const tableId = this.getCurrentNodeParameter('tableId');
                      const fields = await GenericFunctions_1.quickbaseApiRequest.call(this, 'GET', '/fields', {}, { tableId });
                      for (const field of fields) {
                          returnData.push({
                              name: field.label,
                              value: field.id,
                          });
                      }
                      return returnData;
                  },
                  async getUniqueTableFields() {
                      const returnData = [];
                      const tableId = this.getCurrentNodeParameter('tableId');
                      const fields = await GenericFunctions_1.quickbaseApiRequest.call(this, 'GET', '/fields', {}, { tableId });
                      for (const field of fields) {
                          if (field.unique === true && field.properties.primaryKey === false) {
                              returnData.push({
                                  name: field.label,
                                  value: field.id,
                              });
                          }
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const itemData = (0, utilities_1.generatePairedItemData)(items.length);
          const returnData = [];
          const length = items.length;
          const qs = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          if (resource === 'field') {
              if (operation === 'getAll') {
                  for (let i = 0; i < length; i++) {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const tableId = this.getNodeParameter('tableId', i);
                      const options = this.getNodeParameter('options', i);
                      Object.assign({
                          tableId,
                      }, options);
                      responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'GET', '/fields', {}, 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);
                  }
              }
          }
          if (resource === 'file') {
              if (operation === 'delete') {
                  for (let i = 0; i < length; i++) {
                      const tableId = this.getNodeParameter('tableId', i);
                      const recordId = this.getNodeParameter('recordId', i);
                      const fieldId = this.getNodeParameter('fieldId', i);
                      const versionNumber = this.getNodeParameter('versionNumber', i);
                      responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'DELETE', `/files/${tableId}/${recordId}/${fieldId}/${versionNumber}`);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'download') {
                  for (let i = 0; i < length; i++) {
                      const tableId = this.getNodeParameter('tableId', i);
                      const recordId = this.getNodeParameter('recordId', i);
                      const fieldId = this.getNodeParameter('fieldId', i);
                      const versionNumber = this.getNodeParameter('versionNumber', i);
                      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);
                      responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'GET', `/files/${tableId}/${recordId}/${fieldId}/${versionNumber}`, {}, {}, { json: false, resolveWithFullResponse: true });
                      const contentDisposition = responseData.headers['content-disposition'];
                      const data = Buffer.from(responseData.body, 'base64');
                      items[i].binary[dataPropertyNameDownload] = await this.helpers.prepareBinaryData(data, contentDisposition.split('=')[1]);
                  }
                  return [items];
              }
          }
          if (resource === 'record') {
              if (operation === 'create') {
                  const tableId = this.getNodeParameter('tableId', 0);
                  const simple = this.getNodeParameter('simple', 0);
                  const data = [];
                  const options = this.getNodeParameter('options', 0);
                  for (let i = 0; i < length; i++) {
                      const record = {};
                      const columns = this.getNodeParameter('columns', i);
                      const columnList = columns.split(',').map((column) => column.trim());
                      if (options.useFieldIDs === true) {
                          for (const key of Object.keys(items[i].json)) {
                              record[key] = { value: items[i].json[key] };
                          }
                      }
                      else {
                          const { fieldsLabelKey } = await GenericFunctions_1.getFieldsObject.call(this, tableId);
                          for (const key of Object.keys(items[i].json)) {
                              if (fieldsLabelKey.hasOwnProperty(key) && columnList.includes(key)) {
                                  record[fieldsLabelKey[key].toString()] = { value: items[i].json[key] };
                              }
                          }
                      }
                      data.push(record);
                  }
                  const body = {
                      data,
                      to: tableId,
                  };
                  body.fieldsToReturn = [3];
                  if (options.fields) {
                      body.fieldsToReturn = options.fields;
                  }
                  responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'POST', '/records', body);
                  if (simple) {
                      const { data: records } = responseData;
                      responseData = [];
                      for (const record of records) {
                          const recordData = {};
                          for (const [key, value] of Object.entries(record)) {
                              recordData[key] = value.value;
                          }
                          responseData.push(recordData);
                      }
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData });
                  returnData.push(...executionData);
              }
              if (operation === 'delete') {
                  for (let i = 0; i < length; i++) {
                      const tableId = this.getNodeParameter('tableId', i);
                      const where = this.getNodeParameter('where', i);
                      const body = {
                          from: tableId,
                          where,
                      };
                      responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'DELETE', '/records', body);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'getAll') {
                  for (let i = 0; i < length; i++) {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const tableId = this.getNodeParameter('tableId', i);
                      const options = this.getNodeParameter('options', i);
                      const body = {
                          from: tableId,
                      };
                      Object.assign(body, options);
                      if (options.sortByUi) {
                          const sort = options.sortByUi.sortByValues;
                          body.sortBy = sort;
                          delete body.sortByUi;
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.quickbaseApiRequestAllItems.call(this, 'POST', '/records/query', body, qs);
                      }
                      else {
                          body.options = { top: this.getNodeParameter('limit', i) };
                          responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'POST', '/records/query', body, qs);
                          const { data: records, fields } = responseData;
                          responseData = [];
                          const fieldsIdKey = {};
                          for (const field of fields) {
                              fieldsIdKey[field.id] = field.label;
                          }
                          for (const record of records) {
                              const data = {};
                              for (const [key, value] of Object.entries(record)) {
                                  data[fieldsIdKey[key]] = value.value;
                              }
                              responseData.push(data);
                          }
                      }
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'update') {
                  const tableId = this.getNodeParameter('tableId', 0);
                  const { fieldsLabelKey: _fieldsLabelKey, fieldsIdKey } = await GenericFunctions_1.getFieldsObject.call(this, tableId);
                  const simple = this.getNodeParameter('simple', 0);
                  const updateKey = this.getNodeParameter('updateKey', 0);
                  const data = [];
                  const options = this.getNodeParameter('options', 0);
                  for (let i = 0; i < length; i++) {
                      const record = {};
                      const columns = this.getNodeParameter('columns', i);
                      const columnList = columns.split(',').map((column) => column.trim());
                      if (options.useFieldIDs === true) {
                          for (const key of Object.keys(items[i].json)) {
                              record[key] = { value: items[i].json[key] };
                          }
                      }
                      else {
                          const { fieldsLabelKey } = await GenericFunctions_1.getFieldsObject.call(this, tableId);
                          for (const key of Object.keys(items[i].json)) {
                              if (fieldsLabelKey.hasOwnProperty(key) && columnList.includes(key)) {
                                  record[fieldsLabelKey[key].toString()] = { value: items[i].json[key] };
                              }
                          }
                      }
                      if (items[i].json[updateKey] === undefined) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The update key ${updateKey} could not be found in the input`, { itemIndex: i });
                      }
                      data.push(record);
                  }
                  const body = {
                      data,
                      to: tableId,
                  };
                  if (options.fields) {
                      body.fieldsToReturn = options.fields;
                  }
                  responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'POST', '/records', body);
                  if (simple) {
                      const { data: records } = responseData;
                      responseData = [];
                      for (const record of records) {
                          const recordData = {};
                          for (const [key, value] of Object.entries(record)) {
                              recordData[fieldsIdKey[key]] = value.value;
                          }
                          responseData.push(recordData);
                      }
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData });
                  returnData.push(...executionData);
              }
              if (operation === 'upsert') {
                  const tableId = this.getNodeParameter('tableId', 0);
                  const simple = this.getNodeParameter('simple', 0);
                  const updateKey = this.getNodeParameter('updateKey', 0);
                  const mergeFieldId = this.getNodeParameter('mergeFieldId', 0);
                  const data = [];
                  const options = this.getNodeParameter('options', 0);
                  for (let i = 0; i < length; i++) {
                      const record = {};
                      const columns = this.getNodeParameter('columns', i);
                      const columnList = columns.split(',').map((column) => column.trim());
                      if (options.useFieldIDs === true) {
                          for (const key of Object.keys(items[i].json)) {
                              record[key] = { value: items[i].json[key] };
                          }
                      }
                      else {
                          const { fieldsLabelKey } = await GenericFunctions_1.getFieldsObject.call(this, tableId);
                          for (const key of Object.keys(items[i].json)) {
                              if (fieldsLabelKey.hasOwnProperty(key) && columnList.includes(key)) {
                                  record[fieldsLabelKey[key].toString()] = { value: items[i].json[key] };
                              }
                          }
                      }
                      if (items[i].json[updateKey] === undefined) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The update key ${updateKey} could not be found in the input`, { itemIndex: i });
                      }
                      record[mergeFieldId] = { value: items[i].json[updateKey] };
                      data.push(record);
                  }
                  const body = {
                      data,
                      to: tableId,
                      mergeFieldId,
                  };
                  body.fieldsToReturn = [3];
                  if (options.fields) {
                      body.fieldsToReturn = options.fields;
                  }
                  responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'POST', '/records', body);
                  if (simple) {
                      const { data: records } = responseData;
                      responseData = [];
                      for (const record of records) {
                          const recordData = {};
                          for (const [key, value] of Object.entries(record)) {
                              recordData[key] = value.value;
                          }
                          responseData.push(recordData);
                      }
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData });
                  returnData.push(...executionData);
              }
          }
          if (resource === 'report') {
              if (operation === 'run') {
                  for (let i = 0; i < length; i++) {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const tableId = this.getNodeParameter('tableId', i);
                      const reportId = this.getNodeParameter('reportId', i);
                      qs.tableId = tableId;
                      if (returnAll) {
                          responseData = await GenericFunctions_1.quickbaseApiRequestAllItems.call(this, 'POST', `/reports/${reportId}/run`, {}, qs);
                      }
                      else {
                          qs.top = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'POST', `/reports/${reportId}/run`, {}, qs);
                          const { data: records, fields } = responseData;
                          responseData = [];
                          const fieldsIdKey = {};
                          for (const field of fields) {
                              fieldsIdKey[field.id] = field.label;
                          }
                          for (const record of records) {
                              const data = {};
                              for (const [key, value] of Object.entries(record)) {
                                  data[fieldsIdKey[key]] = value.value;
                              }
                              responseData.push(data);
                          }
                      }
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'get') {
                  for (let i = 0; i < length; i++) {
                      const reportId = this.getNodeParameter('reportId', i);
                      const tableId = this.getNodeParameter('tableId', i);
                      qs.tableId = tableId;
                      responseData = await GenericFunctions_1.quickbaseApiRequest.call(this, 'GET', `/reports/${reportId}`, {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
          }
          return [returnData];
      }
  }
  exports.QuickBase = QuickBase;
  //# sourceMappingURL=QuickBase.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.QuickBaseApi = void 0;
  class QuickBaseApi {
      constructor() {
          this.name = 'quickbaseApi';
          this.displayName = 'Quick Base API';
          this.documentationUrl = 'quickbase';
          this.properties = [
              {
                  displayName: 'Hostname',
                  name: 'hostname',
                  type: 'string',
                  default: '',
                  required: true,
                  placeholder: 'demo.quickbase.com',
              },
              {
                  displayName: 'User Token',
                  name: 'userToken',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
                  required: true,
              },
          ];
      }
  }
  exports.QuickBaseApi = QuickBaseApi;
  //# sourceMappingURL=QuickBaseApi.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.QuickBaseApi = void 0;
  class QuickBaseApi {
      constructor() {
          this.name = 'quickbaseApi';
          this.displayName = 'Quick Base API';
          this.documentationUrl = 'quickbase';
          this.properties = [
              {
                  displayName: 'Hostname',
                  name: 'hostname',
                  type: 'string',
                  default: '',
                  required: true,
                  placeholder: 'demo.quickbase.com',
              },
              {
                  displayName: 'User Token',
                  name: 'userToken',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
                  required: true,
              },
          ];
      }
  }
  exports.QuickBaseApi = QuickBaseApi;
  //# sourceMappingURL=QuickBaseApi.credentials.js.map

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

  # Quick Base node

  Use the Quick Base node to automate work in Quick Base, and integrate Quick Base with other applications. n8n has built-in support for a wide range of Quick Base features, including creating, updating, deleting, and getting records, as well as getting fields, and downloading files. 

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

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

  ## Operations

  * Field
      * Get all fields
  * File
      * Delete a file
      * Download a file
  * Record
      * Create a record
      * Delete a record
      * Get all records
      * Update a record
      * Upsert a record
  * Report
      * Get a report
      * Run a report

  ## Templates and examples

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

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


node_type: n8n-nodes-base.RabbitMQ
name: RabbitMQ
display_name: RabbitMQ
description: Sends messages to a RabbitMQ topic
category: transform
icon: file:rabbitmq.png
code_hash: 1dda2f41631a54acedfd4cc856f7f2f752f0ea13171eb2040ae37520390a0f5d
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.RabbitMQ
documentation_title: RabbitMQ node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"rabbitmq","description":"Templates for rabbitmq"}]
related_resources: []
required_scopes: []
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-09 15:18:29
updated_at: 2025-06-09 15:18:29
source_code:
  "use strict";
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
      if (k2 === undefined) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() { return m[k]; } };
      }
      Object.defineProperty(o, k2, desc);
  }) : (function(o, m, k, k2) {
      if (k2 === undefined) k2 = k;
      o[k2] = m[k];
  }));
  var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
  }) : function(o, v) {
      o["default"] = v;
  });
  var __importStar = (this && this.__importStar) || function (mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
      __setModuleDefault(result, mod);
      return result;
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.RabbitMQ = void 0;
  const amqplib = __importStar(require("amqplib"));
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const utilities_1 = require("../../utils/utilities");
  class RabbitMQ {
      constructor() {
          this.description = {
              displayName: 'RabbitMQ',
              name: 'rabbitmq',
              icon: 'file:rabbitmq.png',
              group: ['transform'],
              version: [1, 1.1],
              description: 'Sends messages to a RabbitMQ topic',
              defaults: {
                  name: 'RabbitMQ',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'rabbitmq',
                      required: true,
                      testedBy: 'rabbitmqConnectionTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'hidden',
                      noDataExpression: true,
                      default: 'sendMessage',
                      displayOptions: {
                          show: {
                              '@version': [1],
                          },
                      },
                      options: [
                          {
                              name: 'Send a Message to RabbitMQ',
                              value: 'sendMessage',
                              action: 'Send a Message to RabbitMQ',
                          },
                          {
                              name: 'Delete From Queue',
                              value: 'deleteMessage',
                              action: 'Delete From Queue',
                          },
                      ],
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      default: 'sendMessage',
                      displayOptions: {
                          show: {
                              '@version': [1.1],
                          },
                      },
                      options: [
                          {
                              name: 'Send a Message to RabbitMQ',
                              value: 'sendMessage',
                              action: 'Send a Message to RabbitMQ',
                          },
                          {
                              name: 'Delete From Queue',
                              value: 'deleteMessage',
                              action: 'Delete From Queue',
                          },
                      ],
                  },
                  {
                      displayName: 'Will delete an item from the queue triggered earlier in the workflow by a RabbitMQ Trigger node',
                      name: 'deleteMessage',
                      type: 'notice',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['deleteMessage'],
                          },
                      },
                  },
                  {
                      displayName: 'Mode',
                      name: 'mode',
                      type: 'options',
                      displayOptions: {
                          hide: {
                              operation: ['deleteMessage'],
                          },
                      },
                      options: [
                          {
                              name: 'Queue',
                              value: 'queue',
                              description: 'Publish data to queue',
                          },
                          {
                              name: 'Exchange',
                              value: 'exchange',
                              description: 'Publish data to exchange',
                          },
                      ],
                      default: 'queue',
                      description: 'To where data should be moved',
                  },
                  {
                      displayName: 'Queue / Topic',
                      name: 'queue',
                      type: 'string',
                      displayOptions: {
                          show: {
                              mode: ['queue'],
                          },
                          hide: {
                              operation: ['deleteMessage'],
                          },
                      },
                      default: '',
                      placeholder: 'queue-name',
                      description: 'Name of the queue to publish to',
                  },
                  {
                      displayName: 'Exchange',
                      name: 'exchange',
                      type: 'string',
                      displayOptions: {
                          show: {
                              mode: ['exchange'],
                          },
                      },
                      default: '',
                      placeholder: 'exchange-name',
                      description: 'Name of the exchange to publish to',
                  },
                  {
                      displayName: 'Type',
                      name: 'exchangeType',
                      type: 'options',
                      displayOptions: {
                          show: {
                              mode: ['exchange'],
                          },
                      },
                      options: [
                          {
                              name: 'Direct',
                              value: 'direct',
                              description: 'Direct exchange type',
                          },
                          {
                              name: 'Topic',
                              value: 'topic',
                              description: 'Topic exchange type',
                          },
                          {
                              name: 'Headers',
                              value: 'headers',
                              description: 'Headers exchange type',
                          },
                          {
                              name: 'Fanout',
                              value: 'fanout',
                              description: 'Fanout exchange type',
                          },
                      ],
                      default: 'fanout',
                      description: 'Type of exchange',
                  },
                  {
                      displayName: 'Routing Key',
                      name: 'routingKey',
                      type: 'string',
                      displayOptions: {
                          show: {
                              mode: ['exchange'],
                          },
                      },
                      default: '',
                      placeholder: 'routing-key',
                      description: 'The routing key for the message',
                  },
                  {
                      displayName: 'Send Input Data',
                      name: 'sendInputData',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['sendMessage'],
                          },
                      },
                      default: true,
                      description: 'Whether to send the the data the node receives as JSON',
                  },
                  {
                      displayName: 'Message',
                      name: 'message',
                      type: 'string',
                      displayOptions: {
                          show: {
                              sendInputData: [false],
                          },
                      },
                      default: '',
                      description: 'The message to be sent',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['sendMessage'],
                          },
                      },
                      placeholder: 'Add Option',
                      options: [
                          {
                              displayName: 'Alternate Exchange',
                              name: 'alternateExchange',
                              type: 'string',
                              displayOptions: {
                                  show: {
                                      '/mode': ['exchange'],
                                  },
                              },
                              default: '',
                              description: 'An exchange to send messages to if this exchange can’t route them to any queues',
                          },
                          {
                              displayName: 'Arguments',
                              name: 'arguments',
                              placeholder: 'Add Argument',
                              description: 'Arguments to add',
                              type: 'fixedCollection',
                              typeOptions: {
                                  multipleValues: true,
                              },
                              default: {},
                              options: [
                                  {
                                      name: 'argument',
                                      displayName: 'Argument',
                                      values: [
                                          {
                                              displayName: 'Key',
                                              name: 'key',
                                              type: 'string',
                                              default: '',
                                          },
                                          {
                                              displayName: 'Value',
                                              name: 'value',
                                              type: 'string',
                                              default: '',
                                          },
                                      ],
                                  },
                              ],
                          },
                          {
                              displayName: 'Auto Delete Queue',
                              name: 'autoDelete',
                              type: 'boolean',
                              default: false,
                              description: 'Whether the queue will be deleted when the number of consumers drops to zero',
                          },
                          {
                              displayName: 'Durable',
                              name: 'durable',
                              type: 'boolean',
                              default: true,
                              description: 'Whether the queue will survive broker restarts',
                          },
                          {
                              displayName: 'Exclusive',
                              name: 'exclusive',
                              type: 'boolean',
                              displayOptions: {
                                  show: {
                                      '/mode': ['queue'],
                                  },
                              },
                              default: false,
                              description: 'Whether to scope the queue to the connection',
                          },
                          {
                              displayName: 'Headers',
                              name: 'headers',
                              placeholder: 'Add Header',
                              description: 'Headers to add',
                              type: 'fixedCollection',
                              typeOptions: {
                                  multipleValues: true,
                              },
                              default: {},
                              options: [
                                  {
                                      name: 'header',
                                      displayName: 'Header',
                                      values: [
                                          {
                                              displayName: 'Key',
                                              name: 'key',
                                              type: 'string',
                                              default: '',
                                          },
                                          {
                                              displayName: 'Value',
                                              name: 'value',
                                              type: 'string',
                                              default: '',
                                          },
                                      ],
                                  },
                              ],
                          },
                      ],
                  },
              ],
          };
          this.methods = {
              credentialTest: {
                  async rabbitmqConnectionTest(credential) {
                      const credentials = credential.data;
                      try {
                          const credentialKeys = ['hostname', 'port', 'username', 'password', 'vhost'];
                          const credentialData = {};
                          credentialKeys.forEach((key) => {
                              credentialData[key] = credentials[key] === '' ? undefined : credentials[key];
                          });
                          const optsData = {};
                          if (credentials.ssl === true) {
                              credentialData.protocol = 'amqps';
                              optsData.ca =
                                  credentials.ca === ''
                                      ? undefined
                                      : [Buffer.from((0, utilities_1.formatPrivateKey)(credentials.ca))];
                              if (credentials.passwordless === true) {
                                  optsData.cert =
                                      credentials.cert === ''
                                          ? undefined
                                          : Buffer.from((0, utilities_1.formatPrivateKey)(credentials.cert));
                                  optsData.key =
                                      credentials.key === ''
                                          ? undefined
                                          : Buffer.from((0, utilities_1.formatPrivateKey)(credentials.key));
                                  optsData.passphrase =
                                      credentials.passphrase === '' ? undefined : credentials.passphrase;
                                  optsData.credentials = amqplib.credentials.external();
                              }
                          }
                          const connection = await amqplib.connect(credentialData, optsData);
                          await connection.close();
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                      return {
                          status: 'OK',
                          message: 'Connection successful!',
                      };
                  },
              },
          };
      }
      async execute() {
          let channel, options;
          try {
              const items = this.getInputData();
              const operation = this.getNodeParameter('operation', 0);
              if (operation === 'deleteMessage') {
                  this.sendResponse(items[0].json);
                  return [items];
              }
              const mode = this.getNodeParameter('mode', 0) || 'queue';
              const returnItems = [];
              if (mode === 'queue') {
                  const queue = this.getNodeParameter('queue', 0);
                  options = this.getNodeParameter('options', 0, {});
                  channel = await GenericFunctions_1.rabbitmqConnectQueue.call(this, queue, options);
                  const sendInputData = this.getNodeParameter('sendInputData', 0);
                  let message;
                  const queuePromises = [];
                  for (let i = 0; i < items.length; i++) {
                      if (sendInputData) {
                          message = JSON.stringify(items[i].json);
                      }
                      else {
                          message = this.getNodeParameter('message', i);
                      }
                      let headers = {};
                      if (options.headers &&
                          options.headers.header.length) {
                          const itemOptions = this.getNodeParameter('options', i, {});
                          const additionalHeaders = {};
                          itemOptions.headers.header.forEach((header) => {
                              additionalHeaders[header.key] = header.value;
                          });
                          headers = additionalHeaders;
                      }
                      queuePromises.push(channel.sendToQueue(queue, Buffer.from(message), { headers }));
                  }
                  const promisesResponses = await Promise.allSettled(queuePromises);
                  promisesResponses.forEach((response) => {
                      if (response.status !== 'fulfilled') {
                          if (!this.continueOnFail()) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), response);
                          }
                          else {
                              returnItems.push({
                                  json: {
                                      error: response.reason,
                                  },
                              });
                              return;
                          }
                      }
                      returnItems.push({
                          json: {
                              success: response.value,
                          },
                      });
                  });
                  await channel.close();
                  await channel.connection.close();
              }
              else if (mode === 'exchange') {
                  const exchange = this.getNodeParameter('exchange', 0);
                  const type = this.getNodeParameter('exchangeType', 0);
                  const routingKey = this.getNodeParameter('routingKey', 0);
                  options = this.getNodeParameter('options', 0, {});
                  channel = await GenericFunctions_1.rabbitmqConnectExchange.call(this, exchange, type, options);
                  const sendInputData = this.getNodeParameter('sendInputData', 0);
                  let message;
                  const exchangePromises = [];
                  for (let i = 0; i < items.length; i++) {
                      if (sendInputData) {
                          message = JSON.stringify(items[i].json);
                      }
                      else {
                          message = this.getNodeParameter('message', i);
                      }
                      let headers = {};
                      if (options.headers &&
                          options.headers.header.length) {
                          const itemOptions = this.getNodeParameter('options', i, {});
                          const additionalHeaders = {};
                          itemOptions.headers.header.forEach((header) => {
                              additionalHeaders[header.key] = header.value;
                          });
                          headers = additionalHeaders;
                      }
                      exchangePromises.push(channel.publish(exchange, routingKey, Buffer.from(message), { headers }));
                  }
                  const promisesResponses = await Promise.allSettled(exchangePromises);
                  promisesResponses.forEach((response) => {
                      if (response.status !== 'fulfilled') {
                          if (!this.continueOnFail()) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), response);
                          }
                          else {
                              returnItems.push({
                                  json: {
                                      error: response.reason,
                                  },
                              });
                              return;
                          }
                      }
                      returnItems.push({
                          json: {
                              success: response.value,
                          },
                      });
                  });
                  await channel.close();
                  await channel.connection.close();
              }
              else {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${mode}" is not known!`);
              }
              return [returnItems];
          }
          catch (error) {
              if (channel) {
                  await channel.close();
                  await channel.connection.close();
              }
              throw error;
          }
      }
  }
  exports.RabbitMQ = RabbitMQ;
  //# sourceMappingURL=RabbitMQ.node.js.map

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

  # RabbitMQ node

  Use the RabbitMQ node to automate work in RabbitMQ, and integrate RabbitMQ with other applications. n8n has built-in support for a wide range of RabbitMQ features, including accepting, and forwarding messages. 

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

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

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

  ## Operations

  * Delete From Queue
  * Send a Message to RabbitMQ

  ## Templates and examples

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

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


node_type: n8n-nodes-base.Redis
name: Redis
display_name: Redis
description: Get, send and update data in Redis
category: input
icon: file:redis.svg
code_hash: facd578480f0b4acbbb4acf818dd36df1b1e4881ba29a0ed7eb649e08c5205d7
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.Redis
documentation_title: Redis node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"redis","description":"Templates for redis"}]
related_resources: []
required_scopes: []
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-09 15:18:31
updated_at: 2025-06-09 15:18:31
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.Redis = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const set_1 = __importDefault(require("lodash/set"));
  const redis_1 = __importDefault(require("redis"));
  const util_1 = __importDefault(require("util"));
  class Redis {
      constructor() {
          this.description = {
              displayName: 'Redis',
              name: 'redis',
              icon: 'file:redis.svg',
              group: ['input'],
              version: 1,
              description: 'Get, send and update data in Redis',
              defaults: {
                  name: 'Redis',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'redis',
                      required: true,
                      testedBy: 'redisConnectionTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete a key from Redis',
                              action: 'Delete a key from Redis',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get the value of a key from Redis',
                              action: 'Get the value of a key from Redis',
                          },
                          {
                              name: 'Increment',
                              value: 'incr',
                              description: 'Atomically increments a key by 1. Creates the key if it does not exist.',
                              action: 'Atomically increment a key by 1. Creates the key if it does not exist.',
                          },
                          {
                              name: 'Info',
                              value: 'info',
                              description: 'Returns generic information about the Redis instance',
                              action: 'Return generic information about the Redis instance',
                          },
                          {
                              name: 'Keys',
                              value: 'keys',
                              description: 'Returns all the keys matching a pattern',
                              action: 'Return all keys matching a pattern',
                          },
                          {
                              name: 'Pop',
                              value: 'pop',
                              description: 'Pop data from a redis list',
                              action: 'Pop data from a redis list',
                          },
                          {
                              name: 'Publish',
                              value: 'publish',
                              description: 'Publish message to redis channel',
                              action: 'Publish message to redis channel',
                          },
                          {
                              name: 'Push',
                              value: 'push',
                              description: 'Push data to a redis list',
                              action: 'Push data to a redis list',
                          },
                          {
                              name: 'Set',
                              value: 'set',
                              description: 'Set the value of a key in redis',
                              action: 'Set the value of a key in redis',
                          },
                      ],
                      default: 'info',
                  },
                  {
                      displayName: 'Name',
                      name: 'propertyName',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['get'],
                          },
                      },
                      default: 'propertyName',
                      required: true,
                      description: 'Name of the property to write received data to. Supports dot-notation. Example: "data.person[0].name".',
                  },
                  {
                      displayName: 'Key',
                      name: 'key',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['delete'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Name of the key to delete from Redis',
                  },
                  {
                      displayName: 'Key',
                      name: 'key',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['get'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Name of the key to get from Redis',
                  },
                  {
                      displayName: 'Key Type',
                      name: 'keyType',
                      type: 'options',
                      displayOptions: {
                          show: {
                              operation: ['get'],
                          },
                      },
                      options: [
                          {
                              name: 'Automatic',
                              value: 'automatic',
                              description: 'Requests the type before requesting the data (slower)',
                          },
                          {
                              name: 'Hash',
                              value: 'hash',
                              description: "Data in key is of type 'hash'",
                          },
                          {
                              name: 'List',
                              value: 'list',
                              description: "Data in key is of type 'lists'",
                          },
                          {
                              name: 'Sets',
                              value: 'sets',
                              description: "Data in key is of type 'sets'",
                          },
                          {
                              name: 'String',
                              value: 'string',
                              description: "Data in key is of type 'string'",
                          },
                      ],
                      default: 'automatic',
                      description: 'The type of the key to get',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      displayOptions: {
                          show: {
                              operation: ['get'],
                          },
                      },
                      placeholder: 'Add Option',
                      default: {},
                      options: [
                          {
                              displayName: 'Dot Notation',
                              name: 'dotNotation',
                              type: 'boolean',
                              default: true,
                              description: '<p>By default, dot-notation is used in property names. This means that "a.b" will set the property "b" underneath "a" so { "a": { "b": value} }.<p></p>If that is not intended this can be deactivated, it will then set { "a.b": value } instead.</p>.',
                          },
                      ],
                  },
                  {
                      displayName: 'Key',
                      name: 'key',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['incr'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Name of the key to increment',
                  },
                  {
                      displayName: 'Expire',
                      name: 'expire',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['incr'],
                          },
                      },
                      default: false,
                      description: 'Whether to set a timeout on key',
                  },
                  {
                      displayName: 'TTL',
                      name: 'ttl',
                      type: 'number',
                      typeOptions: {
                          minValue: 1,
                      },
                      displayOptions: {
                          show: {
                              operation: ['incr'],
                              expire: [true],
                          },
                      },
                      default: 60,
                      description: 'Number of seconds before key expiration',
                  },
                  {
                      displayName: 'Key Pattern',
                      name: 'keyPattern',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['keys'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'The key pattern for the keys to return',
                  },
                  {
                      displayName: 'Get Values',
                      name: 'getValues',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['keys'],
                          },
                      },
                      default: true,
                      description: 'Whether to get the value of matching keys',
                  },
                  {
                      displayName: 'Key',
                      name: 'key',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['set'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Name of the key to set in Redis',
                  },
                  {
                      displayName: 'Value',
                      name: 'value',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['set'],
                          },
                      },
                      default: '',
                      description: 'The value to write in Redis',
                  },
                  {
                      displayName: 'Key Type',
                      name: 'keyType',
                      type: 'options',
                      displayOptions: {
                          show: {
                              operation: ['set'],
                          },
                      },
                      options: [
                          {
                              name: 'Automatic',
                              value: 'automatic',
                              description: 'Tries to figure out the type automatically depending on the data',
                          },
                          {
                              name: 'Hash',
                              value: 'hash',
                              description: "Data in key is of type 'hash'",
                          },
                          {
                              name: 'List',
                              value: 'list',
                              description: "Data in key is of type 'lists'",
                          },
                          {
                              name: 'Sets',
                              value: 'sets',
                              description: "Data in key is of type 'sets'",
                          },
                          {
                              name: 'String',
                              value: 'string',
                              description: "Data in key is of type 'string'",
                          },
                      ],
                      default: 'automatic',
                      description: 'The type of the key to set',
                  },
                  {
                      displayName: 'Value Is JSON',
                      name: 'valueIsJSON',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              keyType: ['hash'],
                          },
                      },
                      default: true,
                      description: 'Whether the value is JSON or key value pairs',
                  },
                  {
                      displayName: 'Expire',
                      name: 'expire',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['set'],
                          },
                      },
                      default: false,
                      description: 'Whether to set a timeout on key',
                  },
                  {
                      displayName: 'TTL',
                      name: 'ttl',
                      type: 'number',
                      typeOptions: {
                          minValue: 1,
                      },
                      displayOptions: {
                          show: {
                              operation: ['set'],
                              expire: [true],
                          },
                      },
                      default: 60,
                      description: 'Number of seconds before key expiration',
                  },
                  {
                      displayName: 'Channel',
                      name: 'channel',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['publish'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Channel name',
                  },
                  {
                      displayName: 'Data',
                      name: 'messageData',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['publish'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Data to publish',
                  },
                  {
                      displayName: 'List',
                      name: 'list',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['push', 'pop'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Name of the list in Redis',
                  },
                  {
                      displayName: 'Data',
                      name: 'messageData',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['push'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Data to push',
                  },
                  {
                      displayName: 'Tail',
                      name: 'tail',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['push', 'pop'],
                          },
                      },
                      default: false,
                      description: 'Whether to push or pop data from the end of the list',
                  },
                  {
                      displayName: 'Name',
                      name: 'propertyName',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['pop'],
                          },
                      },
                      default: 'propertyName',
                      description: 'Optional name of the property to write received data to. Supports dot-notation. Example: "data.person[0].name".',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      displayOptions: {
                          show: {
                              operation: ['pop'],
                          },
                      },
                      placeholder: 'Add Option',
                      default: {},
                      options: [
                          {
                              displayName: 'Dot Notation',
                              name: 'dotNotation',
                              type: 'boolean',
                              default: true,
                              description: '<p>By default, dot-notation is used in property names. This means that "a.b" will set the property "b" underneath "a" so { "a": { "b": value} }.<p></p>If that is not intended this can be deactivated, it will then set { "a.b": value } instead.</p>.',
                          },
                      ],
                  },
              ],
          };
          this.methods = {
              credentialTest: {
                  async redisConnectionTest(credential) {
                      const credentials = credential.data;
                      const redisOptions = {
                          host: credentials.host,
                          port: credentials.port,
                          db: credentials.database,
                      };
                      if (credentials.password) {
                          redisOptions.password = credentials.password;
                      }
                      try {
                          const client = redis_1.default.createClient(redisOptions);
                          await new Promise((resolve, reject) => {
                              client.on('connect', async () => {
                                  client.ping('ping', (error, pong) => {
                                      if (error)
                                          reject(error);
                                      resolve(pong);
                                      client.quit();
                                  });
                              });
                              client.on('error', async (err) => {
                                  client.quit();
                                  reject(err);
                              });
                          });
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                      return {
                          status: 'OK',
                          message: 'Connection successful!',
                      };
                  },
              },
          };
      }
      async execute() {
          function getParsedValue(value) {
              if (value.match(/^[\d\.]+$/) === null) {
                  return value;
              }
              else {
                  return parseFloat(value);
              }
          }
          function convertInfoToObject(stringData) {
              const returnData = {};
              let key, value;
              for (const line of stringData.split('\n')) {
                  if (['#', ''].includes(line.charAt(0))) {
                      continue;
                  }
                  [key, value] = line.split(':');
                  if (key === undefined || value === undefined) {
                      continue;
                  }
                  value = value.trim();
                  if (value.includes('=')) {
                      returnData[key] = {};
                      let key2, value2;
                      for (const keyValuePair of value.split(',')) {
                          [key2, value2] = keyValuePair.split('=');
                          returnData[key][key2] = getParsedValue(value2);
                      }
                  }
                  else {
                      returnData[key] = getParsedValue(value);
                  }
              }
              return returnData;
          }
          async function getValue(client, keyName, type) {
              if (type === undefined || type === 'automatic') {
                  const clientType = util_1.default.promisify(client.type).bind(client);
                  type = await clientType(keyName);
              }
              if (type === 'string') {
                  const clientGet = util_1.default.promisify(client.get).bind(client);
                  return clientGet(keyName);
              }
              else if (type === 'hash') {
                  const clientHGetAll = util_1.default.promisify(client.hgetall).bind(client);
                  return clientHGetAll(keyName);
              }
              else if (type === 'list') {
                  const clientLRange = util_1.default.promisify(client.lrange).bind(client);
                  return clientLRange(keyName, 0, -1);
              }
              else if (type === 'sets') {
                  const clientSMembers = util_1.default.promisify(client.smembers).bind(client);
                  return clientSMembers(keyName);
              }
          }
          const setValue = async (client, keyName, value, expire, ttl, type, valueIsJSON) => {
              if (type === undefined || type === 'automatic') {
                  if (typeof value === 'string') {
                      type = 'string';
                  }
                  else if (Array.isArray(value)) {
                      type = 'list';
                  }
                  else if (typeof value === 'object') {
                      type = 'hash';
                  }
                  else {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Could not identify the type to set. Please set it manually!');
                  }
              }
              if (type === 'string') {
                  const clientSet = util_1.default.promisify(client.set).bind(client);
                  await clientSet(keyName, value.toString());
              }
              else if (type === 'hash') {
                  const clientHset = util_1.default.promisify(client.hset).bind(client);
                  if (valueIsJSON) {
                      let values;
                      if (typeof value === 'string') {
                          try {
                              values = JSON.parse(value);
                          }
                          catch {
                              values = value;
                          }
                      }
                      else {
                          values = value;
                      }
                      for (const key of Object.keys(values)) {
                          await clientHset(keyName, key, values[key].toString());
                      }
                  }
                  else {
                      const values = value.toString().split(' ');
                      await clientHset(keyName, values);
                  }
              }
              else if (type === 'list') {
                  const clientLset = util_1.default.promisify(client.lset).bind(client);
                  for (let index = 0; index < value.length; index++) {
                      await clientLset(keyName, index, value[index].toString());
                  }
              }
              else if (type === 'sets') {
                  const clientSadd = util_1.default.promisify(client.sadd).bind(client);
                  await clientSadd(keyName, value);
              }
              if (expire) {
                  const clientExpire = util_1.default.promisify(client.expire).bind(client);
                  await clientExpire(keyName, ttl);
              }
              return;
          };
          return new Promise(async (resolve, reject) => {
              const credentials = await this.getCredentials('redis');
              const redisOptions = {
                  host: credentials.host,
                  port: credentials.port,
                  db: credentials.database,
              };
              if (credentials.password) {
                  redisOptions.password = credentials.password;
              }
              const client = redis_1.default.createClient(redisOptions);
              const operation = this.getNodeParameter('operation', 0);
              client.on('error', (err) => {
                  client.quit();
                  reject(err);
              });
              client.on('ready', async (_err) => {
                  client.select(credentials.database);
                  try {
                      if (operation === 'info') {
                          const clientInfo = util_1.default.promisify(client.info).bind(client);
                          const result = await clientInfo();
                          resolve([[{ json: convertInfoToObject(result) }]]);
                          client.quit();
                      }
                      else if (['delete', 'get', 'keys', 'set', 'incr', 'publish', 'push', 'pop'].includes(operation)) {
                          const items = this.getInputData();
                          const returnItems = [];
                          let item;
                          for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
                              item = { json: {} };
                              if (operation === 'delete') {
                                  const keyDelete = this.getNodeParameter('key', itemIndex);
                                  const clientDel = util_1.default.promisify(client.del).bind(client);
                                  await clientDel(keyDelete);
                                  returnItems.push(items[itemIndex]);
                              }
                              else if (operation === 'get') {
                                  const propertyName = this.getNodeParameter('propertyName', itemIndex);
                                  const keyGet = this.getNodeParameter('key', itemIndex);
                                  const keyType = this.getNodeParameter('keyType', itemIndex);
                                  const value = (await getValue(client, keyGet, keyType)) || null;
                                  const options = this.getNodeParameter('options', itemIndex, {});
                                  if (options.dotNotation === false) {
                                      item.json[propertyName] = value;
                                  }
                                  else {
                                      (0, set_1.default)(item.json, propertyName, value);
                                  }
                                  returnItems.push(item);
                              }
                              else if (operation === 'keys') {
                                  const keyPattern = this.getNodeParameter('keyPattern', itemIndex);
                                  const getValues = this.getNodeParameter('getValues', itemIndex, true);
                                  const clientKeys = util_1.default.promisify(client.keys).bind(client);
                                  const keys = await clientKeys(keyPattern);
                                  if (!getValues) {
                                      returnItems.push({ json: { keys } });
                                      continue;
                                  }
                                  const promises = {};
                                  for (const keyName of keys) {
                                      promises[keyName] = await getValue(client, keyName);
                                  }
                                  for (const keyName of keys) {
                                      item.json[keyName] = await promises[keyName];
                                  }
                                  returnItems.push(item);
                              }
                              else if (operation === 'set') {
                                  const keySet = this.getNodeParameter('key', itemIndex);
                                  const value = this.getNodeParameter('value', itemIndex);
                                  const keyType = this.getNodeParameter('keyType', itemIndex);
                                  const valueIsJSON = this.getNodeParameter('valueIsJSON', itemIndex, true);
                                  const expire = this.getNodeParameter('expire', itemIndex, false);
                                  const ttl = this.getNodeParameter('ttl', itemIndex, -1);
                                  await setValue(client, keySet, value, expire, ttl, keyType, valueIsJSON);
                                  returnItems.push(items[itemIndex]);
                              }
                              else if (operation === 'incr') {
                                  const keyIncr = this.getNodeParameter('key', itemIndex);
                                  const expire = this.getNodeParameter('expire', itemIndex, false);
                                  const ttl = this.getNodeParameter('ttl', itemIndex, -1);
                                  const clientIncr = util_1.default.promisify(client.incr).bind(client);
                                  const incrementVal = await clientIncr(keyIncr);
                                  if (expire && ttl > 0) {
                                      const clientExpire = util_1.default.promisify(client.expire).bind(client);
                                      await clientExpire(keyIncr, ttl);
                                  }
                                  returnItems.push({ json: { [keyIncr]: incrementVal } });
                              }
                              else if (operation === 'publish') {
                                  const channel = this.getNodeParameter('channel', itemIndex);
                                  const messageData = this.getNodeParameter('messageData', itemIndex);
                                  const clientPublish = util_1.default.promisify(client.publish).bind(client);
                                  await clientPublish(channel, messageData);
                                  returnItems.push(items[itemIndex]);
                              }
                              else if (operation === 'push') {
                                  const redisList = this.getNodeParameter('list', itemIndex);
                                  const messageData = this.getNodeParameter('messageData', itemIndex);
                                  const tail = this.getNodeParameter('tail', itemIndex, false);
                                  const action = tail ? client.RPUSH : client.LPUSH;
                                  const clientPush = util_1.default.promisify(action).bind(client);
                                  await clientPush(redisList, messageData);
                                  returnItems.push(items[itemIndex]);
                              }
                              else if (operation === 'pop') {
                                  const redisList = this.getNodeParameter('list', itemIndex);
                                  const tail = this.getNodeParameter('tail', itemIndex, false);
                                  const propertyName = this.getNodeParameter('propertyName', itemIndex, 'propertyName');
                                  const action = tail ? client.rpop : client.lpop;
                                  const clientPop = util_1.default.promisify(action).bind(client);
                                  const value = await clientPop(redisList);
                                  let outputValue;
                                  try {
                                      outputValue = JSON.parse(value);
                                  }
                                  catch {
                                      outputValue = value;
                                  }
                                  const options = this.getNodeParameter('options', itemIndex, {});
                                  if (options.dotNotation === false) {
                                      item.json[propertyName] = outputValue;
                                  }
                                  else {
                                      (0, set_1.default)(item.json, propertyName, outputValue);
                                  }
                                  returnItems.push(item);
                              }
                          }
                          client.quit();
                          resolve([returnItems]);
                      }
                  }
                  catch (error) {
                      reject(error);
                  }
              });
          });
      }
  }
  exports.Redis = Redis;
  //# sourceMappingURL=Redis.node.js.map

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

  # Redis node

  Use the Redis node to automate work in Redis, and integrate Redis with other applications. n8n has built-in support for a wide range of Redis features, including deleting keys, getting key values, setting key value, and publishing messages to the Redis channel.  

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

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

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

  ## Operations

  * Delete a key from Redis.
  * Get the value of a key from Redis.
  * Returns generic information about the Redis instance.
  * Atomically increments a key by 1. Creates the key if it doesn't exist.
  * Returns all the keys matching a pattern.
  * Set the value of a key in Redis.
  * Publish message to Redis channel.

  ## Templates and examples

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

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


node_type: n8n-nodes-base.ReadBinaryFiles
name: ReadBinaryFiles
display_name: Read Binary Files
description: Reads binary files from disk
category: input
icon: fa:file-import
code_hash: b4e758feeb596d9a366840a789ede02f9592fdf23b6da29d0e7fe3a49053ac85
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-09 15:18:31
updated_at: 2025-06-09 15:18:31
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.ReadBinaryFiles = void 0;
  const fast_glob_1 = __importDefault(require("fast-glob"));
  const utilities_1 = require("../../utils/utilities");
  class ReadBinaryFiles {
      constructor() {
          this.description = {
              displayName: 'Read Binary Files',
              name: 'readBinaryFiles',
              icon: 'fa:file-import',
              group: ['input'],
              version: 1,
              description: 'Reads binary files from disk',
              defaults: {
                  name: 'Read Binary Files',
                  color: '#44AA44',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'File Selector',
                      name: 'fileSelector',
                      type: 'string',
                      default: '',
                      required: true,
                      placeholder: '*.jpg',
                      description: 'Pattern for files to read',
                  },
                  {
                      displayName: 'Property Name',
                      name: 'dataPropertyName',
                      type: 'string',
                      default: 'data',
                      required: true,
                      description: 'Name of the binary property to which to write the data of the read files',
                  },
              ],
          };
      }
      async execute() {
          const fileSelector = this.getNodeParameter('fileSelector', 0);
          const dataPropertyName = this.getNodeParameter('dataPropertyName', 0);
          const pairedItem = (0, utilities_1.generatePairedItemData)(this.getInputData().length);
          const files = await (0, fast_glob_1.default)(fileSelector);
          const items = [];
          for (const filePath of files) {
              const stream = await this.helpers.createReadStream(filePath);
              items.push({
                  binary: {
                      [dataPropertyName]: await this.helpers.prepareBinaryData(stream, filePath),
                  },
                  json: {},
                  pairedItem,
              });
          }
          return [items];
      }
  }
  exports.ReadBinaryFiles = ReadBinaryFiles;
  //# sourceMappingURL=ReadBinaryFiles.node.js.map

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


node_type: n8n-nodes-base.ReadPDF
name: ReadPDF
display_name: Read PDF
description: Reads a PDF and extracts its content
category: input
icon: fa:file-pdf
code_hash: 09ec3debb56dca4fe21573be43e2e40abcadf51eb42bf7219407cd46d1fc9767
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-09 15:18:31
updated_at: 2025-06-09 15:18:31
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ReadPDF = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const pdfjs_dist_1 = require("pdfjs-dist");
  const parseText = (textContent) => {
      let lastY = undefined;
      const text = [];
      for (const item of textContent.items) {
          if ('str' in item) {
              if (lastY == item.transform[5] || !lastY) {
                  text.push(item.str);
              }
              else {
                  text.push(`\n${item.str}`);
              }
              lastY = item.transform[5];
          }
      }
      return text.join('');
  };
  class ReadPDF {
      constructor() {
          this.description = {
              displayName: 'Read PDF',
              name: 'readPDF',
              icon: 'fa:file-pdf',
              group: ['input'],
              version: 1,
              description: 'Reads a PDF and extracts its content',
              defaults: {
                  name: 'Read PDF',
                  color: '#003355',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'Binary Property',
                      name: 'binaryPropertyName',
                      type: 'string',
                      default: 'data',
                      required: true,
                      description: 'Name of the binary property from which to read the PDF file',
                  },
                  {
                      displayName: 'Encrypted',
                      name: 'encrypted',
                      type: 'boolean',
                      default: false,
                      required: true,
                  },
                  {
                      displayName: 'Password',
                      name: 'password',
                      type: 'string',
                      typeOptions: { password: true },
                      default: '',
                      description: 'Password to decrypt the PDF file with',
                      displayOptions: {
                          show: {
                              encrypted: [true],
                          },
                      },
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          for (let itemIndex = 0; itemIndex < length; itemIndex++) {
              try {
                  const binaryPropertyName = this.getNodeParameter('binaryPropertyName', itemIndex);
                  const binaryData = this.helpers.assertBinaryData(itemIndex, binaryPropertyName);
                  const params = {};
                  if (this.getNodeParameter('encrypted', itemIndex) === true) {
                      params.password = this.getNodeParameter('password', itemIndex);
                  }
                  if (binaryData.id) {
                      const binaryPath = this.helpers.getBinaryPath(binaryData.id);
                      params.url = new URL(`file://${binaryPath}`);
                  }
                  else {
                      params.data = Buffer.from(binaryData.data, n8n_workflow_1.BINARY_ENCODING).buffer;
                  }
                  const document = await (0, pdfjs_dist_1.getDocument)(params).promise;
                  const { info, metadata } = await document
                      .getMetadata()
                      .catch(() => ({ info: null, metadata: null }));
                  const pages = [];
                  for (let i = 1; i <= document.numPages; i++) {
                      const page = await document.getPage(i);
                      const text = await page.getTextContent().then(parseText);
                      pages.push(text);
                  }
                  returnData.push({
                      binary: items[itemIndex].binary,
                      json: {
                          numpages: document.numPages,
                          numrender: document.numPages,
                          info,
                          metadata: metadata === null || metadata === void 0 ? void 0 : metadata.getAll(),
                          text: pages.join('\n\n'),
                          version: pdfjs_dist_1.version,
                      },
                  });
              }
              catch (error) {
                  console.log(error);
                  if (this.continueOnFail()) {
                      returnData.push({
                          json: {
                              error: error.message,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.ReadPDF = ReadPDF;
  //# sourceMappingURL=ReadPDF.node.js.map

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


node_type: n8n-nodes-base.RespondToWebhook
name: RespondToWebhook
display_name: Respond to Webhook
description: Returns data for Webhook
category: transform
icon: file:webhook.svg
code_hash: 95d3ea6eec3f2182949cb94764aaafedbf727bc3b52e721ca5e1f7f81734501b
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.RespondToWebhook
documentation_title: Respond to Webhook
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"respond-to-webhook","description":"Templates for respond-to-webhook"}]
related_resources: []
required_scopes: []
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-09 15:18:31
updated_at: 2025-06-09 15:18:31
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.RespondToWebhook = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  class RespondToWebhook {
      constructor() {
          this.description = {
              displayName: 'Respond to Webhook',
              icon: 'file:webhook.svg',
              name: 'respondToWebhook',
              group: ['transform'],
              version: 1,
              description: 'Returns data for Webhook',
              defaults: {
                  name: 'Respond to Webhook',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [],
              properties: [
                  {
                      displayName: 'Respond With',
                      name: 'respondWith',
                      type: 'options',
                      options: [
                          {
                              name: 'Binary',
                              value: 'binary',
                          },
                          {
                              name: 'First Incoming Item',
                              value: 'firstIncomingItem',
                          },
                          {
                              name: 'JSON',
                              value: 'json',
                          },
                          {
                              name: 'No Data',
                              value: 'noData',
                          },
                          {
                              name: 'Text',
                              value: 'text',
                          },
                      ],
                      default: 'firstIncomingItem',
                      description: 'The data that should be returned',
                  },
                  {
                      displayName: 'When using expressions, note that this node will only run for the first item in the input data.',
                      name: 'webhookNotice',
                      type: 'notice',
                      displayOptions: {
                          show: {
                              respondWith: ['json', 'text'],
                          },
                      },
                      default: '',
                  },
                  {
                      displayName: 'Response Body',
                      name: 'responseBody',
                      type: 'json',
                      displayOptions: {
                          show: {
                              respondWith: ['json'],
                          },
                      },
                      default: '',
                      placeholder: '{ "key": "value" }',
                      description: 'The HTTP Response JSON data',
                  },
                  {
                      displayName: 'Response Body',
                      name: 'responseBody',
                      type: 'string',
                      displayOptions: {
                          show: {
                              respondWith: ['text'],
                          },
                      },
                      default: '',
                      placeholder: 'e.g. Workflow started',
                      description: 'The HTTP Response text data',
                  },
                  {
                      displayName: 'Response Data Source',
                      name: 'responseDataSource',
                      type: 'options',
                      displayOptions: {
                          show: {
                              respondWith: ['binary'],
                          },
                      },
                      options: [
                          {
                              name: 'Choose Automatically From Input',
                              value: 'automatically',
                              description: 'Use if input data will contain a single piece of binary data',
                          },
                          {
                              name: 'Specify Myself',
                              value: 'set',
                              description: 'Enter the name of the input field the binary data will be in',
                          },
                      ],
                      default: 'automatically',
                  },
                  {
                      displayName: 'Input Field Name',
                      name: 'inputFieldName',
                      type: 'string',
                      required: true,
                      default: 'data',
                      displayOptions: {
                          show: {
                              respondWith: ['binary'],
                              responseDataSource: ['set'],
                          },
                      },
                      description: 'The name of the node input field with the binary data',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      options: [
                          {
                              displayName: 'Response Code',
                              name: 'responseCode',
                              type: 'number',
                              typeOptions: {
                                  minValue: 100,
                                  maxValue: 599,
                              },
                              default: 200,
                              description: 'The HTTP Response code to return. Defaults to 200.',
                          },
                          {
                              displayName: 'Response Headers',
                              name: 'responseHeaders',
                              placeholder: 'Add Response Header',
                              description: 'Add headers to the webhook response',
                              type: 'fixedCollection',
                              typeOptions: {
                                  multipleValues: true,
                              },
                              default: {},
                              options: [
                                  {
                                      name: 'entries',
                                      displayName: 'Entries',
                                      values: [
                                          {
                                              displayName: 'Name',
                                              name: 'name',
                                              type: 'string',
                                              default: '',
                                              description: 'Name of the header',
                                          },
                                          {
                                              displayName: 'Value',
                                              name: 'value',
                                              type: 'string',
                                              default: '',
                                              description: 'Value of the header',
                                          },
                                      ],
                                  },
                              ],
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          var _a, _b, _c;
          const items = this.getInputData();
          const respondWith = this.getNodeParameter('respondWith', 0);
          const options = this.getNodeParameter('options', 0, {});
          const headers = {};
          if (options.responseHeaders) {
              for (const header of options.responseHeaders.entries) {
                  if (typeof header.name !== 'string') {
                      header.name = (_a = header.name) === null || _a === void 0 ? void 0 : _a.toString();
                  }
                  headers[(_b = header.name) === null || _b === void 0 ? void 0 : _b.toLowerCase()] = (_c = header.value) === null || _c === void 0 ? void 0 : _c.toString();
              }
          }
          let responseBody;
          if (respondWith === 'json') {
              const responseBodyParameter = this.getNodeParameter('responseBody', 0);
              if (responseBodyParameter) {
                  if (typeof responseBodyParameter === 'object') {
                      responseBody = responseBodyParameter;
                  }
                  else {
                      responseBody = (0, n8n_workflow_1.jsonParse)(responseBodyParameter, {
                          errorMessage: "Invalid JSON in 'Response Body' field",
                      });
                  }
              }
          }
          else if (respondWith === 'firstIncomingItem') {
              responseBody = items[0].json;
          }
          else if (respondWith === 'text') {
              responseBody = this.getNodeParameter('responseBody', 0);
          }
          else if (respondWith === 'binary') {
              const item = items[0];
              if (item.binary === undefined) {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No binary data exists on the first item!');
              }
              let responseBinaryPropertyName;
              const responseDataSource = this.getNodeParameter('responseDataSource', 0);
              if (responseDataSource === 'set') {
                  responseBinaryPropertyName = this.getNodeParameter('inputFieldName', 0);
              }
              else {
                  const binaryKeys = Object.keys(item.binary);
                  if (binaryKeys.length === 0) {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No binary data exists on the first item!');
                  }
                  responseBinaryPropertyName = binaryKeys[0];
              }
              const binaryData = this.helpers.assertBinaryData(0, responseBinaryPropertyName);
              if (binaryData.id) {
                  responseBody = { binaryData };
              }
              else {
                  responseBody = Buffer.from(binaryData.data, n8n_workflow_1.BINARY_ENCODING);
                  headers['content-length'] = responseBody.length;
              }
              if (!headers['content-type']) {
                  headers['content-type'] = binaryData.mimeType;
              }
          }
          else if (respondWith !== 'noData') {
              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The Response Data option "${respondWith}" is not supported!`);
          }
          const response = {
              body: responseBody,
              headers,
              statusCode: options.responseCode || 200,
          };
          this.sendResponse(response);
          return [items];
      }
  }
  exports.RespondToWebhook = RespondToWebhook;
  //# sourceMappingURL=RespondToWebhook.node.js.map

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

  # Respond to Webhook

  Use the Respond to Webhook node to control the response to incoming webhooks. This node works with the [Webhook](/integrations/builtin/core-nodes/n8n-nodes-base.webhook/index.md) node.

  /// note | Runs once for the first data item
  The Respond to Webhook node runs once, using the first incoming data item. Refer to [Return more than one data item](#return-more-than-one-data-item-deprecated) for more information.
  ///

  ## How to use Respond to Webhook

  To use the Respond to Webhook node:

  1. Add a [Webhook](/integrations/builtin/core-nodes/n8n-nodes-base.webhook/index.md) node as the trigger node for the workflow.
  1. In the Webhook node, set **Respond** to **Using 'Respond to Webhook' node**.
  1. Add the Respond to Webhook node anywhere in your workflow. If you want it to return data from other nodes, place it after those nodes.

  ## Node parameters

  Configure the node behavior using these parameters.

  ### Respond With

  Choose what data to send in the webhook response.

  - **All Incoming Items**: Respond with all the JSON items from the input.
  - **Binary**: Respond with a binary file defined in **Response Data Source**.
  - **First Incoming Item**: Respond with the first incoming item's JSON.
  - **JSON**: Respond with a JSON object defined in **Response Body**.
  - **No Data**: No response payload.
  - **Redirect**: Redirect to a URL set in **Redirect URL**.
  - **Text**: Respond with text set in **Response Body**.

  ## Node options

  Select **Add Option** to view and set the options.

  - **Response Code**: Set the [response code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status){:target=_blank .external-link} to use.
  - **Response Headers**: Define the response headers to send.
  - **Put Response in Field**: Available when you respond with **All Incoming Items** or **First Incoming Item**. Set the field name for the field containing the response data.

  ## Templates and examples

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

  ## Workflow behavior

  When using the Respond to Webhook node, workflows behave as follows:

  - The workflow finishes without executing the Respond to Webhook node: it returns a standard message with a 200 status.
  - The workflow errors before the first Respond to Webhook node executes: the workflow returns an error message with a 500 status.
  - A second Respond to Webhook node executes after the first one: the workflow ignores it.
  - A Respond to Webhook node executes but there was no webhook: the workflow ignores the Respond to Webhook node.

  ## Return more than one data item (deprecated)

  /// note | Deprecated in 1.22.0
  n8n 1.22.0 added support for returning all data items using the **All Incoming Items** option. n8n recommends upgrading to the latest version of n8n, instead of using the workarounds described in this section.
  ///

  The Respond to Webhook node runs once, using the first incoming data item. This includes when using [expressions](/code/expressions.md). You can't force looping using the Loop node: the workflow will run, but the webhook response will still only contain the results of the first execution. 

  If you need to return more than one data item, choose one of these options:

  - Instead of using the Respond to Webhook node, use the **When Last Node Finishes** option in **Respond** in the Webhook node. Use this when you want to return the final data that the workflow outputs.
  - Use the [Aggregate](/integrations/builtin/core-nodes/n8n-nodes-base.aggregate.md) node to turn multiple items into a single item before passing the data to the Respond to Webhook node. Set **Aggregate** to **All Item Data (Into a Single List)**.

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


node_type: n8n-nodes-base.Rocketchat
name: Rocketchat
display_name: RocketChat
description: Consume RocketChat API
category: output
icon: file:rocketchat.svg
code_hash: df9e3192d2c8442bd08a2c62870bb8d2e83a38680502727e204def8a46a2d453
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.Rocketchat
documentation_title: Rocket.Chat node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"rocketchat","description":"Templates for rocketchat"}]
related_resources: []
required_scopes: []
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-09 15:18:31
updated_at: 2025-06-09 15:18:31
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Rocketchat = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  class Rocketchat {
      constructor() {
          this.description = {
              displayName: 'RocketChat',
              name: 'rocketchat',
              icon: 'file:rocketchat.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
              description: 'Consume RocketChat API',
              defaults: {
                  name: 'RocketChat',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'rocketchatApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Chat',
                              value: 'chat',
                          },
                      ],
                      default: 'chat',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['chat'],
                          },
                      },
                      options: [
                          {
                              name: 'Post Message',
                              value: 'postMessage',
                              description: 'Post a message to a channel or a direct message',
                              action: 'Post a message',
                          },
                      ],
                      default: 'postMessage',
                  },
                  {
                      displayName: 'Channel',
                      name: 'channel',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['chat'],
                              operation: ['postMessage'],
                          },
                      },
                      default: '',
                      description: 'The channel name with the prefix in front of it',
                  },
                  {
                      displayName: 'Text',
                      name: 'text',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['chat'],
                              operation: ['postMessage'],
                          },
                      },
                      default: '',
                      description: 'The text of the message to send, is optional because of attachments',
                  },
                  {
                      displayName: 'JSON Parameters',
                      name: 'jsonParameters',
                      type: 'boolean',
                      default: false,
                      displayOptions: {
                          show: {
                              resource: ['chat'],
                              operation: ['postMessage'],
                          },
                      },
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['chat'],
                              operation: ['postMessage'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Alias',
                              name: 'alias',
                              type: 'string',
                              default: '',
                              description: 'This will cause the message’s name to appear as the given alias, but your username will still display',
                          },
                          {
                              displayName: 'Avatar',
                              name: 'avatar',
                              type: 'string',
                              default: '',
                              description: 'If provided, this will make the avatar use the provided image URL',
                          },
                          {
                              displayName: 'Emoji',
                              name: 'emoji',
                              type: 'string',
                              default: '',
                              description: 'This will cause the message’s name to appear as the given alias, but your username will still display',
                          },
                      ],
                  },
                  {
                      displayName: 'Attachments',
                      name: 'attachments',
                      type: 'collection',
                      default: {},
                      placeholder: 'Add Attachment Item',
                      typeOptions: {
                          multipleValues: true,
                          multipleValueButtonText: 'Add Attachment',
                      },
                      displayOptions: {
                          show: {
                              resource: ['chat'],
                              operation: ['postMessage'],
                              jsonParameters: [false],
                          },
                      },
                      options: [
                          {
                              displayName: 'Color',
                              name: 'color',
                              type: 'color',
                              default: '#ff0000',
                              description: 'The color you want the order on the left side to be, any value background-css supports',
                          },
                          {
                              displayName: 'Text',
                              name: 'text',
                              type: 'string',
                              default: '',
                              description: 'The text to display for this attachment, it is different than the message’s text',
                          },
                          {
                              displayName: 'Timestamp',
                              name: 'ts',
                              type: 'dateTime',
                              default: '',
                              description: 'Displays the time next to the text portion',
                          },
                          {
                              displayName: 'Thumb URL',
                              name: 'thumbUrl',
                              type: 'string',
                              default: '',
                              description: 'An image that displays to the left of the text, looks better when this is relatively small',
                          },
                          {
                              displayName: 'Message Link',
                              name: 'messageLink',
                              type: 'string',
                              default: '',
                              description: 'Only applicable if the timestamp is provided, as it makes the time clickable to this link',
                          },
                          {
                              displayName: 'Collapsed',
                              name: 'collapsed',
                              type: 'boolean',
                              default: false,
                              description: 'Causes the image, audio, and video sections to be hiding when collapsed is true',
                          },
                          {
                              displayName: 'Author Name',
                              name: 'authorName',
                              type: 'string',
                              default: '',
                              description: 'Name of the author',
                          },
                          {
                              displayName: 'Author Link',
                              name: 'authorLink',
                              type: 'string',
                              default: '',
                              description: 'Providing this makes the author name clickable and points to this link',
                          },
                          {
                              displayName: 'Author Icon',
                              name: 'authorIcon',
                              type: 'string',
                              default: '',
                              placeholder: 'https://site.com/img.png',
                              description: 'Displays a tiny icon to the left of the Author’s name',
                          },
                          {
                              displayName: 'Title',
                              name: 'title',
                              type: 'string',
                              default: '',
                              description: 'Title to display for this attachment, displays under the author',
                          },
                          {
                              displayName: 'Title Link',
                              name: 'titleLink',
                              type: 'string',
                              default: '',
                              description: 'Providing this makes the title clickable, pointing to this link',
                          },
                          {
                              displayName: 'Title Link Download',
                              name: 'titleLinkDownload',
                              type: 'boolean',
                              default: false,
                              description: 'When this is true, a download icon appears and clicking this saves the link to file',
                          },
                          {
                              displayName: 'Image URL',
                              name: 'imageUrl',
                              type: 'string',
                              default: '',
                              description: 'The image to display, will be “big” and easy to see',
                          },
                          {
                              displayName: 'Audio URL',
                              name: 'audioUrl',
                              type: 'string',
                              default: '',
                              placeholder: 'https://site.com/aud.mp3',
                              description: 'Audio file to play, only supports what html audio does',
                          },
                          {
                              displayName: 'Video URL',
                              name: 'videoUrl',
                              type: 'string',
                              default: '',
                              placeholder: 'https://site.com/vid.mp4',
                              description: 'Video file to play, only supports what html video does',
                          },
                          {
                              displayName: 'Fields',
                              name: 'fields',
                              type: 'fixedCollection',
                              placeholder: 'Add Field Item',
                              typeOptions: {
                                  multipleValues: true,
                              },
                              default: {},
                              options: [
                                  {
                                      name: 'fieldsValues',
                                      displayName: 'Fields',
                                      values: [
                                          {
                                              displayName: 'Short',
                                              name: 'short',
                                              type: 'boolean',
                                              default: false,
                                              description: 'Whether this field should be a short field',
                                          },
                                          {
                                              displayName: 'Title',
                                              name: 'title',
                                              type: 'string',
                                              default: '',
                                              description: 'The title of this field',
                                          },
                                          {
                                              displayName: 'Value',
                                              name: 'value',
                                              type: 'string',
                                              default: '',
                                              description: 'The value of this field, displayed underneath the title value',
                                          },
                                      ],
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Attachments',
                      name: 'attachmentsJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      displayOptions: {
                          show: {
                              resource: ['chat'],
                              operation: ['postMessage'],
                              jsonParameters: [true],
                          },
                      },
                      default: '',
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const length = items.length;
          let responseData;
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'chat') {
                      if (operation === 'postMessage') {
                          const channel = this.getNodeParameter('channel', i);
                          const text = this.getNodeParameter('text', i);
                          const options = this.getNodeParameter('options', i);
                          const jsonActive = this.getNodeParameter('jsonParameters', i);
                          const body = {
                              channel,
                              text,
                          };
                          if (options.alias) {
                              body.alias = options.alias;
                          }
                          if (options.avatar) {
                              body.avatar = options.avatar;
                          }
                          if (options.emoji) {
                              body.emoji = options.emoji;
                          }
                          if (!jsonActive) {
                              const optionsAttachments = this.getNodeParameter('attachments', i);
                              if (optionsAttachments.length > 0) {
                                  const attachments = [];
                                  for (let index = 0; index < optionsAttachments.length; index++) {
                                      const attachment = {};
                                      for (const option of Object.keys(optionsAttachments[index])) {
                                          if (option === 'color') {
                                              attachment.color = optionsAttachments[index][option];
                                          }
                                          else if (option === 'text') {
                                              attachment.text = optionsAttachments[index][option];
                                          }
                                          else if (option === 'ts') {
                                              attachment.ts = optionsAttachments[index][option];
                                          }
                                          else if (option === 'messageLinks') {
                                              attachment.message_link = optionsAttachments[index][option];
                                          }
                                          else if (option === 'thumbUrl') {
                                              attachment.thumb_url = optionsAttachments[index][option];
                                          }
                                          else if (option === 'collapsed') {
                                              attachment.collapsed = optionsAttachments[index][option];
                                          }
                                          else if (option === 'authorName') {
                                              attachment.author_name = optionsAttachments[index][option];
                                          }
                                          else if (option === 'authorLink') {
                                              attachment.author_link = optionsAttachments[index][option];
                                          }
                                          else if (option === 'authorIcon') {
                                              attachment.author_icon = optionsAttachments[index][option];
                                          }
                                          else if (option === 'title') {
                                              attachment.title = optionsAttachments[index][option];
                                          }
                                          else if (option === 'titleLink') {
                                              attachment.title_link = optionsAttachments[index][option];
                                          }
                                          else if (option === 'titleLinkDownload') {
                                              attachment.title_link_download = optionsAttachments[index][option];
                                          }
                                          else if (option === 'imageUrl') {
                                              attachment.image_url = optionsAttachments[index][option];
                                          }
                                          else if (option === 'audioUrl') {
                                              attachment.audio_url = optionsAttachments[index][option];
                                          }
                                          else if (option === 'videoUrl') {
                                              attachment.video_url = optionsAttachments[index][option];
                                          }
                                          else if (option === 'fields') {
                                              const fieldsValues = optionsAttachments[index][option]
                                                  .fieldsValues;
                                              if (fieldsValues.length > 0) {
                                                  const fields = [];
                                                  for (let j = 0; j < fieldsValues.length; j++) {
                                                      const field = {};
                                                      for (const key of Object.keys(fieldsValues[j])) {
                                                          if (key === 'short') {
                                                              field.short = fieldsValues[j][key];
                                                          }
                                                          else if (key === 'title') {
                                                              field.title = fieldsValues[j][key];
                                                          }
                                                          else if (key === 'value') {
                                                              field.value = fieldsValues[j][key];
                                                          }
                                                      }
                                                      fields.push(field);
                                                      attachment.fields = fields;
                                                  }
                                              }
                                          }
                                      }
                                      attachments.push(attachment);
                                  }
                                  body.attachments = attachments;
                              }
                          }
                          else {
                              body.attachments = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('attachmentsJson', i));
                          }
                          responseData = await GenericFunctions_1.rocketchatApiRequest.call(this, '/chat', 'POST', 'postMessage', body);
                      }
                  }
                  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;
              }
          }
          return [returnData];
      }
  }
  exports.Rocketchat = Rocketchat;
  //# sourceMappingURL=Rocketchat.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.RocketchatApi = void 0;
  class RocketchatApi {
      constructor() {
          this.name = 'rocketchatApi';
          this.displayName = 'Rocket API';
          this.documentationUrl = 'rocketchat';
          this.properties = [
              {
                  displayName: 'User ID',
                  name: 'userId',
                  type: 'string',
                  default: '',
              },
              {
                  displayName: 'Auth Key',
                  name: 'authKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
              {
                  displayName: 'Domain',
                  name: 'domain',
                  type: 'string',
                  default: '',
                  placeholder: 'https://n8n.rocket.chat',
              },
          ];
          this.authenticate = {
              type: 'generic',
              properties: {
                  headers: {
                      'X-Auth-Token': '={{$credentials.authKey}}',
                      'X-User-Id': '={{$credentials.userId}}',
                  },
              },
          };
          this.test = {
              request: {
                  baseURL: '={{$credentials.domain}}',
                  url: '/api/v1/webdav.getMyAccounts',
              },
          };
      }
  }
  exports.RocketchatApi = RocketchatApi;
  //# sourceMappingURL=RocketchatApi.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.RocketchatApi = void 0;
  class RocketchatApi {
      constructor() {
          this.name = 'rocketchatApi';
          this.displayName = 'Rocket API';
          this.documentationUrl = 'rocketchat';
          this.properties = [
              {
                  displayName: 'User ID',
                  name: 'userId',
                  type: 'string',
                  default: '',
              },
              {
                  displayName: 'Auth Key',
                  name: 'authKey',
                  type: 'string',
                  typeOptions: { password: true },
                  default: '',
              },
              {
                  displayName: 'Domain',
                  name: 'domain',
                  type: 'string',
                  default: '',
                  placeholder: 'https://n8n.rocket.chat',
              },
          ];
          this.authenticate = {
              type: 'generic',
              properties: {
                  headers: {
                      'X-Auth-Token': '={{$credentials.authKey}}',
                      'X-User-Id': '={{$credentials.userId}}',
                  },
              },
          };
          this.test = {
              request: {
                  baseURL: '={{$credentials.domain}}',
                  url: '/api/v1/webdav.getMyAccounts',
              },
          };
      }
  }
  exports.RocketchatApi = RocketchatApi;
  //# sourceMappingURL=RocketchatApi.credentials.js.map

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

  # Rocket.Chat node

  Use the Rocket.Chat node to automate work in Rocket.Chat, and integrate Rocket.Chat with other applications. n8n supports posting messages to channels, and sending direct messages, with Rocket.Chat. 

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

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

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

  ## Operations

  * Chat
      * Post a message to a channel or a direct message

  ## Templates and examples

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

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

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


node_type: n8n-nodes-base.Reddit
name: Reddit
display_name: Reddit
description: Consume the Reddit API
category: transform
icon: file:reddit.svg
code_hash: 14ac2bd275d17b8cf9b5ac74cb57392dbf4f15c37e180153e8f3be4a55aedd77
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.Reddit
documentation_title: Reddit node documentation
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"reddit","description":"Templates for reddit"}]
related_resources: []
required_scopes: []
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-09 15:18:31
updated_at: 2025-06-09 15:18:31
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Reddit = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const PostCommentDescription_1 = require("./PostCommentDescription");
  const PostDescription_1 = require("./PostDescription");
  const ProfileDescription_1 = require("./ProfileDescription");
  const SubredditDescription_1 = require("./SubredditDescription");
  const UserDescription_1 = require("./UserDescription");
  class Reddit {
      constructor() {
          this.description = {
              displayName: 'Reddit',
              name: 'reddit',
              icon: 'file:reddit.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the Reddit API',
              defaults: {
                  name: 'Reddit',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'redditOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['postComment', 'post', 'profile'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Post',
                              value: 'post',
                          },
                          {
                              name: 'Post Comment',
                              value: 'postComment',
                          },
                          {
                              name: 'Profile',
                              value: 'profile',
                          },
                          {
                              name: 'Subreddit',
                              value: 'subreddit',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                      ],
                      default: 'post',
                  },
                  ...PostCommentDescription_1.postCommentOperations,
                  ...PostCommentDescription_1.postCommentFields,
                  ...ProfileDescription_1.profileOperations,
                  ...ProfileDescription_1.profileFields,
                  ...SubredditDescription_1.subredditOperations,
                  ...SubredditDescription_1.subredditFields,
                  ...PostDescription_1.postOperations,
                  ...PostDescription_1.postFields,
                  ...UserDescription_1.userOperations,
                  ...UserDescription_1.userFields,
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          let responseData;
          const returnData = [];
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'post') {
                      if (operation === 'create') {
                          const qs = {
                              title: this.getNodeParameter('title', i),
                              sr: this.getNodeParameter('subreddit', i),
                              kind: this.getNodeParameter('kind', i),
                          };
                          qs.kind === 'self'
                              ? (qs.text = this.getNodeParameter('text', i))
                              : (qs.url = this.getNodeParameter('url', i));
                          if (qs.url) {
                              qs.resubmit = this.getNodeParameter('resubmit', i);
                          }
                          responseData = await GenericFunctions_1.redditApiRequest.call(this, 'POST', 'api/submit', qs);
                          responseData = responseData.json.data;
                      }
                      else if (operation === 'delete') {
                          const postTypePrefix = 't3_';
                          const qs = {
                              id: postTypePrefix + this.getNodeParameter('postId', i),
                          };
                          await GenericFunctions_1.redditApiRequest.call(this, 'POST', 'api/del', qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const subreddit = this.getNodeParameter('subreddit', i);
                          const postId = this.getNodeParameter('postId', i);
                          const endpoint = `r/${subreddit}/comments/${postId}.json`;
                          responseData = await GenericFunctions_1.redditApiRequest.call(this, 'GET', endpoint, {});
                          responseData = responseData[0].data.children[0].data;
                      }
                      else if (operation === 'getAll') {
                          const subreddit = this.getNodeParameter('subreddit', i);
                          let endpoint = `r/${subreddit}.json`;
                          const { category } = this.getNodeParameter('filters', i);
                          if (category) {
                              endpoint = `r/${subreddit}/${category}.json`;
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint);
                      }
                      else if (operation === 'search') {
                          const location = this.getNodeParameter('location', i);
                          const qs = {
                              q: this.getNodeParameter('keyword', i),
                              restrict_sr: location === 'subreddit',
                          };
                          const { sort } = this.getNodeParameter('additionalFields', i);
                          if (sort) {
                              qs.sort = sort;
                          }
                          let endpoint = '';
                          if (location === 'allReddit') {
                              endpoint = 'search.json';
                          }
                          else {
                              const subreddit = this.getNodeParameter('subreddit', i);
                              endpoint = `r/${subreddit}/search.json`;
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint, qs);
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', 0);
                              responseData = responseData.splice(0, limit);
                          }
                      }
                  }
                  else if (resource === 'postComment') {
                      if (operation === 'create') {
                          const postTypePrefix = 't3_';
                          const qs = {
                              text: this.getNodeParameter('commentText', i),
                              thing_id: postTypePrefix + this.getNodeParameter('postId', i),
                          };
                          responseData = await GenericFunctions_1.redditApiRequest.call(this, 'POST', 'api/comment', qs);
                          responseData = responseData.json.data.things[0].data;
                      }
                      else if (operation === 'getAll') {
                          const subreddit = this.getNodeParameter('subreddit', i);
                          const postId = this.getNodeParameter('postId', i);
                          const endpoint = `r/${subreddit}/comments/${postId}.json`;
                          responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint);
                      }
                      else if (operation === 'delete') {
                          const commentTypePrefix = 't1_';
                          const qs = {
                              id: commentTypePrefix + this.getNodeParameter('commentId', i),
                          };
                          await GenericFunctions_1.redditApiRequest.call(this, 'POST', 'api/del', qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'reply') {
                          const commentTypePrefix = 't1_';
                          const qs = {
                              text: this.getNodeParameter('replyText', i),
                              thing_id: commentTypePrefix + this.getNodeParameter('commentId', i),
                          };
                          responseData = await GenericFunctions_1.redditApiRequest.call(this, 'POST', 'api/comment', qs);
                          responseData = responseData.json.data.things[0].data;
                      }
                  }
                  else if (resource === 'profile') {
                      if (operation === 'get') {
                          const endpoints = {
                              identity: 'me',
                              blockedUsers: 'me/blocked',
                              friends: 'me/friends',
                              karma: 'me/karma',
                              prefs: 'me/prefs',
                              trophies: 'me/trophies',
                          };
                          const details = this.getNodeParameter('details', i);
                          const endpoint = `api/v1/${endpoints[details]}`;
                          let username;
                          if (details === 'saved') {
                              ({ name: username } = await GenericFunctions_1.redditApiRequest.call(this, 'GET', 'api/v1/me', {}));
                          }
                          responseData =
                              details === 'saved'
                                  ? await GenericFunctions_1.handleListing.call(this, i, `user/${username}/saved.json`)
                                  : await GenericFunctions_1.redditApiRequest.call(this, 'GET', endpoint, {});
                          if (details === 'identity') {
                              responseData = responseData.features;
                          }
                          else if (details === 'friends') {
                              responseData = responseData.data.children;
                              if (!responseData.length) {
                                  throw new n8n_workflow_1.NodeApiError(this.getNode(), responseData);
                              }
                          }
                          else if (details === 'karma') {
                              responseData = responseData.data;
                              if (!responseData.length) {
                                  throw new n8n_workflow_1.NodeApiError(this.getNode(), responseData);
                              }
                          }
                          else if (details === 'trophies') {
                              responseData = responseData.data.trophies.map((trophy) => trophy.data);
                          }
                      }
                  }
                  else if (resource === 'subreddit') {
                      if (operation === 'get') {
                          const subreddit = this.getNodeParameter('subreddit', i);
                          const content = this.getNodeParameter('content', i);
                          const endpoint = `r/${subreddit}/about/${content}.json`;
                          responseData = await GenericFunctions_1.redditApiRequest.call(this, 'GET', endpoint, {});
                          if (content === 'rules') {
                              responseData = responseData.rules;
                          }
                          else if (content === 'about') {
                              responseData = responseData.data;
                          }
                      }
                      else if (operation === 'getAll') {
                          const filters = this.getNodeParameter('filters', i);
                          if (filters.trending) {
                              const returnAll = this.getNodeParameter('returnAll', 0);
                              const endpoint = 'api/trending_subreddits.json';
                              responseData = await GenericFunctions_1.redditApiRequest.call(this, 'GET', endpoint, {});
                              responseData = responseData.subreddit_names.map((name) => ({ name }));
                              if (!returnAll) {
                                  const limit = this.getNodeParameter('limit', 0);
                                  responseData = responseData.splice(0, limit);
                              }
                          }
                          else if (filters.keyword) {
                              const qs = {};
                              qs.query = filters.keyword;
                              const endpoint = 'api/search_subreddits.json';
                              responseData = await GenericFunctions_1.redditApiRequest.call(this, 'POST', endpoint, qs);
                              const returnAll = this.getNodeParameter('returnAll', 0);
                              if (!returnAll) {
                                  const limit = this.getNodeParameter('limit', 0);
                                  responseData = responseData.subreddits.splice(0, limit);
                              }
                          }
                          else {
                              const endpoint = 'r/subreddits.json';
                              responseData = await GenericFunctions_1.handleListing.call(this, i, endpoint);
                          }
                      }
                  }
                  else if (resource === 'user') {
                      if (operation === 'get') {
                          const username = this.getNodeParameter('username', i);
                          const details = this.getNodeParameter('details', i);
                          const endpoint = `user/${username}/${details}.json`;
                          responseData =
                              details === 'about'
                                  ? await GenericFunctions_1.redditApiRequest.call(this, 'GET', endpoint, {})
                                  : await GenericFunctions_1.handleListing.call(this, i, endpoint);
                          if (details === 'about') {
                              responseData = responseData.data;
                          }
                      }
                  }
                  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.Reddit = Reddit;
  //# sourceMappingURL=Reddit.node.js.map

credential_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.RedditOAuth2Api = void 0;
  const scopes = ['identity', 'edit', 'history', 'mysubreddits', 'read', 'save', 'submit'];
  class RedditOAuth2Api {
      constructor() {
          this.name = 'redditOAuth2Api';
          this.extends = ['oAuth2Api'];
          this.displayName = 'Reddit OAuth2 API';
          this.documentationUrl = 'reddit';
          this.properties = [
              {
                  displayName: 'Grant Type',
                  name: 'grantType',
                  type: 'hidden',
                  default: 'authorizationCode',
              },
              {
                  displayName: 'Auth URI Query Parameters',
                  name: 'authQueryParameters',
                  type: 'hidden',
                  default: 'response_type=code',
              },
              {
                  displayName: 'Auth URI Query Parameters',
                  name: 'authQueryParameters',
                  type: 'hidden',
                  default: 'grant_type=authorization_code',
              },
              {
                  displayName: 'Auth URI Query Parameters',
                  name: 'authQueryParameters',
                  type: 'hidden',
                  default: 'duration=permanent',
              },
              {
                  displayName: 'Authorization URL',
                  name: 'authUrl',
                  type: 'hidden',
                  default: 'https://www.reddit.com/api/v1/authorize',
              },
              {
                  displayName: 'Access Token URL',
                  name: 'accessTokenUrl',
                  type: 'hidden',
                  default: 'https://www.reddit.com/api/v1/access_token',
              },
              {
                  displayName: 'Scope',
                  name: 'scope',
                  type: 'hidden',
                  default: scopes.join(' '),
              },
              {
                  displayName: 'Authentication',
                  name: 'authentication',
                  type: 'hidden',
                  default: 'header',
              },
          ];
      }
  }
  exports.RedditOAuth2Api = RedditOAuth2Api;
  //# sourceMappingURL=RedditOAuth2Api.credentials.js.map

  // --- Next Credential File ---

  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.RedditOAuth2Api = void 0;
  const scopes = ['identity', 'edit', 'history', 'mysubreddits', 'read', 'save', 'submit'];
  class RedditOAuth2Api {
      constructor() {
          this.name = 'redditOAuth2Api';
          this.extends = ['oAuth2Api'];
          this.displayName = 'Reddit OAuth2 API';
          this.documentationUrl = 'reddit';
          this.properties = [
              {
                  displayName: 'Grant Type',
                  name: 'grantType',
                  type: 'hidden',
                  default: 'authorizationCode',
              },
              {
                  displayName: 'Auth URI Query Parameters',
                  name: 'authQueryParameters',
                  type: 'hidden',
                  default: 'response_type=code',
              },
              {
                  displayName: 'Auth URI Query Parameters',
                  name: 'authQueryParameters',
                  type: 'hidden',
                  default: 'grant_type=authorization_code',
              },
              {
                  displayName: 'Auth URI Query Parameters',
                  name: 'authQueryParameters',
                  type: 'hidden',
                  default: 'duration=permanent',
              },
              {
                  displayName: 'Authorization URL',
                  name: 'authUrl',
                  type: 'hidden',
                  default: 'https://www.reddit.com/api/v1/authorize',
              },
              {
                  displayName: 'Access Token URL',
                  name: 'accessTokenUrl',
                  type: 'hidden',
                  default: 'https://www.reddit.com/api/v1/access_token',
              },
              {
                  displayName: 'Scope',
                  name: 'scope',
                  type: 'hidden',
                  default: scopes.join(' '),
              },
              {
                  displayName: 'Authentication',
                  name: 'authentication',
                  type: 'hidden',
                  default: 'header',
              },
          ];
      }
  }
  exports.RedditOAuth2Api = RedditOAuth2Api;
  //# sourceMappingURL=RedditOAuth2Api.credentials.js.map

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

  # Reddit node

  Use the Reddit node to automate work in Reddit, and integrate Reddit with other applications. n8n has built-in support for a wide range of Reddit features, including getting profiles, and users, retrieving post comments and subreddit, as well as submitting, getting, and deleting posts. 

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

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

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

  ## Operations

  * Post
      * Submit a post to a subreddit
      * Delete a post from a subreddit
      * Get a post from a subreddit
      * Get all posts from a subreddit
      * Search posts in a subreddit or in all of Reddit.
  * Post Comment
      * Create a top-level comment in a post
      * Retrieve all comments in a post
      * Remove a comment from a post
      * Write a reply to a comment in a post
  * Profile
      * Get
  * Subreddit
      * Retrieve background information about a subreddit.
      * Retrieve information about subreddits from all of Reddit.
  * User
      * Get

  ## Templates and examples

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

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

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


node_type: n8n-nodes-base.RssFeedRead
name: RssFeedRead
display_name: RSS Read
description: Reads data from an RSS Feed
category: input
icon: fa:rss
code_hash: 8fbc9da500347175bdd7371dfcc8ae68cb21a1fb3e39ded017aa4eff48724580
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.RssFeedRead
documentation_title: RSS Read
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"rss-read","description":"Templates for rss-read"}]
required_scopes: []
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-09 15:18:31
updated_at: 2025-06-09 15:18:31
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.RssFeedRead = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const rss_parser_1 = __importDefault(require("rss-parser"));
  const url_1 = require("url");
  const utilities_1 = require("../../utils/utilities");
  function validateURL(url) {
      try {
          new url_1.URL(url);
          return true;
      }
      catch (err) {
          return false;
      }
  }
  class RssFeedRead {
      constructor() {
          this.description = {
              displayName: 'RSS Read',
              name: 'rssFeedRead',
              icon: 'fa:rss',
              group: ['input'],
              version: 1,
              description: 'Reads data from an RSS Feed',
              defaults: {
                  name: 'RSS Read',
                  color: '#b02020',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'URL',
                      name: 'url',
                      type: 'string',
                      default: '',
                      required: true,
                      description: 'URL of the RSS feed',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      options: [
                          {
                              displayName: 'Ignore SSL Issues',
                              name: 'ignoreSSL',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to ignore SSL/TLS certificate issues or not',
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const pairedItem = (0, utilities_1.generatePairedItemData)(this.getInputData().length);
          try {
              const url = this.getNodeParameter('url', 0);
              const options = this.getNodeParameter('options', 0);
              const ignoreSSL = Boolean(options.ignoreSSL);
              if (!url) {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The parameter "URL" has to be set!');
              }
              if (!validateURL(url)) {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The provided "URL" is not valid!');
              }
              const parser = new rss_parser_1.default({
                  requestOptions: {
                      rejectUnauthorized: !ignoreSSL,
                  },
              });
              let feed;
              try {
                  feed = await parser.parseURL(url);
              }
              catch (error) {
                  if (error.code === 'ECONNREFUSED') {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), `It was not possible to connect to the URL. Please make sure the URL "${url}" it is valid!`);
                  }
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), error);
              }
              const returnData = [];
              if (feed.items) {
                  feed.items.forEach((item) => {
                      returnData.push({
                          json: item,
                          pairedItem,
                      });
                  });
              }
              return [returnData];
          }
          catch (error) {
              if (this.continueOnFail()) {
                  return [[{ json: { error: error.message }, pairedItem }]];
              }
              throw error;
          }
      }
  }
  exports.RssFeedRead = RssFeedRead;
  //# sourceMappingURL=RssFeedRead.node.js.map

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

  # RSS Read

  Use the RSS Read node to read data from RSS feeds published on the internet.

  ## Node parameters

  - **URL**: Enter the URL for the RSS publication you want to read.

  ## Node options

  * **Ignore SSL Issues**: Choose whether n8n should ignore SSL/TLS verification (turned on) or not (turned off).

  ## Templates and examples

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

  ## Related resources

  n8n provides a trigger node for RSS Read. You can find the trigger node docs [here](/integrations/builtin/core-nodes/n8n-nodes-base.rssfeedreadtrigger.md).

related_resources:
  [{"title":"here","url":"/integrations/builtin/core-nodes/n8n-nodes-base.rssfeedreadtrigger.md","type":"documentation"}]

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


node_type: n8n-nodes-base.RenameKeys
name: RenameKeys
display_name: Rename Keys
description: Renames keys
category: transform
icon: fa:edit
code_hash: 0708fae996ab278764a6b7528a635e8ce4b932769bffade386bf72d7d3ebeadd
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.RenameKeys
documentation_title: Rename Keys
operations: []
api_methods: []
documentation_examples: []
templates: [{"name":"rename-keys","description":"Templates for rename-keys"}]
related_resources: []
required_scopes: []
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-09 15:18:31
updated_at: 2025-06-09 15:18:31
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.RenameKeys = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const get_1 = __importDefault(require("lodash/get"));
  const set_1 = __importDefault(require("lodash/set"));
  const unset_1 = __importDefault(require("lodash/unset"));
  class RenameKeys {
      constructor() {
          this.description = {
              displayName: 'Rename Keys',
              name: 'renameKeys',
              icon: 'fa:edit',
              group: ['transform'],
              version: 1,
              description: 'Renames keys',
              defaults: {
                  name: 'Rename Keys',
                  color: '#772244',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'Keys',
                      name: 'keys',
                      placeholder: 'Add new key',
                      description: 'Adds a key which should be renamed',
                      type: 'fixedCollection',
                      typeOptions: {
                          multipleValues: true,
                          sortable: true,
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Key',
                              name: 'key',
                              values: [
                                  {
                                      displayName: 'Current Key Name',
                                      name: 'currentKey',
                                      type: 'string',
                                      default: '',
                                      placeholder: 'currentKey',
                                      requiresDataPath: 'single',
                                      description: 'The current name of the key. It is also possible to define deep keys by using dot-notation like for example: "level1.level2.currentKey".',
                                  },
                                  {
                                      displayName: 'New Key Name',
                                      name: 'newKey',
                                      type: 'string',
                                      default: '',
                                      placeholder: 'newKey',
                                      description: 'The name the key should be renamed to. It is also possible to define deep keys by using dot-notation like for example: "level1.level2.newKey".',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Additional Options',
                      name: 'additionalOptions',
                      type: 'collection',
                      default: {},
                      placeholder: 'Add Option',
                      options: [
                          {
                              displayName: 'Regex',
                              name: 'regexReplacement',
                              placeholder: 'Add new regular expression',
                              description: 'Adds a regular expressiond',
                              type: 'fixedCollection',
                              typeOptions: {
                                  multipleValues: true,
                                  sortable: true,
                              },
                              default: {},
                              options: [
                                  {
                                      displayName: 'Replacement',
                                      name: 'replacements',
                                      values: [
                                          {
                                              displayName: 'Be aware that by using regular expression previously renamed keys can be affected',
                                              name: 'regExNotice',
                                              type: 'notice',
                                              default: '',
                                          },
                                          {
                                              displayName: 'Regular Expression',
                                              name: 'searchRegex',
                                              type: 'string',
                                              default: '',
                                              placeholder: 'e.g. [N-n]ame',
                                              description: 'Regex to match the key name',
                                              hint: 'Learn more and test RegEx <a href="https://regex101.com/">here</a>',
                                          },
                                          {
                                              displayName: 'Replace With',
                                              name: 'replaceRegex',
                                              type: 'string',
                                              default: '',
                                              placeholder: 'replacedName',
                                              description: "The name the key/s should be renamed to. It's possible to use regex captures e.g. $1, $2, ...",
                                          },
                                          {
                                              displayName: 'Options',
                                              name: 'options',
                                              type: 'collection',
                                              default: {},
                                              placeholder: 'Add Regex Option',
                                              options: [
                                                  {
                                                      displayName: 'Case Insensitive',
                                                      name: 'caseInsensitive',
                                                      type: 'boolean',
                                                      description: 'Whether to use case insensitive match',
                                                      default: false,
                                                  },
                                                  {
                                                      displayName: 'Max Depth',
                                                      name: 'depth',
                                                      type: 'number',
                                                      default: -1,
                                                      description: 'Maximum depth to replace keys',
                                                      hint: 'Specify number for depth level (-1 for unlimited, 0 for top level only)',
                                                  },
                                              ],
                                          },
                                      ],
                                  },
                              ],
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          let item;
          let newItem;
          let renameKeys;
          let value;
          const renameKey = (key) => {
              if (key.currentKey === '' || key.newKey === '' || key.currentKey === key.newKey) {
                  return;
              }
              value = (0, get_1.default)(item.json, key.currentKey);
              if (value === undefined) {
                  return;
              }
              (0, set_1.default)(newItem.json, key.newKey, value);
              (0, unset_1.default)(newItem.json, key.currentKey);
          };
          const regexReplaceKey = (replacement) => {
              const { searchRegex, replaceRegex, options } = replacement;
              const { depth, caseInsensitive } = options;
              const flags = caseInsensitive ? 'i' : undefined;
              const regex = new RegExp(searchRegex, flags);
              const renameObjectKeys = (obj, objDepth) => {
                  for (const key in obj) {
                      if (Array.isArray(obj)) {
                          if (objDepth !== 0) {
                              renameObjectKeys(obj[key], objDepth - 1);
                          }
                      }
                      else if (obj.hasOwnProperty(key)) {
                          if (typeof obj[key] === 'object' && objDepth !== 0) {
                              renameObjectKeys(obj[key], objDepth - 1);
                          }
                          if (key.match(regex)) {
                              const newKey = key.replace(regex, replaceRegex);
                              if (newKey !== key) {
                                  obj[newKey] = obj[key];
                                  delete obj[key];
                              }
                          }
                      }
                  }
                  return obj;
              };
              newItem.json = renameObjectKeys(newItem.json, depth);
          };
          for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
              renameKeys = this.getNodeParameter('keys.key', itemIndex, []);
              const regexReplacements = this.getNodeParameter('additionalOptions.regexReplacement.replacements', itemIndex, []);
              item = items[itemIndex];
              newItem = {
                  json: (0, n8n_workflow_1.deepCopy)(item.json),
                  pairedItem: {
                      item: itemIndex,
                  },
              };
              if (item.binary !== undefined) {
                  newItem.binary = item.binary;
              }
              renameKeys.forEach(renameKey);
              regexReplacements.forEach(regexReplaceKey);
              returnData.push(newItem);
          }
          return [returnData];
      }
  }
  exports.RenameKeys = RenameKeys;
  //# sourceMappingURL=RenameKeys.node.js.map

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

  # Rename Keys

  Use the Rename Keys node to rename the keys of a key-value pair in n8n.

  ## Node parameters

  You can rename one or multiple keys using the Rename Keys node. Select the **Add new key** button to rename a key.

  For each key, enter the:

  - **Current Key Name**: The current name of the key you want to rename.
  - **New Key Name**: The new name you want to assign to the key.

  ## Node options

  Choose whether to use a **Regex** regular expression to identify keys to rename. To use this option, you must also enter:

  * The **Regular Expression** you'd like to use.
  * **Replace With**: Enter the new name you want to assign to the key(s) that match the **Regular Expression**.
  * You can also choose these Regex-specific options:
      * **Case Insensitive**: Set whether the regular expression should match case (turned off) or be case insensitive (turned on).
      * **Max Depth**: Enter the maximum depth to replace keys, using `-1` for unlimited and `0` for top-level only.

  /// warning | Regex impacts
  Using a regular expression can affect any keys that match the expression, including keys you've already renamed.
  ///

  ## Templates and examples

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

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


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: []
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-09 15:18:32
updated_at: 2025-06-09 15:18:32
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.

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


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: []
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-09 15:18:32
updated_at: 2025-06-09 15:18:32
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.

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


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: []
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-09 15:18:32
updated_at: 2025-06-09 15:18:32
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":{},"id":"z73hc9u8atpnqik526m4pr","name":"SecurityScorecard","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}


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: []
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-09 15:18:32
updated_at: 2025-06-09 15:18:32
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":{},"id":"7icr9kiozd4bcca1kxhl85","name":"Salesmate","type":"n8n-nodes-base.exampleNode","typeVersion":1,"position":[250,300]}],"connections":{},"active":false,"settings":{},"tags":["example","generated"]}


