# nodes

node_type: n8n-nodes-base.ExecutionData
name: ExecutionData
display_name: Execution Data
description: Add execution data for search
category: input
icon: fa:tasks
code_hash: 8d02375f5d0b6c49c900adcf415e46aead0c89e0033ccff2456c4ba5bb2ed769
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.executiondata
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:48
updated_at: 2025-06-08 09:17:48
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ExecutionData = void 0;
  class ExecutionData {
      constructor() {
          this.description = {
              displayName: 'Execution Data',
              name: 'executionData',
              icon: 'fa:tasks',
              group: ['input'],
              version: 1,
              description: 'Add execution data for search',
              defaults: {
                  name: 'Execution Data',
                  color: '#29A568',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: "Use this node to save fields you want to use later to easily find an execution (e.g. a user ID). You'll be able to search by this data in the 'executions' tab.<br>This feature is available on our Pro and Enterprise plans. <a href='https://n8n.io/pricing/' target='_blank'>More Info</a>.",
                      name: 'notice',
                      type: 'notice',
                      default: '',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      default: 'save',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Save Execution Data for Search',
                              value: 'save',
                              action: 'Save execution data for search',
                          },
                      ],
                  },
                  {
                      displayName: 'Data to Save',
                      name: 'dataToSave',
                      placeholder: 'Add Saved Field',
                      type: 'fixedCollection',
                      typeOptions: {
                          multipleValueButtonText: 'Add Saved Field',
                          multipleValues: true,
                      },
                      displayOptions: {
                          show: {
                              operation: ['save'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Values',
                              name: 'values',
                              values: [
                                  {
                                      displayName: 'Key',
                                      name: 'key',
                                      type: 'string',
                                      default: '',
                                      placeholder: 'e.g. myKey',
                                  },
                                  {
                                      displayName: 'Value',
                                      name: 'value',
                                      type: 'string',
                                      default: '',
                                      placeholder: 'e.g. myValue',
                                  },
                              ],
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const context = this.getWorkflowDataProxy(0);
          const items = this.getInputData();
          const operations = this.getNodeParameter('operation', 0);
          if (operations === 'save') {
              for (let i = 0; i < items.length; i++) {
                  const dataToSave = this.getNodeParameter('dataToSave', i, {}).values ||
                      [];
                  const values = dataToSave.reduce((acc, { key, value }) => {
                      acc[key] = value;
                      return acc;
                  }, {});
                  context.$execution.customData.setAll(values);
              }
          }
          return [items];
      }
  }
  exports.ExecutionData = ExecutionData;
  //# sourceMappingURL=ExecutionData.node.js.map

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

  # Execution Data

  Use this node to save metadata for workflow executions. You can then search by this data in the **Executions** list.

  You can retrieve custom execution data during workflow execution using the Code node. Refer to [Custom executions data](/workflows/executions/custom-executions-data.md) for more information.

  /// info | Feature availability
  Available on Pro and Enterprise plans.
  ///

  ## Operations

  * Save Execution Data for Search

  ## Data to Save

  Add a **Saved Field** for each key/value pair of metadata you'd like to save.

  ## Limitations

  The Execution Data node has the following restrictions when storing execution metadata:

  * `key`: limited to 50 characters
  * `value`: limited to 512 characters

  If either the `key` or `value` exceed the above limitations, n8n truncates to their maximum length and outputs a log entry.

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"7fd7c9a1-607a-4b98-a59e-a390a7dc67ba","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"409b1d289fc5900c441cc2e6916fe4ee4809fe6358c78bc561cb12a39d178731"}}


node_type: n8n-nodes-base.Flow
name: Flow
display_name: Flow
description: Consume Flow API
category: output
icon: file:flow.png
code_hash: 13e12903da5094fffdebbe6511f4f7eb7f1f7fad727f27793a64b523a553783e
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.executeworkflowtrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:48
updated_at: 2025-06-08 09:17:48
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Flow = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const TaskDescription_1 = require("./TaskDescription");
  class Flow {
      constructor() {
          this.description = {
              displayName: 'Flow',
              name: 'flow',
              icon: 'file:flow.png',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Flow API',
              defaults: {
                  name: 'Flow',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'flowApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Task',
                              value: 'task',
                              description: 'Tasks are units of work that can be private or assigned to a list. Through this endpoint, you can manipulate your tasks in Flow, including creating new ones.',
                          },
                      ],
                      default: 'task',
                  },
                  ...TaskDescription_1.taskOperations,
                  ...TaskDescription_1.taskFields,
              ],
          };
      }
      async execute() {
          const credentials = await this.getCredentials('flowApi');
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const qs = {};
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              if (resource === 'task') {
                  if (operation === 'create') {
                      const workspaceId = this.getNodeParameter('workspaceId', i);
                      const name = this.getNodeParameter('name', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          organization_id: credentials.organizationId,
                      };
                      const task = {
                          name,
                          workspace_id: parseInt(workspaceId, 10),
                      };
                      if (additionalFields.ownerId) {
                          task.owner_id = parseInt(additionalFields.ownerId, 10);
                      }
                      if (additionalFields.listId) {
                          task.list_id = parseInt(additionalFields.listId, 10);
                      }
                      if (additionalFields.startsOn) {
                          task.starts_on = additionalFields.startsOn;
                      }
                      if (additionalFields.dueOn) {
                          task.due_on = additionalFields.dueOn;
                      }
                      if (additionalFields.mirrorParentSubscribers) {
                          task.mirror_parent_subscribers = additionalFields.mirrorParentSubscribers;
                      }
                      if (additionalFields.mirrorParentTags) {
                          task.mirror_parent_tags = additionalFields.mirrorParentTags;
                      }
                      if (additionalFields.noteContent) {
                          task.note_content = additionalFields.noteContent;
                      }
                      if (additionalFields.noteMimeType) {
                          task.note_mime_type = additionalFields.noteMimeType;
                      }
                      if (additionalFields.parentId) {
                          task.parent_id = parseInt(additionalFields.parentId, 10);
                      }
                      if (additionalFields.positionList) {
                          task.position_list = additionalFields.positionList;
                      }
                      if (additionalFields.positionUpcoming) {
                          task.position_upcoming = additionalFields.positionUpcoming;
                      }
                      if (additionalFields.position) {
                          task.position = additionalFields.position;
                      }
                      if (additionalFields.sectionId) {
                          task.section_id = additionalFields.sectionId;
                      }
                      if (additionalFields.tags) {
                          task.tags = additionalFields.tags.split(',');
                      }
                      body.task = task;
                      try {
                          responseData = await GenericFunctions_1.flowApiRequest.call(this, 'POST', '/tasks', body);
                          responseData = responseData.task;
                      }
                      catch (error) {
                          throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                      }
                  }
                  if (operation === 'update') {
                      const workspaceId = this.getNodeParameter('workspaceId', i);
                      const taskId = this.getNodeParameter('taskId', i);
                      const updateFields = this.getNodeParameter('updateFields', i);
                      const body = {
                          organization_id: credentials.organizationId,
                      };
                      const task = {
                          workspace_id: parseInt(workspaceId, 10),
                          id: parseInt(taskId, 10),
                      };
                      if (updateFields.name) {
                          task.name = updateFields.name;
                      }
                      if (updateFields.ownerId) {
                          task.owner_id = parseInt(updateFields.ownerId, 10);
                      }
                      if (updateFields.listId) {
                          task.list_id = parseInt(updateFields.listId, 10);
                      }
                      if (updateFields.startsOn) {
                          task.starts_on = updateFields.startsOn;
                      }
                      if (updateFields.dueOn) {
                          task.due_on = updateFields.dueOn;
                      }
                      if (updateFields.mirrorParentSubscribers) {
                          task.mirror_parent_subscribers = updateFields.mirrorParentSubscribers;
                      }
                      if (updateFields.mirrorParentTags) {
                          task.mirror_parent_tags = updateFields.mirrorParentTags;
                      }
                      if (updateFields.noteContent) {
                          task.note_content = updateFields.noteContent;
                      }
                      if (updateFields.noteMimeType) {
                          task.note_mime_type = updateFields.noteMimeType;
                      }
                      if (updateFields.parentId) {
                          task.parent_id = parseInt(updateFields.parentId, 10);
                      }
                      if (updateFields.positionList) {
                          task.position_list = updateFields.positionList;
                      }
                      if (updateFields.positionUpcoming) {
                          task.position_upcoming = updateFields.positionUpcoming;
                      }
                      if (updateFields.position) {
                          task.position = updateFields.position;
                      }
                      if (updateFields.sectionId) {
                          task.section_id = updateFields.sectionId;
                      }
                      if (updateFields.tags) {
                          task.tags = updateFields.tags.split(',');
                      }
                      if (updateFields.completed) {
                          task.completed = updateFields.completed;
                      }
                      body.task = task;
                      try {
                          responseData = await GenericFunctions_1.flowApiRequest.call(this, 'PUT', `/tasks/${taskId}`, body);
                          responseData = responseData.task;
                      }
                      catch (error) {
                          throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                      }
                  }
                  if (operation === 'get') {
                      const taskId = this.getNodeParameter('taskId', i);
                      const filters = this.getNodeParameter('filters', i);
                      qs.organization_id = credentials.organizationId;
                      if (filters.include) {
                          qs.include = filters.include.join(',');
                      }
                      try {
                          responseData = await GenericFunctions_1.flowApiRequest.call(this, 'GET', `/tasks/${taskId}`, {}, qs);
                      }
                      catch (error) {
                          throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                      }
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const filters = this.getNodeParameter('filters', i);
                      qs.organization_id = credentials.organizationId;
                      if (filters.include) {
                          qs.include = filters.include.join(',');
                      }
                      if (filters.order) {
                          qs.order = filters.order;
                      }
                      if (filters.workspaceId) {
                          qs.workspace_id = filters.workspaceId;
                      }
                      if (filters.createdBefore) {
                          qs.created_before = filters.createdBefore;
                      }
                      if (filters.createdAfter) {
                          qs.created_after = filters.createdAfter;
                      }
                      if (filters.updateBefore) {
                          qs.updated_before = filters.updateBefore;
                      }
                      if (filters.updateAfter) {
                          qs.updated_after = filters.updateAfter;
                      }
                      if (filters.deleted) {
                          qs.deleted = filters.deleted;
                      }
                      if (filters.cleared) {
                          qs.cleared = filters.cleared;
                      }
                      try {
                          if (returnAll) {
                              responseData = await GenericFunctions_1.FlowApiRequestAllItems.call(this, 'tasks', 'GET', '/tasks', {}, qs);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.flowApiRequest.call(this, 'GET', '/tasks', {}, qs);
                              responseData = responseData.tasks;
                          }
                      }
                      catch (error) {
                          throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { itemIndex: i });
                      }
                  }
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.Flow = Flow;
  //# sourceMappingURL=Flow.node.js.map

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

  # Execute Sub-workflow Trigger node

  Use this node to start a workflow in response to another workflow. It should be the first node in the workflow.

  n8n allows you to call workflows from other workflows. This is useful if you want to:

  * Reuse a workflow: for example, you could have multiple workflows pulling and processing data from different sources, then have all those workflows call a single workflow that generates a report.
  * Break large workflows into smaller components.

  ## Usage

  This node runs in response to a call from the [Execute Sub-workflow](/integrations/builtin/core-nodes/n8n-nodes-base.executeworkflow.md) or [Call n8n Workflow Tool](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolworkflow.md) nodes.

  --8<-- "_snippets/flow-logic/subworkflow-usage.md"

  ## Templates and examples

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

  ## How data passes between workflows

  --8<-- "_snippets/flow-logic/subworkflow-data-flow.md"

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"1924ada5-e949-4607-ac9e-256f3c65cac5","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"b2de8f694f41973057b4de6f006c08222eec75e20853211bfb323e84c8ebd39d"}}


node_type: n8n-nodes-base.Filter
name: Filter
display_name: Filter
description: Filter out incoming items based on given conditions
category: transform
icon: fa:filter
code_hash: 324befe1651cf4734fd44ebfdf5945e1d61541c5a1bab2eb2d2ba218e3b66ff2
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.filter
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:48
updated_at: 2025-06-08 09:17:48
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Filter = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  class Filter {
      constructor() {
          this.description = {
              displayName: 'Filter',
              name: 'filter',
              icon: 'fa:filter',
              group: ['transform'],
              version: 1,
              description: 'Filter out incoming items based on given conditions',
              defaults: {
                  name: 'Filter',
                  color: '#229eff',
              },
              inputs: ['main'],
              outputs: ['main'],
              outputNames: ['Kept', 'Discarded'],
              properties: [
                  {
                      displayName: 'Conditions',
                      name: 'conditions',
                      placeholder: 'Add Condition',
                      type: 'fixedCollection',
                      typeOptions: {
                          multipleValues: true,
                          sortable: true,
                      },
                      description: 'The type of values to compare',
                      default: {},
                      options: [
                          {
                              name: 'boolean',
                              displayName: 'Boolean',
                              values: [
                                  {
                                      displayName: 'Value 1',
                                      name: 'value1',
                                      type: 'boolean',
                                      default: false,
                                      description: 'The value to compare with the second one',
                                  },
                                  {
                                      displayName: 'Operation',
                                      name: 'operation',
                                      type: 'options',
                                      options: [
                                          {
                                              name: 'Equal',
                                              value: 'equal',
                                          },
                                          {
                                              name: 'Not Equal',
                                              value: 'notEqual',
                                          },
                                      ],
                                      default: 'equal',
                                      description: 'Operation to decide where the the data should be mapped to',
                                  },
                                  {
                                      displayName: 'Value 2',
                                      name: 'value2',
                                      type: 'boolean',
                                      default: false,
                                      description: 'The value to compare with the first one',
                                  },
                              ],
                          },
                          {
                              name: 'dateTime',
                              displayName: 'Date & Time',
                              values: [
                                  {
                                      displayName: 'Value 1',
                                      name: 'value1',
                                      type: 'dateTime',
                                      default: '',
                                      description: 'The value to compare with the second one',
                                  },
                                  {
                                      displayName: 'Operation',
                                      name: 'operation',
                                      type: 'options',
                                      options: [
                                          {
                                              name: 'Occurred After',
                                              value: 'after',
                                          },
                                          {
                                              name: 'Occurred Before',
                                              value: 'before',
                                          },
                                      ],
                                      default: 'after',
                                      description: 'Operation to decide where the the data should be mapped to',
                                  },
                                  {
                                      displayName: 'Value 2',
                                      name: 'value2',
                                      type: 'dateTime',
                                      default: '',
                                      description: 'The value to compare with the first one',
                                  },
                              ],
                          },
                          {
                              name: 'number',
                              displayName: 'Number',
                              values: [
                                  {
                                      displayName: 'Value 1',
                                      name: 'value1',
                                      type: 'number',
                                      default: 0,
                                      description: 'The value to compare with the second one',
                                  },
                                  {
                                      displayName: 'Operation',
                                      name: 'operation',
                                      type: 'options',
                                      noDataExpression: true,
                                      options: [
                                          {
                                              name: 'Smaller',
                                              value: 'smaller',
                                          },
                                          {
                                              name: 'Smaller or Equal',
                                              value: 'smallerEqual',
                                          },
                                          {
                                              name: 'Equal',
                                              value: 'equal',
                                          },
                                          {
                                              name: 'Not Equal',
                                              value: 'notEqual',
                                          },
                                          {
                                              name: 'Larger',
                                              value: 'larger',
                                          },
                                          {
                                              name: 'Larger or Equal',
                                              value: 'largerEqual',
                                          },
                                          {
                                              name: 'Is Empty',
                                              value: 'isEmpty',
                                          },
                                          {
                                              name: 'Is Not Empty',
                                              value: 'isNotEmpty',
                                          },
                                      ],
                                      default: 'smaller',
                                      description: 'Operation to decide where the the data should be mapped to',
                                  },
                                  {
                                      displayName: 'Value 2',
                                      name: 'value2',
                                      type: 'number',
                                      displayOptions: {
                                          hide: {
                                              operation: ['isEmpty', 'isNotEmpty'],
                                          },
                                      },
                                      default: 0,
                                      description: 'The value to compare with the first one',
                                  },
                              ],
                          },
                          {
                              name: 'string',
                              displayName: 'String',
                              values: [
                                  {
                                      displayName: 'Value 1',
                                      name: 'value1',
                                      type: 'string',
                                      default: '',
                                      description: 'The value to compare with the second one',
                                  },
                                  {
                                      displayName: 'Operation',
                                      name: 'operation',
                                      type: 'options',
                                      noDataExpression: true,
                                      options: [
                                          {
                                              name: 'Contains',
                                              value: 'contains',
                                          },
                                          {
                                              name: 'Not Contains',
                                              value: 'notContains',
                                          },
                                          {
                                              name: 'Ends With',
                                              value: 'endsWith',
                                          },
                                          {
                                              name: 'Not Ends With',
                                              value: 'notEndsWith',
                                          },
                                          {
                                              name: 'Equal',
                                              value: 'equal',
                                          },
                                          {
                                              name: 'Not Equal',
                                              value: 'notEqual',
                                          },
                                          {
                                              name: 'Regex Match',
                                              value: 'regex',
                                          },
                                          {
                                              name: 'Regex Not Match',
                                              value: 'notRegex',
                                          },
                                          {
                                              name: 'Starts With',
                                              value: 'startsWith',
                                          },
                                          {
                                              name: 'Not Starts With',
                                              value: 'notStartsWith',
                                          },
                                          {
                                              name: 'Is Empty',
                                              value: 'isEmpty',
                                          },
                                          {
                                              name: 'Is Not Empty',
                                              value: 'isNotEmpty',
                                          },
                                      ],
                                      default: 'equal',
                                      description: 'Operation to decide where the the data should be mapped to',
                                  },
                                  {
                                      displayName: 'Value 2',
                                      name: 'value2',
                                      type: 'string',
                                      displayOptions: {
                                          hide: {
                                              operation: ['isEmpty', 'isNotEmpty', 'regex', 'notRegex'],
                                          },
                                      },
                                      default: '',
                                      description: 'The value to compare with the first one',
                                  },
                                  {
                                      displayName: 'Regex',
                                      name: 'value2',
                                      type: 'string',
                                      displayOptions: {
                                          show: {
                                              operation: ['regex', 'notRegex'],
                                          },
                                      },
                                      default: '',
                                      placeholder: '/text/i',
                                      description: 'The regex which has to match',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Combine Conditions',
                      name: 'combineConditions',
                      type: 'options',
                      options: [
                          {
                              name: 'AND',
                              description: 'Items are passed to the next node only if they meet all the conditions',
                              value: 'AND',
                          },
                          {
                              name: 'OR',
                              description: 'Items are passed to the next node if they meet at least one condition',
                              value: 'OR',
                          },
                      ],
                      default: 'AND',
                      description: 'How to combine the conditions: AND requires all conditions to be true, OR requires at least one condition to be true',
                  },
              ],
          };
      }
      async execute() {
          const returnDataTrue = [];
          const returnDataFalse = [];
          const items = this.getInputData();
          const dataTypes = ['boolean', 'dateTime', 'number', 'string'];
          itemLoop: for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
              const item = items[itemIndex];
              const combineConditions = this.getNodeParameter('combineConditions', itemIndex);
              for (const dataType of dataTypes) {
                  const typeConditions = this.getNodeParameter(`conditions.${dataType}`, itemIndex, []);
                  for (const condition of typeConditions) {
                      let value1 = condition.value1;
                      let value2 = condition.value2;
                      if (dataType === 'dateTime') {
                          const node = this.getNode();
                          value1 = (0, GenericFunctions_1.convertDateTime)(node, value1);
                          value2 = (0, GenericFunctions_1.convertDateTime)(node, value2);
                      }
                      const compareResult = GenericFunctions_1.compareOperationFunctions[condition.operation](value1, value2);
                      if (item.pairedItem === undefined) {
                          item.pairedItem = [{ item: itemIndex }];
                      }
                      if (compareResult && combineConditions === 'OR') {
                          returnDataTrue.push(item);
                          continue itemLoop;
                      }
                      if (!compareResult && combineConditions === 'AND') {
                          returnDataFalse.push(item);
                          continue itemLoop;
                      }
                  }
              }
              if (combineConditions === 'AND') {
                  returnDataTrue.push(item);
              }
              else {
                  returnDataFalse.push(item);
              }
          }
          return [returnDataTrue, returnDataFalse];
      }
  }
  exports.Filter = Filter;
  //# sourceMappingURL=Filter.node.js.map

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

  # Filter

  Filter items based on a condition. If the item meets the condition, the Filter node passes it on to the next node in the Filter node output. If the item doesn't meet the condition, the Filter node omits the item from its output.

  ## Node parameters

  Create filter comparison **Conditions** to perform your filter.

  - Use the data type dropdown to select the data type and comparison operation type for your condition. For example, to filter for dates after a particular date, select **Date & Time > is after**.
  - The fields and values to enter into the condition change based on the data type and comparison you select. Refer to [Available data type comparisons](#available-data-type-comparisons) for a full list of all comparisons by data type.

  Select **Add condition** to create more conditions.

  ### Combining conditions

  You can choose to keep items:

  * When they meet all conditions: Create two or more conditions and select **AND** in the dropdown between them.
  * When they meet any of the conditions: Create two or more conditions and select **OR** in the dropdown between them.

  You can't create a mix of AND and OR rules.

  ## Node options

  - **Ignore Case**: Whether to ignore letter case (turned on) or be case sensitive (turned off).
  - **Less Strict Type Validation**: Whether you want n8n to attempt to convert value types based on the operator you choose (turned on) or not (turned off). Turn this on when facing a "wrong type:" error in your node.

  ## Templates and examples

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

  --8<-- "_snippets/integrations/builtin/core-nodes/data-types.md"

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"b91b137e-2228-4abf-8d1c-ce74b486d043","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"d06264a9e4a2e8b6cb04c690f18cac115ba7c99c41ce64ea97c3007e67e38aaf"}}


node_type: n8n-nodes-base.FunctionItem
name: FunctionItem
display_name: Function Item
description: Run custom function code which gets executed once per item
category: transform
icon: fa:code
code_hash: e5ce3a8474ce7c5363fafd8d914cdcb00613f5c8d7b7e78ba676a1298080ed20
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:50
updated_at: 2025-06-08 09:17:50
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.FunctionItem = void 0;
  const vm2_1 = require("@n8n/vm2");
  const n8n_workflow_1 = require("n8n-workflow");
  const JavaScriptSandbox_1 = require("../Code/JavaScriptSandbox");
  class FunctionItem {
      constructor() {
          this.description = {
              displayName: 'Function Item',
              name: 'functionItem',
              hidden: true,
              icon: 'fa:code',
              group: ['transform'],
              version: 1,
              description: 'Run custom function code which gets executed once per item',
              defaults: {
                  name: 'Function Item',
                  color: '#ddbb33',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'A newer version of this node type is available, called the ‘Code’ node',
                      name: 'notice',
                      type: 'notice',
                      default: '',
                  },
                  {
                      displayName: 'JavaScript Code',
                      name: 'functionCode',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                          codeAutocomplete: 'functionItem',
                          editor: 'code',
                          rows: 10,
                      },
                      type: 'string',
                      default: `// Code here will run once per input item.
  // More info and help: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.functionitem/
  // Tip: You can use luxon for dates and $jmespath for querying JSON structures

  // Add a new field called 'myNewField' to the JSON of the item
  item.myNewField = 1;

  // You can write logs to the browser console
  console.log('Done!');

  return item;`,
                      description: 'The JavaScript code to execute for each item',
                      noDataExpression: true,
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let item;
          const cleanupData = (inputData) => {
              Object.keys(inputData).map((key) => {
                  if (inputData[key] !== null && typeof inputData[key] === 'object') {
                      if (inputData[key].constructor.name === 'Object') {
                          inputData[key] = cleanupData(inputData[key]);
                      }
                      else {
                          inputData[key] = (0, n8n_workflow_1.deepCopy)(inputData[key]);
                      }
                  }
              });
              return inputData;
          };
          for (let itemIndex = 0; itemIndex < length; itemIndex++) {
              const mode = this.getMode();
              try {
                  item = items[itemIndex];
                  item.index = itemIndex;
                  item = (0, n8n_workflow_1.deepCopy)(item);
                  const sandbox = {
                      getBinaryData: () => {
                          if (mode === 'manual') {
                              this.sendMessageToUI('getBinaryData(...) is deprecated and will be removed in a future version. Please consider switching to getBinaryDataAsync(...) instead.');
                          }
                          return item.binary;
                      },
                      setBinaryData: async (data) => {
                          if (mode === 'manual') {
                              this.sendMessageToUI('setBinaryData(...) is deprecated and will be removed in a future version. Please consider switching to setBinaryDataAsync(...) instead.');
                          }
                          item.binary = data;
                      },
                      getNodeParameter: this.getNodeParameter,
                      getWorkflowStaticData: this.getWorkflowStaticData,
                      helpers: this.helpers,
                      item: item.json,
                      getBinaryDataAsync: async () => {
                          var _a;
                          if ((item === null || item === void 0 ? void 0 : item.binary) && (item === null || item === void 0 ? void 0 : item.index) !== undefined && (item === null || item === void 0 ? void 0 : item.index) !== null) {
                              for (const binaryPropertyName of Object.keys(item.binary)) {
                                  item.binary[binaryPropertyName].data = (_a = (await this.helpers.getBinaryDataBuffer(item.index, binaryPropertyName))) === null || _a === void 0 ? void 0 : _a.toString('base64');
                              }
                          }
                          return item.binary;
                      },
                      setBinaryDataAsync: async (data) => {
                          if (!data) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No data was provided to setBinaryDataAsync (data: IBinaryKeyData).');
                          }
                          for (const binaryPropertyName of Object.keys(data)) {
                              const binaryItem = data[binaryPropertyName];
                              data[binaryPropertyName] = await this.helpers.setBinaryDataBuffer(binaryItem, Buffer.from(binaryItem.data, 'base64'));
                          }
                          item.binary = data;
                      },
                  };
                  const dataProxy = this.getWorkflowDataProxy(itemIndex);
                  Object.assign(sandbox, dataProxy);
                  const options = {
                      console: mode === 'manual' ? 'redirect' : 'inherit',
                      sandbox,
                      require: JavaScriptSandbox_1.vmResolver,
                  };
                  const vm = new vm2_1.NodeVM(options);
                  if (mode === 'manual') {
                      vm.on('console.log', this.sendMessageToUI);
                  }
                  const functionCode = this.getNodeParameter('functionCode', itemIndex);
                  let jsonData;
                  try {
                      jsonData = await vm.run(`module.exports = async function() {${functionCode}\n}()`, __dirname);
                  }
                  catch (error) {
                      if (this.continueOnFail()) {
                          returnData.push({ json: { error: error.message } });
                          continue;
                      }
                      else {
                          const stackLines = error.stack.split('\n');
                          if (stackLines.length > 0) {
                              stackLines.shift();
                              const lineParts = stackLines
                                  .find((line) => line.includes('FunctionItem'))
                                  .split(':');
                              if (lineParts.length > 2) {
                                  const lineNumber = lineParts.splice(-2, 1);
                                  if (!isNaN(lineNumber)) {
                                      error.message = `${error.message} [Line ${lineNumber} | Item Index: ${itemIndex}]`;
                                      throw error;
                                  }
                              }
                          }
                          error.message = `${error.message} [Item Index: ${itemIndex}]`;
                          throw error;
                      }
                  }
                  if (jsonData === undefined) {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No data got returned. Always an object has to be returned!');
                  }
                  const returnItem = {
                      json: cleanupData(jsonData),
                      pairedItem: {
                          item: itemIndex,
                      },
                  };
                  if (item.binary) {
                      returnItem.binary = item.binary;
                  }
                  returnData.push(returnItem);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({
                          json: {
                              error: error.message,
                          },
                          pairedItem: {
                              item: itemIndex,
                          },
                      });
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.FunctionItem = FunctionItem;
  //# sourceMappingURL=FunctionItem.node.js.map

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"bce4bed7-856f-4086-82aa-ce6b2bcfb2f7","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"08705423f24949da9adf6b49a0a18e5d37bb354d7d7a46e690776792fad89e93"}}


node_type: n8n-nodes-base.Ftp
name: Ftp
display_name: FTP
description: Transfers files via FTP or SFTP
category: input
icon: fa:server
code_hash: 48e8e0ee75c7e8ba39f526f5a690b1bcc679c5852a93609ddd264fd68ced6e92
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:50
updated_at: 2025-06-08 09:17:50
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.Ftp = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const utilities_1 = require("../../utils/utilities");
  const fs_1 = require("fs");
  const path_1 = require("path");
  const stream_1 = require("stream");
  const util_1 = require("util");
  const tmp_promise_1 = require("tmp-promise");
  const promise_ftp_1 = __importDefault(require("promise-ftp"));
  const ssh2_sftp_client_1 = __importDefault(require("ssh2-sftp-client"));
  const streamPipeline = (0, util_1.promisify)(stream_1.pipeline);
  async function callRecursiveList(path, client, normalizeFunction) {
      const pathArray = [path];
      let currentPath = path;
      const directoryItems = [];
      let index = 0;
      const prepareAndNormalize = (item) => {
          if (pathArray[index].endsWith('/')) {
              currentPath = `${pathArray[index]}${item.name}`;
          }
          else {
              currentPath = `${pathArray[index]}/${item.name}`;
          }
          if (item.type === 'd') {
              if (item.name === '.' || item.name === '..') {
                  return;
              }
              pathArray.push(currentPath);
          }
          normalizeFunction(item, currentPath, true);
          directoryItems.push(item);
      };
      do {
          const returnData = await client.list(pathArray[index]);
          returnData.map(prepareAndNormalize);
          index++;
      } while (index <= pathArray.length - 1);
      return directoryItems;
  }
  async function recursivelyCreateSftpDirs(sftp, path) {
      const dirPath = (0, path_1.dirname)(path);
      const dirExists = await sftp.exists(dirPath);
      if (!dirExists) {
          await sftp.mkdir(dirPath, true);
      }
  }
  function normalizeSFtpItem(input, path, recursive = false) {
      const item = input;
      item.accessTime = new Date(input.accessTime);
      item.modifyTime = new Date(input.modifyTime);
      item.path = !recursive ? `${path}${path.endsWith('/') ? '' : '/'}${item.name}` : path;
  }
  function normalizeFtpItem(input, path, recursive = false) {
      const item = input;
      item.modifyTime = input.date;
      item.path = !recursive ? `${path}${path.endsWith('/') ? '' : '/'}${item.name}` : path;
      item.date = undefined;
  }
  class Ftp {
      constructor() {
          this.description = {
              displayName: 'FTP',
              name: 'ftp',
              icon: 'fa:server',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["protocol"] + ": " + $parameter["operation"]}}',
              description: 'Transfers files via FTP or SFTP',
              defaults: {
                  name: 'FTP',
                  color: '#303050',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'ftp',
                      required: true,
                      displayOptions: {
                          show: {
                              protocol: ['ftp'],
                          },
                      },
                      testedBy: 'ftpConnectionTest',
                  },
                  {
                      name: 'sftp',
                      required: true,
                      displayOptions: {
                          show: {
                              protocol: ['sftp'],
                          },
                      },
                      testedBy: 'sftpConnectionTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Protocol',
                      name: 'protocol',
                      type: 'options',
                      options: [
                          {
                              name: 'FTP',
                              value: 'ftp',
                          },
                          {
                              name: 'SFTP',
                              value: 'sftp',
                          },
                      ],
                      default: 'ftp',
                      description: 'File transfer protocol',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      options: [
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete a file/folder',
                              action: 'Delete a file or folder',
                          },
                          {
                              name: 'Download',
                              value: 'download',
                              description: 'Download a file',
                              action: 'Download a file',
                          },
                          {
                              name: 'List',
                              value: 'list',
                              description: 'List folder content',
                              action: 'List folder content',
                          },
                          {
                              name: 'Rename',
                              value: 'rename',
                              description: 'Rename/move oldPath to newPath',
                              action: 'Rename / move a file or folder',
                          },
                          {
                              name: 'Upload',
                              value: 'upload',
                              description: 'Upload a file',
                              action: 'Upload a file',
                          },
                      ],
                      default: 'download',
                      noDataExpression: true,
                  },
                  {
                      displayName: 'Path',
                      displayOptions: {
                          show: {
                              operation: ['delete'],
                          },
                      },
                      name: 'path',
                      type: 'string',
                      default: '',
                      description: 'The file path of the file to delete. Has to contain the full path.',
                      required: true,
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      displayOptions: {
                          show: {
                              operation: ['delete'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Folder',
                              name: 'folder',
                              type: 'boolean',
                              default: false,
                              description: 'Whether folders can be deleted',
                          },
                          {
                              displayName: 'Recursive',
                              displayOptions: {
                                  show: {
                                      folder: [true],
                                  },
                              },
                              name: 'recursive',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to remove all files and directories in target directory',
                          },
                      ],
                  },
                  {
                      displayName: 'Path',
                      displayOptions: {
                          show: {
                              operation: ['download'],
                          },
                      },
                      name: 'path',
                      type: 'string',
                      default: '',
                      placeholder: '/documents/invoice.txt',
                      description: 'The file path of the file to download. Has to contain the full path.',
                      required: true,
                  },
                  {
                      displayName: 'Binary Property',
                      displayOptions: {
                          show: {
                              operation: ['download'],
                          },
                      },
                      name: 'binaryPropertyName',
                      type: 'string',
                      default: 'data',
                      description: 'Object property name which holds binary data',
                      required: true,
                  },
                  {
                      displayName: 'Old Path',
                      displayOptions: {
                          show: {
                              operation: ['rename'],
                          },
                      },
                      name: 'oldPath',
                      type: 'string',
                      default: '',
                      required: true,
                  },
                  {
                      displayName: 'New Path',
                      displayOptions: {
                          show: {
                              operation: ['rename'],
                          },
                      },
                      name: 'newPath',
                      type: 'string',
                      default: '',
                      required: true,
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['rename'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Create Directories',
                              name: 'createDirectories',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to recursively create destination directory when renaming an existing file or folder',
                          },
                      ],
                  },
                  {
                      displayName: 'Path',
                      displayOptions: {
                          show: {
                              operation: ['upload'],
                          },
                      },
                      name: 'path',
                      type: 'string',
                      default: '',
                      description: 'The file path of the file to upload. Has to contain the full path.',
                      required: true,
                  },
                  {
                      displayName: 'Binary Data',
                      displayOptions: {
                          show: {
                              operation: ['upload'],
                          },
                      },
                      name: 'binaryData',
                      type: 'boolean',
                      default: true,
                      description: 'The text content of the file to upload',
                  },
                  {
                      displayName: 'Binary Property',
                      displayOptions: {
                          show: {
                              operation: ['upload'],
                              binaryData: [true],
                          },
                      },
                      name: 'binaryPropertyName',
                      type: 'string',
                      default: 'data',
                      description: 'Object property name which holds binary data',
                      required: true,
                  },
                  {
                      displayName: 'File Content',
                      displayOptions: {
                          show: {
                              operation: ['upload'],
                              binaryData: [false],
                          },
                      },
                      name: 'fileContent',
                      type: 'string',
                      default: '',
                      description: 'The text content of the file to upload',
                  },
                  {
                      displayName: 'Path',
                      displayOptions: {
                          show: {
                              operation: ['list'],
                          },
                      },
                      name: 'path',
                      type: 'string',
                      default: '/',
                      description: 'Path of directory to list contents of',
                      required: true,
                  },
                  {
                      displayName: 'Recursive',
                      displayOptions: {
                          show: {
                              operation: ['list'],
                          },
                      },
                      name: 'recursive',
                      type: 'boolean',
                      default: false,
                      description: 'Whether to return object representing all directories / objects recursively found within SFTP server',
                      required: true,
                  },
              ],
          };
          this.methods = {
              credentialTest: {
                  async ftpConnectionTest(credential) {
                      const credentials = credential.data;
                      try {
                          const ftp = new promise_ftp_1.default();
                          await ftp.connect({
                              host: credentials.host,
                              port: credentials.port,
                              user: credentials.username,
                              password: credentials.password,
                          });
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                      return {
                          status: 'OK',
                          message: 'Connection successful!',
                      };
                  },
                  async sftpConnectionTest(credential) {
                      const credentials = credential.data;
                      try {
                          const sftp = new ssh2_sftp_client_1.default();
                          if (credentials.privateKey) {
                              await sftp.connect({
                                  host: credentials.host,
                                  port: credentials.port,
                                  username: credentials.username,
                                  privateKey: (0, utilities_1.formatPrivateKey)(credentials.privateKey),
                                  passphrase: credentials.passphrase,
                              });
                          }
                          else {
                              await sftp.connect({
                                  host: credentials.host,
                                  port: credentials.port,
                                  username: credentials.username,
                                  password: credentials.password,
                              });
                          }
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                      return {
                          status: 'OK',
                          message: 'Connection successful!',
                      };
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnItems = [];
          let responseData;
          const operation = this.getNodeParameter('operation', 0);
          let credentials = undefined;
          const protocol = this.getNodeParameter('protocol', 0);
          if (protocol === 'sftp') {
              credentials = await this.getCredentials('sftp');
          }
          else {
              credentials = await this.getCredentials('ftp');
          }
          try {
              let ftp;
              let sftp;
              if (protocol === 'sftp') {
                  sftp = new ssh2_sftp_client_1.default();
                  if (credentials.privateKey) {
                      await sftp.connect({
                          host: credentials.host,
                          port: credentials.port,
                          username: credentials.username,
                          privateKey: (0, utilities_1.formatPrivateKey)(credentials.privateKey),
                          passphrase: credentials.passphrase,
                      });
                  }
                  else {
                      await sftp.connect({
                          host: credentials.host,
                          port: credentials.port,
                          username: credentials.username,
                          password: credentials.password,
                      });
                  }
              }
              else {
                  ftp = new promise_ftp_1.default();
                  await ftp.connect({
                      host: credentials.host,
                      port: credentials.port,
                      user: credentials.username,
                      password: credentials.password,
                  });
              }
              for (let i = 0; i < items.length; i++) {
                  const newItem = {
                      json: items[i].json,
                      binary: {},
                  };
                  if (items[i].binary !== undefined && newItem.binary) {
                      Object.assign(newItem.binary, items[i].binary);
                  }
                  items[i] = newItem;
                  if (protocol === 'sftp') {
                      if (operation === 'list') {
                          const path = this.getNodeParameter('path', i);
                          const recursive = this.getNodeParameter('recursive', i);
                          if (recursive) {
                              responseData = await callRecursiveList(path, sftp, normalizeSFtpItem);
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                              returnItems.push.apply(returnItems, executionData);
                          }
                          else {
                              responseData = await sftp.list(path);
                              responseData.forEach((item) => normalizeSFtpItem(item, path));
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                              returnItems.push.apply(returnItems, executionData);
                          }
                      }
                      if (operation === 'delete') {
                          const path = this.getNodeParameter('path', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.folder === true) {
                              responseData = await sftp.rmdir(path, !!options.recursive);
                          }
                          else {
                              responseData = await sftp.delete(path);
                          }
                          const executionData = this.helpers.constructExecutionMetaData([{ json: { success: true } }], { itemData: { item: i } });
                          returnItems.push(...executionData);
                      }
                      if (operation === 'rename') {
                          const oldPath = this.getNodeParameter('oldPath', i);
                          const { createDirectories = false } = this.getNodeParameter('options', i);
                          const newPath = this.getNodeParameter('newPath', i);
                          if (createDirectories) {
                              await recursivelyCreateSftpDirs(sftp, newPath);
                          }
                          responseData = await sftp.rename(oldPath, newPath);
                          const executionData = this.helpers.constructExecutionMetaData([{ json: { success: true } }], { itemData: { item: i } });
                          returnItems.push(...executionData);
                      }
                      if (operation === 'download') {
                          const path = this.getNodeParameter('path', i);
                          const binaryFile = await (0, tmp_promise_1.file)({ prefix: 'n8n-sftp-' });
                          try {
                              await sftp.get(path, (0, fs_1.createWriteStream)(binaryFile.path));
                              const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
                              const remoteFilePath = this.getNodeParameter('path', i);
                              items[i].binary[dataPropertyNameDownload] = await this.nodeHelpers.copyBinaryFile(binaryFile.path, (0, path_1.basename)(remoteFilePath));
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(items[i]), { itemData: { item: i } });
                              returnItems.push(...executionData);
                          }
                          finally {
                              await binaryFile.cleanup();
                          }
                      }
                      if (operation === 'upload') {
                          const remotePath = this.getNodeParameter('path', i);
                          await recursivelyCreateSftpDirs(sftp, remotePath);
                          if (this.getNodeParameter('binaryData', i)) {
                              const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                              const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                              let uploadData;
                              if (binaryData.id) {
                                  uploadData = await this.helpers.getBinaryStream(binaryData.id);
                              }
                              else {
                                  uploadData = Buffer.from(binaryData.data, n8n_workflow_1.BINARY_ENCODING);
                              }
                              await sftp.put(uploadData, remotePath);
                          }
                          else {
                              const buffer = Buffer.from(this.getNodeParameter('fileContent', i), 'utf8');
                              await sftp.put(buffer, remotePath);
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(items[i]), { itemData: { item: i } });
                          returnItems.push(...executionData);
                      }
                  }
                  if (protocol === 'ftp') {
                      if (operation === 'list') {
                          const path = this.getNodeParameter('path', i);
                          const recursive = this.getNodeParameter('recursive', i);
                          if (recursive) {
                              responseData = await callRecursiveList(path, ftp, normalizeFtpItem);
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                              returnItems.push.apply(returnItems, executionData);
                          }
                          else {
                              responseData = await ftp.list(path);
                              responseData.forEach((item) => normalizeFtpItem(item, path));
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                              returnItems.push.apply(returnItems, executionData);
                          }
                      }
                      if (operation === 'delete') {
                          const path = this.getNodeParameter('path', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.folder === true) {
                              responseData = await ftp.rmdir(path, !!options.recursive);
                          }
                          else {
                              responseData = await ftp.delete(path);
                          }
                          const executionData = this.helpers.constructExecutionMetaData([{ json: { success: true } }], { itemData: { item: i } });
                          returnItems.push(...executionData);
                      }
                      if (operation === 'download') {
                          const path = this.getNodeParameter('path', i);
                          const binaryFile = await (0, tmp_promise_1.file)({ prefix: 'n8n-sftp-' });
                          try {
                              const stream = await ftp.get(path);
                              await streamPipeline(stream, (0, fs_1.createWriteStream)(binaryFile.path));
                              const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
                              const remoteFilePath = this.getNodeParameter('path', i);
                              items[i].binary[dataPropertyNameDownload] = await this.nodeHelpers.copyBinaryFile(binaryFile.path, (0, path_1.basename)(remoteFilePath));
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(items[i]), { itemData: { item: i } });
                              returnItems.push(...executionData);
                          }
                          finally {
                              await binaryFile.cleanup();
                          }
                      }
                      if (operation === 'rename') {
                          const oldPath = this.getNodeParameter('oldPath', i);
                          const newPath = this.getNodeParameter('newPath', i);
                          responseData = await ftp.rename(oldPath, newPath);
                          const executionData = this.helpers.constructExecutionMetaData([{ json: { success: true } }], { itemData: { item: i } });
                          returnItems.push(...executionData);
                      }
                      if (operation === 'upload') {
                          const remotePath = this.getNodeParameter('path', i);
                          const fileName = (0, path_1.basename)(remotePath);
                          const dirPath = remotePath.replace(fileName, '');
                          if (this.getNodeParameter('binaryData', i)) {
                              const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                              const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                              let uploadData;
                              if (binaryData.id) {
                                  uploadData = await this.helpers.getBinaryStream(binaryData.id);
                              }
                              else {
                                  uploadData = Buffer.from(binaryData.data, n8n_workflow_1.BINARY_ENCODING);
                              }
                              try {
                                  await ftp.put(uploadData, remotePath);
                              }
                              catch (error) {
                                  if (error.code === 553) {
                                      await ftp.mkdir(dirPath, true);
                                      await ftp.put(uploadData, remotePath);
                                  }
                                  else {
                                      throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                                  }
                              }
                          }
                          else {
                              const buffer = Buffer.from(this.getNodeParameter('fileContent', i), 'utf8');
                              try {
                                  await ftp.put(buffer, remotePath);
                              }
                              catch (error) {
                                  if (error.code === 553) {
                                      await ftp.mkdir(dirPath, true);
                                      await ftp.put(buffer, remotePath);
                                  }
                                  else {
                                      throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                                  }
                              }
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(items[i]), { itemData: { item: i } });
                          returnItems.push(...executionData);
                      }
                  }
              }
              if (protocol === 'sftp') {
                  await sftp.end();
              }
              else {
                  await ftp.end();
              }
          }
          catch (error) {
              if (this.continueOnFail()) {
                  return [[{ json: { error: error.message } }]];
              }
              throw error;
          }
          return [returnItems];
      }
  }
  exports.Ftp = Ftp;
  //# sourceMappingURL=Ftp.node.js.map

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"4dc7a7c5-e341-4c86-b94e-28bb61790455","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"ba701c385896eed45b1d7c636d732bd90407f3de1cf2fd78dcf331f3ab03d3d1"}}


node_type: n8n-nodes-base.FreshworksCrm
name: FreshworksCrm
display_name: Freshworks CRM
description: Consume the Freshworks CRM API
category: transform
icon: file:freshworksCrm.svg
code_hash: 28020dd98482da8bc65443cb9e65f8e0220e24752f7c39100edb1a6b69a0ea47
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.freshworkscrm
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:50
updated_at: 2025-06-08 09:17:50
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.FreshworksCrm = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const descriptions_1 = require("./descriptions");
  const moment_timezone_1 = require("moment-timezone");
  class FreshworksCrm {
      constructor() {
          this.description = {
              displayName: 'Freshworks CRM',
              name: 'freshworksCrm',
              icon: 'file:freshworksCrm.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the Freshworks CRM API',
              defaults: {
                  name: 'Freshworks CRM',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'freshworksCrmApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Account',
                              value: 'account',
                          },
                          {
                              name: 'Appointment',
                              value: 'appointment',
                          },
                          {
                              name: 'Contact',
                              value: 'contact',
                          },
                          {
                              name: 'Deal',
                              value: 'deal',
                          },
                          {
                              name: 'Note',
                              value: 'note',
                          },
                          {
                              name: 'Sales Activity',
                              value: 'salesActivity',
                          },
                          {
                              name: 'Search',
                              value: 'search',
                          },
                          {
                              name: 'Task',
                              value: 'task',
                          },
                      ],
                      default: 'account',
                  },
                  ...descriptions_1.accountOperations,
                  ...descriptions_1.accountFields,
                  ...descriptions_1.appointmentOperations,
                  ...descriptions_1.appointmentFields,
                  ...descriptions_1.contactOperations,
                  ...descriptions_1.contactFields,
                  ...descriptions_1.dealOperations,
                  ...descriptions_1.dealFields,
                  ...descriptions_1.noteOperations,
                  ...descriptions_1.noteFields,
                  ...descriptions_1.salesActivityOperations,
                  ...descriptions_1.salesActivityFields,
                  ...descriptions_1.searchOperations,
                  ...descriptions_1.searchFields,
                  ...descriptions_1.taskOperations,
                  ...descriptions_1.taskFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getAccounts() {
                      const viewId = await GenericFunctions_1.getAllItemsViewId.call(this, { fromLoadOptions: true });
                      const responseData = await GenericFunctions_1.handleListing.call(this, 'GET', `/sales_accounts/view/${viewId}`);
                      return responseData.map(({ name, id }) => ({ name, value: id }));
                  },
                  async getAccountViews() {
                      const responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/sales_accounts/filters');
                      return responseData.map(({ name, id }) => ({ name, value: id }));
                  },
                  async getBusinessTypes() {
                      return GenericFunctions_1.loadResource.call(this, 'business_types');
                  },
                  async getCampaigns() {
                      return GenericFunctions_1.loadResource.call(this, 'campaigns');
                  },
                  async getContactStatuses() {
                      return GenericFunctions_1.loadResource.call(this, 'contact_statuses');
                  },
                  async getContactViews() {
                      const responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/contacts/filters');
                      return responseData.map(({ name, id }) => ({ name, value: id }));
                  },
                  async getCurrencies() {
                      const response = (await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'GET', '/selector/currencies'));
                      const key = Object.keys(response)[0];
                      return response[key].map(({ currency_code, id }) => ({ name: currency_code, value: id }));
                  },
                  async getDealPaymentStatuses() {
                      return GenericFunctions_1.loadResource.call(this, 'deal_payment_statuses');
                  },
                  async getDealPipelines() {
                      return GenericFunctions_1.loadResource.call(this, 'deal_pipelines');
                  },
                  async getDealProducts() {
                      return GenericFunctions_1.loadResource.call(this, 'deal_products');
                  },
                  async getDealReasons() {
                      return GenericFunctions_1.loadResource.call(this, 'deal_reasons');
                  },
                  async getDealStages() {
                      return GenericFunctions_1.loadResource.call(this, 'deal_stages');
                  },
                  async getDealTypes() {
                      return GenericFunctions_1.loadResource.call(this, 'deal_types');
                  },
                  async getDealViews() {
                      const responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/deals/filters');
                      return responseData.map(({ name, id }) => ({ name, value: id }));
                  },
                  async getIndustryTypes() {
                      return GenericFunctions_1.loadResource.call(this, 'industry_types');
                  },
                  async getLifecycleStages() {
                      return GenericFunctions_1.loadResource.call(this, 'lifecycle_stages');
                  },
                  async getOutcomes() {
                      return GenericFunctions_1.loadResource.call(this, 'sales_activity_outcomes');
                  },
                  async getSalesActivityTypes() {
                      return GenericFunctions_1.loadResource.call(this, 'sales_activity_types');
                  },
                  async getTerritories() {
                      return GenericFunctions_1.loadResource.call(this, 'territories');
                  },
                  async getUsers() {
                      const response = (await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'GET', '/selector/owners'));
                      const key = Object.keys(response)[0];
                      return response[key].map(({ display_name, id }) => ({ name: display_name, value: id }));
                  },
              },
          };
      }
      async execute() {
          var _a, _b;
          const items = this.getInputData();
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          const defaultTimezone = this.getTimezone();
          let responseData;
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'account') {
                      if (operation === 'create') {
                          const body = {
                              name: this.getNodeParameter('name', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'POST', '/sales_accounts', body);
                          responseData = responseData.sales_account;
                      }
                      else if (operation === 'delete') {
                          const accountId = this.getNodeParameter('accountId', i);
                          const endpoint = `/sales_accounts/${accountId}`;
                          await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'DELETE', endpoint);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const accountId = this.getNodeParameter('accountId', i);
                          const endpoint = `/sales_accounts/${accountId}`;
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'GET', endpoint);
                          responseData = responseData.sales_account;
                      }
                      else if (operation === 'getAll') {
                          const view = this.getNodeParameter('view', i);
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', `/sales_accounts/view/${view}`);
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if (Object.keys(updateFields).length) {
                              Object.assign(body, updateFields);
                          }
                          else {
                              GenericFunctions_1.throwOnEmptyUpdate.call(this, resource);
                          }
                          const accountId = this.getNodeParameter('accountId', i);
                          const endpoint = `/sales_accounts/${accountId}`;
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'PUT', endpoint, body);
                          responseData = responseData.sales_account;
                      }
                  }
                  else if (resource === 'appointment') {
                      if (operation === 'create') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const startDate = this.getNodeParameter('fromDate', i);
                          const endDate = this.getNodeParameter('endDate', i);
                          const attendees = this.getNodeParameter('attendees.attendee', i, []);
                          const timezone = (_a = additionalFields.time_zone) !== null && _a !== void 0 ? _a : defaultTimezone;
                          let allDay = false;
                          if (additionalFields.is_allday) {
                              allDay = additionalFields.is_allday;
                          }
                          const start = (0, moment_timezone_1.tz)(startDate, timezone);
                          const end = (0, moment_timezone_1.tz)(endDate, timezone);
                          const body = {
                              title: this.getNodeParameter('title', i),
                              from_date: start.format(),
                              end_date: allDay ? start.format() : end.format(),
                          };
                          Object.assign(body, additionalFields);
                          if (attendees.length) {
                              body.appointment_attendees_attributes = (0, GenericFunctions_1.adjustAttendees)(attendees);
                          }
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'POST', '/appointments', body);
                          responseData = responseData.appointment;
                      }
                      else if (operation === 'delete') {
                          const appointmentId = this.getNodeParameter('appointmentId', i);
                          const endpoint = `/appointments/${appointmentId}`;
                          await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'DELETE', endpoint);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const appointmentId = this.getNodeParameter('appointmentId', i);
                          const endpoint = `/appointments/${appointmentId}`;
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'GET', endpoint);
                          responseData = responseData.appointment;
                      }
                      else if (operation === 'getAll') {
                          const { filter, include } = this.getNodeParameter('filters', i);
                          const qs = {};
                          if (filter) {
                              qs.filter = filter;
                          }
                          if (include) {
                              qs.include = include;
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/appointments', {}, qs);
                      }
                      else if (operation === 'update') {
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const attendees = this.getNodeParameter('updateFields.attendees.attendee', i, []);
                          if (!Object.keys(updateFields).length) {
                              GenericFunctions_1.throwOnEmptyUpdate.call(this, resource);
                          }
                          const body = {};
                          const { from_date, end_date, ...rest } = updateFields;
                          const timezone = (_b = rest.time_zone) !== null && _b !== void 0 ? _b : defaultTimezone;
                          if (from_date) {
                              body.from_date = (0, moment_timezone_1.tz)(from_date, timezone).format();
                          }
                          if (end_date) {
                              body.end_date = (0, moment_timezone_1.tz)(end_date, timezone).format();
                          }
                          Object.assign(body, rest);
                          if (attendees.length) {
                              body.appointment_attendees_attributes = (0, GenericFunctions_1.adjustAttendees)(attendees);
                              delete body.attendees;
                          }
                          const appointmentId = this.getNodeParameter('appointmentId', i);
                          const endpoint = `/appointments/${appointmentId}`;
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'PUT', endpoint, body);
                          responseData = responseData.appointment;
                      }
                  }
                  else if (resource === 'contact') {
                      if (operation === 'create') {
                          const body = {
                              first_name: this.getNodeParameter('firstName', i),
                              last_name: this.getNodeParameter('lastName', i),
                              emails: this.getNodeParameter('emails', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, (0, GenericFunctions_1.adjustAccounts)(additionalFields));
                          }
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'POST', '/contacts', body);
                          responseData = responseData.contact;
                      }
                      else if (operation === 'delete') {
                          const contactId = this.getNodeParameter('contactId', i);
                          const endpoint = `/contacts/${contactId}`;
                          await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'DELETE', endpoint);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const contactId = this.getNodeParameter('contactId', i);
                          const endpoint = `/contacts/${contactId}`;
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'GET', endpoint);
                          responseData = responseData.contact;
                      }
                      else if (operation === 'getAll') {
                          const view = this.getNodeParameter('view', i);
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', `/contacts/view/${view}`);
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if (Object.keys(updateFields).length) {
                              Object.assign(body, (0, GenericFunctions_1.adjustAccounts)(updateFields));
                          }
                          else {
                              GenericFunctions_1.throwOnEmptyUpdate.call(this, resource);
                          }
                          const contactId = this.getNodeParameter('contactId', i);
                          const endpoint = `/contacts/${contactId}`;
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'PUT', endpoint, body);
                          responseData = responseData.contact;
                      }
                  }
                  else if (resource === 'deal') {
                      if (operation === 'create') {
                          const body = {
                              name: this.getNodeParameter('name', i),
                              amount: this.getNodeParameter('amount', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, (0, GenericFunctions_1.adjustAccounts)(additionalFields));
                          }
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'POST', '/deals', body);
                          responseData = responseData.deal;
                      }
                      else if (operation === 'delete') {
                          const dealId = this.getNodeParameter('dealId', i);
                          await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'DELETE', `/deals/${dealId}`);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const dealId = this.getNodeParameter('dealId', i);
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'GET', `/deals/${dealId}`);
                          responseData = responseData.deal;
                      }
                      else if (operation === 'getAll') {
                          const view = this.getNodeParameter('view', i);
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', `/deals/view/${view}`);
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if (Object.keys(updateFields).length) {
                              Object.assign(body, (0, GenericFunctions_1.adjustAccounts)(updateFields));
                          }
                          else {
                              GenericFunctions_1.throwOnEmptyUpdate.call(this, resource);
                          }
                          const dealId = this.getNodeParameter('dealId', i);
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'PUT', `/deals/${dealId}`, body);
                          responseData = responseData.deal;
                      }
                  }
                  else if (resource === 'note') {
                      if (operation === 'create') {
                          const body = {
                              description: this.getNodeParameter('description', i),
                              targetable_id: this.getNodeParameter('targetable_id', i),
                              targetable_type: this.getNodeParameter('targetableType', i),
                          };
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'POST', '/notes', body);
                          responseData = responseData.note;
                      }
                      else if (operation === 'delete') {
                          const noteId = this.getNodeParameter('noteId', i);
                          await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'DELETE', `/notes/${noteId}`);
                          responseData = { success: true };
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if (Object.keys(updateFields).length) {
                              Object.assign(body, updateFields);
                          }
                          else {
                              GenericFunctions_1.throwOnEmptyUpdate.call(this, resource);
                          }
                          const noteId = this.getNodeParameter('noteId', i);
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'PUT', `/notes/${noteId}`, body);
                          responseData = responseData.note;
                      }
                  }
                  else if (resource === 'salesActivity') {
                      if (operation === 'create') {
                          const startDate = this.getNodeParameter('from_date', i);
                          const endDate = this.getNodeParameter('end_date', i);
                          const body = {
                              sales_activity_type_id: this.getNodeParameter('sales_activity_type_id', i),
                              title: this.getNodeParameter('title', i),
                              owner_id: this.getNodeParameter('ownerId', i),
                              start_date: (0, moment_timezone_1.tz)(startDate, defaultTimezone).format(),
                              end_date: (0, moment_timezone_1.tz)(endDate, defaultTimezone).format(),
                              targetable_type: this.getNodeParameter('targetableType', i),
                              targetable_id: this.getNodeParameter('targetable_id', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'POST', '/sales_activities', {
                              sales_activity: body,
                          });
                          responseData = responseData.sales_activity;
                      }
                      else if (operation === 'delete') {
                          const salesActivityId = this.getNodeParameter('salesActivityId', i);
                          const endpoint = `/sales_activities/${salesActivityId}`;
                          await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'DELETE', endpoint);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const salesActivityId = this.getNodeParameter('salesActivityId', i);
                          const endpoint = `/sales_activities/${salesActivityId}`;
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'GET', endpoint);
                          responseData = responseData.sales_activity;
                      }
                      else if (operation === 'getAll') {
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/sales_activities');
                      }
                      else if (operation === 'update') {
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if (!Object.keys(updateFields).length) {
                              GenericFunctions_1.throwOnEmptyUpdate.call(this, resource);
                          }
                          const body = {};
                          const { from_date, end_date, ...rest } = updateFields;
                          if (from_date) {
                              body.from_date = (0, moment_timezone_1.tz)(from_date, defaultTimezone).format();
                          }
                          if (end_date) {
                              body.end_date = (0, moment_timezone_1.tz)(end_date, defaultTimezone).format();
                          }
                          if (Object.keys(rest).length) {
                              Object.assign(body, rest);
                          }
                          const salesActivityId = this.getNodeParameter('salesActivityId', i);
                          const endpoint = `/sales_activities/${salesActivityId}`;
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'PUT', endpoint, body);
                          responseData = responseData.sales_activity;
                      }
                  }
                  else if (resource === 'search') {
                      if (operation === 'query') {
                          const query = this.getNodeParameter('query', i);
                          let entities = this.getNodeParameter('entities', i);
                          const returnAll = this.getNodeParameter('returnAll', 0, false);
                          if (Array.isArray(entities)) {
                              entities = entities.join(',');
                          }
                          const qs = {
                              q: query,
                              include: entities,
                              per_page: 100,
                          };
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'GET', '/search', {}, qs);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', 0);
                              responseData = responseData.slice(0, limit);
                          }
                      }
                      if (operation === 'lookup') {
                          let searchField = this.getNodeParameter('searchField', i);
                          let fieldValue = this.getNodeParameter('fieldValue', i, '');
                          let entities = this.getNodeParameter('options.entities', i);
                          if (Array.isArray(entities)) {
                              entities = entities.join(',');
                          }
                          if (searchField === 'customField') {
                              searchField = this.getNodeParameter('customFieldName', i);
                              fieldValue = this.getNodeParameter('customFieldValue', i);
                          }
                          const qs = {
                              q: fieldValue,
                              f: searchField,
                              entities,
                          };
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'GET', '/lookup', {}, qs);
                      }
                  }
                  else if (resource === 'task') {
                      if (operation === 'create') {
                          const dueDate = this.getNodeParameter('dueDate', i);
                          const body = {
                              title: this.getNodeParameter('title', i),
                              owner_id: this.getNodeParameter('ownerId', i),
                              due_date: (0, moment_timezone_1.tz)(dueDate, defaultTimezone).format(),
                              targetable_type: this.getNodeParameter('targetableType', i),
                              targetable_id: this.getNodeParameter('targetable_id', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'POST', '/tasks', body);
                          responseData = responseData.task;
                      }
                      else if (operation === 'delete') {
                          const taskId = this.getNodeParameter('taskId', i);
                          await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'DELETE', `/tasks/${taskId}`);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const taskId = this.getNodeParameter('taskId', i);
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'GET', `/tasks/${taskId}`);
                          responseData = responseData.task;
                      }
                      else if (operation === 'getAll') {
                          const { filter, include } = this.getNodeParameter('filters', i);
                          const qs = {
                              filter: 'open',
                          };
                          if (filter) {
                              qs.filter = filter;
                          }
                          if (include) {
                              qs.include = include;
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/tasks', {}, qs);
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if (!Object.keys(updateFields).length) {
                              GenericFunctions_1.throwOnEmptyUpdate.call(this, resource);
                          }
                          const { dueDate, ...rest } = updateFields;
                          if (dueDate) {
                              body.due_date = (0, moment_timezone_1.tz)(dueDate, defaultTimezone).format();
                          }
                          if (Object.keys(rest).length) {
                              Object.assign(body, rest);
                          }
                          const taskId = this.getNodeParameter('taskId', i);
                          responseData = await GenericFunctions_1.freshworksCrmApiRequest.call(this, 'PUT', `/tasks/${taskId}`, body);
                          responseData = responseData.task;
                      }
                  }
              }
              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;
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.FreshworksCrm = FreshworksCrm;
  //# sourceMappingURL=FreshworksCrm.node.js.map

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

  # Freshworks CRM node

  Use the Freshworks CRM node to automate work in Freshworks CRM, and integrate Freshworks CRM with other applications. n8n has built-in support for a wide range of Freshworks CRM features, including creating, updating, deleting, and retrieve, accounts, appointments, contacts, deals, notes, sales activity and more. 

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

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

  ## Operations

  * Account
      * Create an account
      * Delete an account
      * Retrieve an account
      * Retrieve all accounts
      * Update an account
  * Appointment
      * Create an appointment
      * Delete an appointment
      * Retrieve an appointment
      * Retrieve all appointments
      * Update an appointment
  * Contact
      * Create a contact
      * Delete a contact
      * Retrieve a contact
      * Retrieve all contacts
      * Update a contact
  * Deal
      * Create a deal
      * Delete a deal
      * Retrieve a deal
      * Retrieve all deals
      * Update a deal
  * Note
      * Create a note
      * Delete a note
      * Update a note
  * Sales Activity
      * Retrieve a sales activity
      * Retrieve all sales activities
  * Task
      * Create a task
      * Delete a task
      * Retrieve a task
      * Retrieve all tasks
      * Update a task

  ## Templates and examples

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

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"edac4af1-7981-4a19-b805-44c6c9a783b0","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"2f5527bf9242936c872c696fad7303f8d7bfd4ecfd99ddb776e85d454c53f7fb"}}


node_type: n8n-nodes-base.Freshdesk
name: Freshdesk
display_name: Freshdesk
description: Consume Freshdesk API
category: output
icon: file:freshdesk.png
code_hash: 5c97877007443b2a5ca13fab7df7ab3f76815b48ced24af2f187af803817d81c
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.freshdesk
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:50
updated_at: 2025-06-08 09:17:50
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Freshdesk = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const ContactDescription_1 = require("./ContactDescription");
  var Status;
  (function (Status) {
      Status[Status["Open"] = 2] = "Open";
      Status[Status["Pending"] = 3] = "Pending";
      Status[Status["Resolved"] = 4] = "Resolved";
      Status[Status["Closed"] = 5] = "Closed";
  })(Status || (Status = {}));
  var Priority;
  (function (Priority) {
      Priority[Priority["Low"] = 1] = "Low";
      Priority[Priority["Medium"] = 2] = "Medium";
      Priority[Priority["High"] = 3] = "High";
      Priority[Priority["Urgent"] = 4] = "Urgent";
  })(Priority || (Priority = {}));
  var Source;
  (function (Source) {
      Source[Source["Email"] = 1] = "Email";
      Source[Source["Portal"] = 2] = "Portal";
      Source[Source["Phone"] = 3] = "Phone";
      Source[Source["Chat"] = 7] = "Chat";
      Source[Source["Mobihelp"] = 8] = "Mobihelp";
      Source[Source["FeedbackWidget"] = 9] = "FeedbackWidget";
      Source[Source["OutboundEmail"] = 10] = "OutboundEmail";
  })(Source || (Source = {}));
  class Freshdesk {
      constructor() {
          this.description = {
              displayName: 'Freshdesk',
              name: 'freshdesk',
              icon: 'file:freshdesk.png',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Freshdesk API',
              defaults: {
                  name: 'Freshdesk',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'freshdeskApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      required: true,
                      options: [
                          {
                              name: 'Contact',
                              value: 'contact',
                          },
                          {
                              name: 'Ticket',
                              value: 'ticket',
                          },
                      ],
                      default: 'ticket',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['ticket'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a new ticket',
                              action: 'Create a ticket',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete a ticket',
                              action: 'Delete a ticket',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a ticket',
                              action: 'Get a ticket',
                          },
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'Get many tickets',
                              action: 'Get many tickets',
                          },
                          {
                              name: 'Update',
                              value: 'update',
                              description: 'Update a ticket',
                              action: 'Update a ticket',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'Requester Identification',
                      name: 'requester',
                      type: 'options',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['ticket'],
                              operation: ['create'],
                          },
                      },
                      options: [
                          {
                              name: 'Email',
                              value: 'email',
                              description: 'Email address of the requester. If no contact exists with this email address in Freshdesk, it will be added as a new contact.',
                          },
                          {
                              name: 'Facebook ID',
                              value: 'facebookId',
                              description: 'Facebook ID of the requester. If no contact exists with this facebook_id, then a new contact will be created.',
                          },
                          {
                              name: 'Phone',
                              value: 'phone',
                              description: 'Phone number of the requester. If no contact exists with this phone number in Freshdesk, it will be added as a new contact. If the phone number is set and the email address is not, then the name attribute is mandatory.',
                          },
                          {
                              name: 'Requester ID',
                              value: 'requesterId',
                              description: "User ID of the requester. For existing contacts, the requester_id can be passed instead of the requester's email.",
                          },
                          {
                              name: 'Twitter ID',
                              value: 'twitterId',
                              description: 'Twitter handle of the requester. If no contact exists with this handle in Freshdesk, it will be added as a new contact.',
                          },
                          {
                              name: 'Unique External ID',
                              value: 'uniqueExternalId',
                              description: 'External ID of the requester. If no contact exists with this external ID in Freshdesk, they will be added as a new contact.',
                          },
                      ],
                      default: 'requesterId',
                  },
                  {
                      displayName: 'Value',
                      name: 'requesterIdentificationValue',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['ticket'],
                              operation: ['create'],
                          },
                      },
                      default: '',
                      description: 'Value of the identification selected',
                  },
                  {
                      displayName: 'Status',
                      name: 'status',
                      type: 'options',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['ticket'],
                              operation: ['create'],
                          },
                      },
                      options: [
                          {
                              name: 'Closed',
                              value: 'closed',
                          },
                          {
                              name: 'Open',
                              value: 'open',
                          },
                          {
                              name: 'Pending',
                              value: 'pending',
                          },
                          {
                              name: 'Resolved',
                              value: 'resolved',
                          },
                      ],
                      default: 'pending',
                  },
                  {
                      displayName: 'Priority',
                      name: 'priority',
                      type: 'options',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['ticket'],
                              operation: ['create'],
                          },
                      },
                      options: [
                          {
                              name: 'Low',
                              value: 'low',
                          },
                          {
                              name: 'Medium',
                              value: 'medium',
                          },
                          {
                              name: 'High',
                              value: 'high',
                          },
                          {
                              name: 'Urgent',
                              value: 'urgent',
                          },
                      ],
                      default: 'low',
                  },
                  {
                      displayName: 'Source',
                      name: 'source',
                      type: 'options',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['ticket'],
                              operation: ['create'],
                          },
                      },
                      options: [
                          {
                              name: 'Chat',
                              value: 'chat',
                          },
                          {
                              name: 'Email',
                              value: 'email',
                          },
                          {
                              name: 'Feedback Widget',
                              value: 'feedbackWidget',
                          },
                          {
                              name: 'Mobihelp',
                              value: 'mobileHelp',
                          },
                          {
                              name: 'Outbound Email',
                              value: 'OutboundEmail',
                          },
                          {
                              name: 'Phone',
                              value: 'phone',
                          },
                          {
                              name: 'Portal',
                              value: 'portal',
                          },
                      ],
                      default: 'portal',
                      description: 'The channel through which the ticket was created',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['ticket'],
                              operation: ['create'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Agent Name or ID',
                              name: 'agent',
                              type: 'options',
                              default: '',
                              typeOptions: {
                                  loadOptionsMethod: 'getAgents',
                              },
                              description: 'ID of the agent to whom the ticket has been assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'CC Emails',
                              name: 'ccEmails',
                              type: 'string',
                              default: '',
                              description: "Separated by a comma (,) email addresses added in the 'cc' field of the incoming ticket email",
                          },
                          {
                              displayName: 'Company Name or ID',
                              name: 'company',
                              type: 'options',
                              default: '',
                              typeOptions: {
                                  loadOptionsMethod: 'getCompanies',
                              },
                              description: 'Company ID of the requester. This attribute can only be set if the Multiple Companies feature is enabled (Estate plan and above). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'Description',
                              name: 'description',
                              type: 'string',
                              default: '',
                              typeOptions: {
                                  rows: 5,
                              },
                              description: 'HTML content of the ticket',
                          },
                          {
                              displayName: 'Due By',
                              name: 'dueBy',
                              type: 'dateTime',
                              default: '',
                              description: 'Timestamp that denotes when the ticket is due to be resolved',
                          },
                          {
                              displayName: 'Email Config ID',
                              name: 'emailConfigId',
                              type: 'number',
                              default: '',
                              description: "ID of email config which is used for this ticket. (i.e., support@yourcompany.com/sales@yourcompany.com) If product_id is given and email_config_id is not given, product's primary email_config_id will be set.",
                          },
                          {
                              displayName: 'FR Due By',
                              name: 'frDueBy',
                              type: 'dateTime',
                              default: '',
                              description: 'Timestamp that denotes when the first response is due',
                          },
                          {
                              displayName: 'Group Name or ID',
                              name: 'group',
                              type: 'options',
                              default: '',
                              typeOptions: {
                                  loadOptionsMethod: 'getGroups',
                              },
                              description: 'ID of the group to which the ticket has been assigned. The default value is the ID of the group that is associated with the given email_config_id. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'Name',
                              name: 'name',
                              type: 'string',
                              default: '',
                              placeholder: '',
                              description: 'Name of the requester',
                          },
                          {
                              displayName: 'Product Name or ID',
                              name: 'product',
                              type: 'options',
                              default: '',
                              typeOptions: {
                                  loadOptionsMethod: 'getProducts',
                              },
                              description: 'ID of the product to which the ticket is associated. It will be ignored if the email_config_id attribute is set in the request. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'Subject',
                              name: 'subject',
                              type: 'string',
                              default: '',
                              placeholder: '',
                              description: 'Subject of the ticket',
                          },
                          {
                              displayName: 'Tags',
                              name: 'tags',
                              type: 'string',
                              default: '',
                              description: 'Separated by a comma (,) tags that have been associated with the ticket',
                          },
                          {
                              displayName: 'Type',
                              name: 'type',
                              type: 'options',
                              default: 'Question',
                              description: 'Helps categorize the ticket according to the different kinds of issues your support team deals with',
                              options: [
                                  {
                                      name: 'Feature Request',
                                      value: 'Feature Request',
                                  },
                                  {
                                      name: 'Incident',
                                      value: 'Incident',
                                  },
                                  {
                                      name: 'Problem',
                                      value: 'Problem',
                                  },
                                  {
                                      name: 'Question',
                                      value: 'Question',
                                  },
                                  {
                                      name: 'Refund',
                                      value: 'Refund',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Ticket ID',
                      name: 'ticketId',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['ticket'],
                              operation: ['update'],
                          },
                      },
                      default: '',
                  },
                  {
                      displayName: 'Update Fields',
                      name: 'updateFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['ticket'],
                              operation: ['update'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Agent Name or ID',
                              name: 'agent',
                              type: 'options',
                              default: '',
                              typeOptions: {
                                  loadOptionsMethod: 'getAgents',
                              },
                              description: 'ID of the agent to whom the ticket has been assigned. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'CC Emails',
                              name: 'ccEmails',
                              type: 'string',
                              default: '',
                              description: "Separated by a comma (,) email addresses added in the 'cc' field of the incoming ticket email",
                          },
                          {
                              displayName: 'Company Name or ID',
                              name: 'company',
                              type: 'options',
                              default: '',
                              typeOptions: {
                                  loadOptionsMethod: 'getCompanies',
                              },
                              description: 'Company ID of the requester. This attribute can only be set if the Multiple Companies feature is enabled (Estate plan and above). Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'Due By',
                              name: 'dueBy',
                              type: 'dateTime',
                              default: '',
                              description: 'Timestamp that denotes when the ticket is due to be resolved',
                          },
                          {
                              displayName: 'Email Config ID',
                              name: 'emailConfigId',
                              type: 'number',
                              default: '',
                              description: "ID of email config which is used for this ticket. (i.e., support@yourcompany.com/sales@yourcompany.com) If product_id is given and email_config_id is not given, product's primary email_config_id will be set.",
                          },
                          {
                              displayName: 'FR Due By',
                              name: 'frDueBy',
                              type: 'dateTime',
                              default: '',
                              description: 'Timestamp that denotes when the first response is due',
                          },
                          {
                              displayName: 'Group Name or ID',
                              name: 'group',
                              type: 'options',
                              default: '',
                              typeOptions: {
                                  loadOptionsMethod: 'getGroups',
                              },
                              description: 'ID of the group to which the ticket has been assigned. The default value is the ID of the group that is associated with the given email_config_id. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'Name',
                              name: 'name',
                              type: 'string',
                              default: '',
                              placeholder: '',
                              description: 'Name of the requester',
                          },
                          {
                              displayName: 'Product Name or ID',
                              name: 'product',
                              type: 'options',
                              default: '',
                              typeOptions: {
                                  loadOptionsMethod: 'getProducts',
                              },
                              description: 'ID of the product to which the ticket is associated. It will be ignored if the email_config_id attribute is set in the request. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'Priority',
                              name: 'priority',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Low',
                                      value: 'low',
                                  },
                                  {
                                      name: 'Medium',
                                      value: 'medium',
                                  },
                                  {
                                      name: 'High',
                                      value: 'high',
                                  },
                                  {
                                      name: 'Urgent',
                                      value: 'urgent',
                                  },
                              ],
                              default: 'low',
                          },
                          {
                              displayName: 'Requester Identification',
                              name: 'requester',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Email',
                                      value: 'email',
                                      description: 'Email address of the requester. If no contact exists with this email address in Freshdesk, it will be added as a new contact.',
                                  },
                                  {
                                      name: 'Facebook ID',
                                      value: 'facebookId',
                                      description: 'Facebook ID of the requester. If no contact exists with this facebook_id, then a new contact will be created.',
                                  },
                                  {
                                      name: 'Phone',
                                      value: 'phone',
                                      description: 'Phone number of the requester. If no contact exists with this phone number in Freshdesk, it will be added as a new contact. If the phone number is set and the email address is not, then the name attribute is mandatory.',
                                  },
                                  {
                                      name: 'Requester ID',
                                      value: 'requesterId',
                                      description: "User ID of the requester. For existing contacts, the requester_id can be passed instead of the requester's email.",
                                  },
                                  {
                                      name: 'Twitter ID',
                                      value: 'twitterId',
                                      description: 'Twitter handle of the requester. If no contact exists with this handle in Freshdesk, it will be added as a new contact.',
                                  },
                                  {
                                      name: 'Unique External ID',
                                      value: 'uniqueExternalId',
                                      description: 'External ID of the requester. If no contact exists with this external ID in Freshdesk, they will be added as a new contact.',
                                  },
                              ],
                              default: 'requesterId',
                          },
                          {
                              displayName: 'Requester Value',
                              name: 'requesterIdentificationValue',
                              type: 'string',
                              default: '',
                              description: 'Value of the identification selected',
                          },
                          {
                              displayName: 'Status',
                              name: 'status',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Open',
                                      value: 'open',
                                  },
                                  {
                                      name: 'Pending',
                                      value: 'pending',
                                  },
                                  {
                                      name: 'Resolved',
                                      value: 'resolved',
                                  },
                                  {
                                      name: 'Closed',
                                      value: 'closed',
                                  },
                              ],
                              default: 'pending',
                          },
                          {
                              displayName: 'Source',
                              name: 'source',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Chat',
                                      value: 'chat',
                                  },
                                  {
                                      name: 'Email',
                                      value: 'email',
                                  },
                                  {
                                      name: 'Feedback Widget',
                                      value: 'feedbackWidget',
                                  },
                                  {
                                      name: 'Mobihelp',
                                      value: 'mobileHelp',
                                  },
                                  {
                                      name: 'Outbound Email',
                                      value: 'OutboundEmail',
                                  },
                                  {
                                      name: 'Phone',
                                      value: 'phone',
                                  },
                                  {
                                      name: 'Portal',
                                      value: 'portal',
                                  },
                              ],
                              default: 'portal',
                              description: 'The channel through which the ticket was created',
                          },
                          {
                              displayName: 'Tags',
                              name: 'tags',
                              type: 'string',
                              default: '',
                              description: 'Separated by a comma (,) tags that have been associated with the ticket',
                          },
                          {
                              displayName: 'Type',
                              name: 'type',
                              type: 'options',
                              default: 'Question',
                              description: 'Helps categorize the ticket according to the different kinds of issues your support team deals with',
                              options: [
                                  {
                                      name: 'Feature Request',
                                      value: 'Feature Request',
                                  },
                                  {
                                      name: 'Incident',
                                      value: 'Incident',
                                  },
                                  {
                                      name: 'Problem',
                                      value: 'Problem',
                                  },
                                  {
                                      name: 'Question',
                                      value: 'Question',
                                  },
                                  {
                                      name: 'Refund',
                                      value: 'Refund',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Ticket ID',
                      name: 'ticketId',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['ticket'],
                              operation: ['get'],
                          },
                      },
                      default: '',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              resource: ['ticket'],
                              operation: ['getAll'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              resource: ['ticket'],
                              operation: ['getAll'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 10,
                      },
                      default: 5,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['ticket'],
                              operation: ['getAll'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Company ID',
                              name: 'companyId',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'Include',
                              name: 'include',
                              type: 'multiOptions',
                              options: [
                                  {
                                      name: 'Company',
                                      value: 'company',
                                  },
                                  {
                                      name: 'Description',
                                      value: 'description',
                                  },
                                  {
                                      name: 'Requester',
                                      value: 'requester',
                                  },
                                  {
                                      name: 'Stats',
                                      value: 'stats',
                                  },
                              ],
                              default: [],
                          },
                          {
                              displayName: 'Order',
                              name: 'order',
                              type: 'options',
                              options: [
                                  {
                                      name: 'ASC',
                                      value: 'asc',
                                  },
                                  {
                                      name: 'DESC',
                                      value: 'desc',
                                  },
                              ],
                              default: 'desc',
                              description: 'Order sort attribute ascending or descending',
                          },
                          {
                              displayName: 'Order By',
                              name: 'orderBy',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Created At',
                                      value: 'createdAt',
                                  },
                                  {
                                      name: 'Due By',
                                      value: 'dueBy',
                                  },
                                  {
                                      name: 'Updated At',
                                      value: 'updatedAt',
                                  },
                              ],
                              default: '',
                              description: 'Sort collection by object attribute',
                          },
                          {
                              displayName: 'Requester Email',
                              name: 'requesterEmail',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'Requester ID',
                              name: 'requesterId',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'Updated Since',
                              name: 'updatedSince',
                              type: 'dateTime',
                              default: '',
                          },
                      ],
                  },
                  {
                      displayName: 'Ticket ID',
                      name: 'ticketId',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['ticket'],
                              operation: ['delete'],
                          },
                      },
                      default: '',
                  },
                  ...ContactDescription_1.contactOperations,
                  ...ContactDescription_1.contactFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getAgents() {
                      const returnData = [];
                      const agents = await GenericFunctions_1.freshdeskApiRequest.call(this, 'GET', '/agents');
                      for (const agent of agents) {
                          const agentName = agent.contact.name;
                          const agentId = agent.id;
                          returnData.push({
                              name: agentName,
                              value: agentId,
                          });
                      }
                      return returnData;
                  },
                  async getGroups() {
                      const returnData = [];
                      const groups = await GenericFunctions_1.freshdeskApiRequest.call(this, 'GET', '/groups');
                      for (const group of groups) {
                          const groupName = group.name;
                          const groupId = group.id;
                          returnData.push({
                              name: groupName,
                              value: groupId,
                          });
                      }
                      return returnData;
                  },
                  async getProducts() {
                      const returnData = [];
                      const products = await GenericFunctions_1.freshdeskApiRequest.call(this, 'GET', '/products');
                      for (const product of products) {
                          const productName = product.name;
                          const productId = product.id;
                          returnData.push({
                              name: productName,
                              value: productId,
                          });
                      }
                      return returnData;
                  },
                  async getCompanies() {
                      const returnData = [];
                      const companies = await GenericFunctions_1.freshdeskApiRequest.call(this, 'GET', '/companies');
                      for (const company of companies) {
                          const companyName = company.name;
                          const companyId = company.id;
                          returnData.push({
                              name: companyName,
                              value: companyId,
                          });
                      }
                      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);
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'ticket') {
                      if (operation === 'create') {
                          const requester = this.getNodeParameter('requester', i);
                          const value = this.getNodeParameter('requesterIdentificationValue', i);
                          const status = this.getNodeParameter('status', i);
                          const priority = this.getNodeParameter('priority', i);
                          const source = this.getNodeParameter('source', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              status: Status[(0, GenericFunctions_1.capitalize)(status)],
                              priority: Priority[(0, GenericFunctions_1.capitalize)(priority)],
                              source: Source[(0, GenericFunctions_1.capitalize)(source)],
                          };
                          if (requester === 'requesterId') {
                              if (isNaN(value)) {
                                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Requester Id must be a number', {
                                      itemIndex: i,
                                  });
                              }
                              body.requester_id = parseInt(value, 10);
                          }
                          else if (requester === 'email') {
                              body.email = value;
                          }
                          else if (requester === 'facebookId') {
                              body.facebook_id = value;
                          }
                          else if (requester === 'phone') {
                              body.phone = value;
                          }
                          else if (requester === 'twitterId') {
                              body.twitter_id = value;
                          }
                          else if (requester === 'uniqueExternalId') {
                              body.unique_external_id = value;
                          }
                          if (options.name) {
                              body.name = options.name;
                          }
                          if (options.subject) {
                              body.subject = options.subject;
                          }
                          else {
                              body.subject = 'null';
                          }
                          if (options.type) {
                              body.type = options.type;
                          }
                          if (options.description) {
                              body.description = options.description;
                          }
                          else {
                              body.description = 'null';
                          }
                          if (options.agent) {
                              body.responder_id = options.agent;
                          }
                          if (options.company) {
                              body.company_id = options.company;
                          }
                          if (options.product) {
                              body.product_id = options.product;
                          }
                          if (options.group) {
                              body.group_id = options.group;
                          }
                          if (options.frDueBy) {
                              body.fr_due_by = options.frDueBy;
                          }
                          if (options.emailConfigId) {
                              body.email_config_id = options.emailConfigId;
                          }
                          if (options.dueBy) {
                              body.due_by = options.dueBy;
                          }
                          if (options.tags) {
                              body.tags = options.tags.split(',');
                          }
                          if (options.ccEmails) {
                              body.cc_emails = options.ccEmails.split(',');
                          }
                          responseData = await GenericFunctions_1.freshdeskApiRequest.call(this, 'POST', '/tickets', body);
                      }
                      if (operation === 'update') {
                          const ticketId = this.getNodeParameter('ticketId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          if (updateFields.requester) {
                              const value = updateFields.requesterIdentificationValue;
                              if (updateFields.requester === 'requesterId') {
                                  if (isNaN(parseInt(value, 10))) {
                                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Requester Id must be a number', {
                                          itemIndex: i,
                                      });
                                  }
                                  body.requester_id = parseInt(value, 10);
                              }
                              else if (updateFields.requester === 'email') {
                                  body.email = value;
                              }
                              else if (updateFields.requester === 'facebookId') {
                                  body.facebook_id = value;
                              }
                              else if (updateFields.requester === 'phone') {
                                  body.phone = value;
                              }
                              else if (updateFields.requester === 'twitterId') {
                                  body.twitter_id = value;
                              }
                              else if (updateFields.requester === 'uniqueExternalId') {
                                  body.unique_external_id = value;
                              }
                          }
                          if (updateFields.status) {
                              body.status = Status[(0, GenericFunctions_1.capitalize)(updateFields.status)];
                          }
                          if (updateFields.priority) {
                              body.priority = Priority[(0, GenericFunctions_1.capitalize)(updateFields.priority)];
                          }
                          if (updateFields.source) {
                              body.source = Source[(0, GenericFunctions_1.capitalize)(updateFields.source)];
                          }
                          if (updateFields.name) {
                              body.name = updateFields.name;
                          }
                          if (updateFields.type) {
                              body.type = updateFields.type;
                          }
                          if (updateFields.agent) {
                              body.responder_id = updateFields.agent;
                          }
                          if (updateFields.company) {
                              body.company_id = updateFields.company;
                          }
                          if (updateFields.product) {
                              body.product_id = updateFields.product;
                          }
                          if (updateFields.group) {
                              body.group_id = updateFields.group;
                          }
                          if (updateFields.frDueBy) {
                              body.fr_due_by = updateFields.frDueBy;
                          }
                          if (updateFields.emailConfigId) {
                              body.email_config_id = updateFields.emailConfigId;
                          }
                          if (updateFields.dueBy) {
                              body.due_by = updateFields.dueBy;
                          }
                          if (updateFields.tags) {
                              body.tags = updateFields.tags.split(',');
                          }
                          if (updateFields.ccEmails) {
                              body.cc_emails = updateFields.ccEmails.split(',');
                          }
                          responseData = await GenericFunctions_1.freshdeskApiRequest.call(this, 'PUT', `/tickets/${ticketId}`, body);
                      }
                      if (operation === 'get') {
                          const ticketId = this.getNodeParameter('ticketId', i);
                          responseData = await GenericFunctions_1.freshdeskApiRequest.call(this, 'GET', `/tickets/${ticketId}`);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.requesterId) {
                              qs.requester_id = options.requesterId;
                          }
                          if (options.requesterEmail) {
                              qs.email = options.requesterEmail;
                          }
                          if (options.companyId) {
                              qs.company_id = options.companyId;
                          }
                          if (options.updatedSince) {
                              qs.updated_since = options.updatedSince;
                          }
                          if (options.orderBy) {
                              qs.order_by = options.orderBy;
                          }
                          if (options.order) {
                              qs.order_type = options.order;
                          }
                          if (options.include) {
                              if (options.include.length !== 0) {
                                  qs.include = options.include.join(',');
                              }
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.freshdeskApiRequestAllItems.call(this, 'GET', '/tickets', {}, qs);
                          }
                          else {
                              qs.per_page = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.freshdeskApiRequest.call(this, 'GET', '/tickets', {}, qs);
                          }
                      }
                      if (operation === 'delete') {
                          const ticketId = this.getNodeParameter('ticketId', i);
                          responseData = await GenericFunctions_1.freshdeskApiRequest.call(this, 'DELETE', `/tickets/${ticketId}`);
                      }
                  }
                  else if (resource === 'contact') {
                      if (operation === 'create') {
                          const name = this.getNodeParameter('name', i);
                          const email = this.getNodeParameter('email', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i, {});
                          if (additionalFields.customFields) {
                              const metadata = additionalFields.customFields
                                  .customField;
                              additionalFields.custom_fields = {};
                              for (const data of metadata) {
                                  additionalFields.custom_fields[data.name] = data.value;
                              }
                              delete additionalFields.customFields;
                          }
                          const body = additionalFields;
                          body.name = name;
                          if (email) {
                              body.email = email;
                          }
                          responseData = await GenericFunctions_1.freshdeskApiRequest.call(this, 'POST', '/contacts', body);
                      }
                      else if (operation === 'delete') {
                          const contactId = this.getNodeParameter('contactId', i);
                          responseData = await GenericFunctions_1.freshdeskApiRequest.call(this, 'DELETE', `/contacts/${contactId}`, {});
                      }
                      else if (operation === 'get') {
                          const contactId = this.getNodeParameter('contactId', i);
                          responseData = await GenericFunctions_1.freshdeskApiRequest.call(this, 'GET', `/contacts/${contactId}`, {});
                      }
                      else if (operation === 'getAll') {
                          const filters = this.getNodeParameter('filters', i, {});
                          responseData = await GenericFunctions_1.freshdeskApiRequest.call(this, 'GET', '/contacts', {}, filters);
                      }
                      else if (operation === 'update') {
                          const contactId = this.getNodeParameter('contactId', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i, {});
                          if (additionalFields.customFields) {
                              const metadata = additionalFields.customFields
                                  .customField;
                              additionalFields.custom_fields = {};
                              for (const data of metadata) {
                                  additionalFields.custom_fields[data.name] = data.value;
                              }
                              delete additionalFields.customFields;
                          }
                          const body = additionalFields;
                          responseData = await GenericFunctions_1.freshdeskApiRequest.call(this, 'PUT', `/contacts/${contactId}`, body);
                      }
                  }
                  if (!Array.isArray(responseData) && responseData === undefined) {
                      responseData = {
                          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.Freshdesk = Freshdesk;
  //# sourceMappingURL=Freshdesk.node.js.map

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

  # Freshdesk node

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

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

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

  ## Operations

  * Contact
      * Create a new contact
      * Delete a contact
      * Get a contact
      * Get all contacts
      * Update a contact
  * Ticket
      * Create a new ticket
      * Delete a ticket
      * Get a ticket
      * Get all tickets
      * Update a ticket

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"957fbb44-f033-403a-87d5-582ca2e0b1a1","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"04a090e80f27aaf69b8e55ba69376d276fe4692b055bdb5f937dd2770f579c3a"}}


node_type: n8n-nodes-base.Freshservice
name: Freshservice
display_name: Freshservice
description: Consume the Freshservice API
category: transform
icon: file:freshservice.svg
code_hash: 1bed84ee0d2e0bae1d67c9bfa28f817c5051798f27c18b1b33574e1f94a576c0
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.freshservice
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:50
updated_at: 2025-06-08 09:17:50
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Freshservice = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const descriptions_1 = require("./descriptions");
  const moment_timezone_1 = require("moment-timezone");
  class Freshservice {
      constructor() {
          this.description = {
              displayName: 'Freshservice',
              name: 'freshservice',
              icon: 'file:freshservice.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the Freshservice API',
              defaults: {
                  name: 'Freshservice',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'freshserviceApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Agent',
                              value: 'agent',
                          },
                          {
                              name: 'Agent Group',
                              value: 'agentGroup',
                          },
                          {
                              name: 'Agent Role',
                              value: 'agentRole',
                          },
                          {
                              name: 'Announcement',
                              value: 'announcement',
                          },
                          {
                              name: 'Asset Type',
                              value: 'assetType',
                          },
                          {
                              name: 'Change',
                              value: 'change',
                          },
                          {
                              name: 'Department',
                              value: 'department',
                          },
                          {
                              name: 'Location',
                              value: 'location',
                          },
                          {
                              name: 'Problem',
                              value: 'problem',
                          },
                          {
                              name: 'Product',
                              value: 'product',
                          },
                          {
                              name: 'Release',
                              value: 'release',
                          },
                          {
                              name: 'Requester',
                              value: 'requester',
                          },
                          {
                              name: 'Requester Group',
                              value: 'requesterGroup',
                          },
                          {
                              name: 'Software',
                              value: 'software',
                          },
                          {
                              name: 'Ticket',
                              value: 'ticket',
                          },
                      ],
                      default: 'agent',
                  },
                  ...descriptions_1.agentOperations,
                  ...descriptions_1.agentFields,
                  ...descriptions_1.agentGroupOperations,
                  ...descriptions_1.agentGroupFields,
                  ...descriptions_1.agentRoleOperations,
                  ...descriptions_1.agentRoleFields,
                  ...descriptions_1.announcementOperations,
                  ...descriptions_1.announcementFields,
                  ...descriptions_1.assetTypeOperations,
                  ...descriptions_1.assetTypeFields,
                  ...descriptions_1.changeOperations,
                  ...descriptions_1.changeFields,
                  ...descriptions_1.departmentOperations,
                  ...descriptions_1.departmentFields,
                  ...descriptions_1.locationOperations,
                  ...descriptions_1.locationFields,
                  ...descriptions_1.problemOperations,
                  ...descriptions_1.problemFields,
                  ...descriptions_1.productOperations,
                  ...descriptions_1.productFields,
                  ...descriptions_1.releaseOperations,
                  ...descriptions_1.releaseFields,
                  ...descriptions_1.requesterOperations,
                  ...descriptions_1.requesterFields,
                  ...descriptions_1.requesterGroupOperations,
                  ...descriptions_1.requesterGroupFields,
                  ...descriptions_1.softwareOperations,
                  ...descriptions_1.softwareFields,
                  ...descriptions_1.ticketOperations,
                  ...descriptions_1.ticketFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getAgents() {
                      const { agents } = (await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', '/agents'));
                      return (0, GenericFunctions_1.toUserOptions)(agents.filter((agent) => agent.active));
                  },
                  async getAgentGroups() {
                      const { groups } = (await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', '/groups'));
                      return (0, GenericFunctions_1.toOptions)(groups);
                  },
                  async getAgentRoles() {
                      const { roles } = (await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', '/roles'));
                      return (0, GenericFunctions_1.toOptions)(roles);
                  },
                  async getAssetTypes() {
                      const { asset_types } = (await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', '/asset_types'));
                      return (0, GenericFunctions_1.toOptions)(asset_types);
                  },
                  async getAssetTypeFields() {
                      const assetType = this.getCurrentNodeParameter('assetTypeId');
                      const { asset_type_fields } = (await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', `/asset_types/${assetType}/fields`));
                      let fields = [];
                      fields = fields
                          .concat(...asset_type_fields.map((data) => data.fields))
                          .map((data) => ({ name: data.label, id: data.name }));
                      return (0, GenericFunctions_1.toOptions)(fields);
                  },
                  async getDepartments() {
                      const { departments } = (await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', '/departments'));
                      return (0, GenericFunctions_1.toOptions)(departments);
                  },
                  async getLocations() {
                      const { locations } = (await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', '/locations'));
                      return (0, GenericFunctions_1.toOptions)(locations);
                  },
                  async getRequesters() {
                      const { requesters } = (await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', '/requesters'));
                      return (0, GenericFunctions_1.toUserOptions)(requesters);
                  },
              },
          };
      }
      async execute() {
          var _a;
          const items = this.getInputData();
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          const defaultTimezone = this.getTimezone();
          let responseData;
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'agent') {
                      if (operation === 'create') {
                          const body = {
                              email: this.getNodeParameter('email', i),
                              first_name: this.getNodeParameter('firstName', i),
                          };
                          const roles = this.getNodeParameter('roles', i);
                          GenericFunctions_1.validateAssignmentScopeGroup.call(this, roles);
                          GenericFunctions_1.sanitizeAssignmentScopeGroup.call(this, roles);
                          Object.assign(body, (0, GenericFunctions_1.adjustAgentRoles)(roles));
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'POST', '/agents', body);
                      }
                      else if (operation === 'delete') {
                          const agentId = this.getNodeParameter('agentId', i);
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'DELETE', `/agents/${agentId}`);
                      }
                      else if (operation === 'get') {
                          const agentId = this.getNodeParameter('agentId', i);
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', `/agents/${agentId}`);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          if (Object.keys(filters).length) {
                              Object.assign(qs, (0, GenericFunctions_1.formatFilters)(filters));
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/agents', {}, qs);
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.validateUpdateFields.call(this, updateFields, resource);
                          Object.assign(body, updateFields);
                          const agentId = this.getNodeParameter('agentId', i);
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'PUT', `/agents/${agentId}`, body);
                      }
                  }
                  else if (resource === 'agentGroup') {
                      if (operation === 'create') {
                          const body = {
                              name: this.getNodeParameter('name', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'POST', '/groups', body);
                      }
                      else if (operation === 'delete') {
                          const agentGroupId = this.getNodeParameter('agentGroupId', i);
                          const endpoint = `/groups/${agentGroupId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const agentGroupId = this.getNodeParameter('agentGroupId', i);
                          const endpoint = `/groups/${agentGroupId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', endpoint);
                      }
                      else if (operation === 'getAll') {
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/groups');
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.validateUpdateFields.call(this, updateFields, resource);
                          Object.assign(body, updateFields);
                          const agentGroupId = this.getNodeParameter('agentGroupId', i);
                          const endpoint = `/groups/${agentGroupId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'PUT', endpoint, body);
                      }
                  }
                  else if (resource === 'agentRole') {
                      if (operation === 'get') {
                          const agentRoleId = this.getNodeParameter('agentRoleId', i);
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', `/roles/${agentRoleId}`);
                      }
                      else if (operation === 'getAll') {
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/roles');
                      }
                  }
                  else if (resource === 'announcement') {
                      if (operation === 'create') {
                          const visibleFrom = this.getNodeParameter('visibleFrom', i);
                          const body = {
                              title: this.getNodeParameter('title', i),
                              body_html: this.getNodeParameter('bodyHtml', i),
                              visibility: this.getNodeParameter('visibility', i),
                              visible_from: (0, moment_timezone_1.tz)(visibleFrom, defaultTimezone),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              const { visible_till, additional_emails, ...rest } = additionalFields;
                              Object.assign(body, {
                                  ...(additional_emails && { additional_emails: (0, GenericFunctions_1.toArray)(additional_emails) }),
                                  ...(visible_till && { visible_till: (0, moment_timezone_1.tz)(visible_till, defaultTimezone) }),
                                  ...rest,
                              });
                          }
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'POST', '/announcements', body);
                      }
                      else if (operation === 'delete') {
                          const announcementId = this.getNodeParameter('announcementId', i);
                          const endpoint = `/announcements/${announcementId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const announcementId = this.getNodeParameter('announcementId', i);
                          const endpoint = `/announcements/${announcementId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', endpoint);
                      }
                      else if (operation === 'getAll') {
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/announcements');
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.validateUpdateFields.call(this, updateFields, resource);
                          const { visible_till, additional_emails, ...rest } = updateFields;
                          Object.assign(body, {
                              ...(additional_emails && { additional_emails: (0, GenericFunctions_1.toArray)(additional_emails) }),
                              ...(visible_till && { visible_till: (0, moment_timezone_1.tz)(visible_till, defaultTimezone) }),
                              ...rest,
                          });
                          const announcementId = this.getNodeParameter('announcementId', i);
                          const endpoint = `/announcements/${announcementId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'PUT', endpoint, body);
                      }
                  }
                  else if (resource === 'asset') {
                      if (operation === 'create') {
                          const body = {
                              asset_type_id: this.getNodeParameter('assetTypeId', i),
                              name: this.getNodeParameter('name', i),
                          };
                          const assetFields = this.getNodeParameter('assetFieldsUi.assetFieldValue', i, []);
                          Object.assign(body, {
                              type_fields: assetFields.reduce((obj, value) => Object.assign(obj, { [`${value.name}`]: value.value }), {}),
                          });
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'POST', '/assets', body);
                      }
                      else if (operation === 'delete') {
                          const assetDisplayId = this.getNodeParameter('assetDisplayId', i);
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'DELETE', `/assets/${assetDisplayId}`);
                      }
                      else if (operation === 'get') {
                          const assetDisplayId = this.getNodeParameter('assetDisplayId', i);
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', `/assets/${assetDisplayId}`);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          if (Object.keys(filters).length) {
                              Object.assign(qs, (0, GenericFunctions_1.formatFilters)(filters));
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/assets', {}, qs);
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.validateUpdateFields.call(this, updateFields, resource);
                          Object.assign(body, updateFields);
                          const assetDisplayId = this.getNodeParameter('assetDisplayId', i);
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'PUT', `/assets/${assetDisplayId}`, body);
                      }
                  }
                  else if (resource === 'assetType') {
                      if (operation === 'create') {
                          const body = {
                              name: this.getNodeParameter('name', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'POST', '/asset_types', body);
                      }
                      else if (operation === 'delete') {
                          const assetTypeId = this.getNodeParameter('assetTypeId', i);
                          const endpoint = `/asset_types/${assetTypeId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const assetTypeId = this.getNodeParameter('assetTypeId', i);
                          const endpoint = `/asset_types/${assetTypeId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', endpoint);
                      }
                      else if (operation === 'getAll') {
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/asset_types');
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.validateUpdateFields.call(this, updateFields, resource);
                          Object.assign(body, updateFields);
                          const assetTypeId = this.getNodeParameter('assetTypeId', i);
                          const endpoint = `/asset_types/${assetTypeId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'PUT', endpoint, body);
                      }
                  }
                  else if (resource === 'change') {
                      if (operation === 'create') {
                          const body = {
                              requester_id: this.getNodeParameter('requesterId', i),
                              subject: this.getNodeParameter('subject', i),
                              planned_start_date: this.getNodeParameter('plannedStartDate', i),
                              planned_end_date: this.getNodeParameter('plannedEndDate', i),
                              status: 1,
                              priority: 1,
                              impact: 1,
                              risk: 1,
                              change_type: 1,
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'POST', '/changes', body);
                      }
                      else if (operation === 'delete') {
                          const changeId = this.getNodeParameter('changeId', i);
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'DELETE', `/changes/${changeId}`);
                      }
                      else if (operation === 'get') {
                          const changeId = this.getNodeParameter('changeId', i);
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', `/changes/${changeId}`);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          if (Object.keys(filters).length) {
                              Object.assign(qs, (0, GenericFunctions_1.formatFilters)(filters));
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/changes', {}, qs);
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.validateUpdateFields.call(this, updateFields, resource);
                          Object.assign(body, updateFields);
                          const changeId = this.getNodeParameter('changeId', i);
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'PUT', `/changes/${changeId}`, body);
                      }
                  }
                  else if (resource === 'department') {
                      if (operation === 'create') {
                          const body = {
                              name: this.getNodeParameter('name', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              const { domains, ...rest } = additionalFields;
                              Object.assign(body, {
                                  ...(domains && { domains: (0, GenericFunctions_1.toArray)(domains) }),
                                  ...rest,
                              });
                          }
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'POST', '/departments', body);
                      }
                      else if (operation === 'delete') {
                          const departmentId = this.getNodeParameter('departmentId', i);
                          const endpoint = `/departments/${departmentId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const departmentId = this.getNodeParameter('departmentId', i);
                          const endpoint = `/departments/${departmentId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', endpoint);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          if (Object.keys(filters).length) {
                              Object.assign(qs, (0, GenericFunctions_1.formatFilters)(filters));
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/departments', {}, qs);
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.validateUpdateFields.call(this, updateFields, resource);
                          const { domains, ...rest } = updateFields;
                          Object.assign(body, {
                              ...(domains && { domains: (0, GenericFunctions_1.toArray)(domains) }),
                              ...rest,
                          });
                          const departmentId = this.getNodeParameter('departmentId', i);
                          const endpoint = `/departments/${departmentId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'PUT', endpoint, body);
                      }
                  }
                  else if (resource === 'location') {
                      if (operation === 'create') {
                          const body = {
                              name: this.getNodeParameter('name', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, (0, GenericFunctions_1.adjustAddress)(additionalFields));
                          }
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'POST', '/locations', body);
                      }
                      else if (operation === 'delete') {
                          const locationId = this.getNodeParameter('locationId', i);
                          const endpoint = `/locations/${locationId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const locationId = this.getNodeParameter('locationId', i);
                          const endpoint = `/locations/${locationId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', endpoint);
                      }
                      else if (operation === 'getAll') {
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/locations');
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.validateUpdateFields.call(this, updateFields, resource);
                          Object.assign(body, (0, GenericFunctions_1.adjustAddress)(updateFields));
                          const locationId = this.getNodeParameter('locationId', i);
                          const endpoint = `/locations/${locationId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'PUT', endpoint, body);
                      }
                  }
                  else if (resource === 'problem') {
                      if (operation === 'create') {
                          const body = {
                              subject: this.getNodeParameter('subject', i),
                              requester_id: this.getNodeParameter('requesterId', i),
                              due_by: this.getNodeParameter('dueBy', i),
                              status: 1,
                              priority: 1,
                              impact: 1,
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'POST', '/problems', body);
                      }
                      else if (operation === 'delete') {
                          const problemId = this.getNodeParameter('problemId', i);
                          const endpoint = `/problems/${problemId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const problemId = this.getNodeParameter('problemId', i);
                          const endpoint = `/problems/${problemId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', endpoint);
                      }
                      else if (operation === 'getAll') {
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/problems');
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.validateUpdateFields.call(this, updateFields, resource);
                          Object.assign(body, updateFields);
                          const problemId = this.getNodeParameter('problemId', i);
                          const endpoint = `/problems/${problemId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'PUT', endpoint, body);
                      }
                  }
                  else if (resource === 'product') {
                      if (operation === 'create') {
                          const body = {
                              asset_type_id: this.getNodeParameter('assetTypeId', i),
                              name: this.getNodeParameter('name', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'POST', '/products', body);
                      }
                      else if (operation === 'delete') {
                          const productId = this.getNodeParameter('productId', i);
                          const endpoint = `/products/${productId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const productId = this.getNodeParameter('productId', i);
                          const endpoint = `/products/${productId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', endpoint);
                      }
                      else if (operation === 'getAll') {
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/products');
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          Object.assign(body, updateFields);
                          const productId = this.getNodeParameter('productId', i);
                          const endpoint = `/products/${productId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'PUT', endpoint, body);
                      }
                  }
                  else if (resource === 'release') {
                      if (operation === 'create') {
                          const body = {
                              subject: this.getNodeParameter('subject', i),
                              release_type: this.getNodeParameter('releaseType', i),
                              status: this.getNodeParameter('status', i),
                              priority: this.getNodeParameter('priority', i),
                              planned_start_date: this.getNodeParameter('plannedStartDate', i),
                              planned_end_date: this.getNodeParameter('plannedEndDate', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'POST', '/releases', body);
                      }
                      else if (operation === 'delete') {
                          const releaseId = this.getNodeParameter('releaseId', i);
                          const endpoint = `/releases/${releaseId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const releaseId = this.getNodeParameter('releaseId', i);
                          const endpoint = `/releases/${releaseId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', endpoint);
                      }
                      else if (operation === 'getAll') {
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/releases');
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          Object.assign(body, updateFields);
                          const releaseId = this.getNodeParameter('releaseId', i);
                          const endpoint = `/releases/${releaseId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'PUT', endpoint, body);
                      }
                  }
                  else if (resource === 'requester') {
                      if (operation === 'create') {
                          const body = {
                              first_name: this.getNodeParameter('firstName', i),
                              primary_email: this.getNodeParameter('primaryEmail', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              const { secondary_emails, ...rest } = additionalFields;
                              Object.assign(body, {
                                  ...(secondary_emails && { secondary_emails: (0, GenericFunctions_1.toArray)(secondary_emails) }),
                                  ...rest,
                              });
                          }
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'POST', '/requesters', body);
                      }
                      else if (operation === 'delete') {
                          const requesterId = this.getNodeParameter('requesterId', i);
                          const endpoint = `/requesters/${requesterId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const requesterId = this.getNodeParameter('requesterId', i);
                          const endpoint = `/requesters/${requesterId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', endpoint);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          if (Object.keys(filters).length) {
                              Object.assign(qs, (0, GenericFunctions_1.formatFilters)(filters));
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/requesters', {}, qs);
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.validateUpdateFields.call(this, updateFields, resource);
                          const { secondary_emails, ...rest } = updateFields;
                          Object.assign(body, {
                              ...(secondary_emails && { secondary_emails: (0, GenericFunctions_1.toArray)(secondary_emails) }),
                              ...rest,
                          });
                          const requesterId = this.getNodeParameter('requesterId', i);
                          const endpoint = `/requesters/${requesterId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'PUT', endpoint, body);
                      }
                  }
                  else if (resource === 'requesterGroup') {
                      if (operation === 'create') {
                          const body = {
                              name: this.getNodeParameter('name', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'POST', '/requester_groups', body);
                      }
                      else if (operation === 'delete') {
                          const requesterGroupId = this.getNodeParameter('requesterGroupId', i);
                          const endpoint = `/requester_groups/${requesterGroupId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const requesterGroupId = this.getNodeParameter('requesterGroupId', i);
                          const endpoint = `/requester_groups/${requesterGroupId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', endpoint);
                      }
                      else if (operation === 'getAll') {
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/requester_groups');
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.validateUpdateFields.call(this, updateFields, resource);
                          Object.assign(body, updateFields);
                          const requesterGroupId = this.getNodeParameter('requesterGroupId', i);
                          const endpoint = `/requester_groups/${requesterGroupId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'PUT', endpoint, body);
                      }
                  }
                  else if (resource === 'software') {
                      if (operation === 'create') {
                          const body = {
                              application: {
                                  application_type: this.getNodeParameter('applicationType', i),
                                  name: this.getNodeParameter('name', i),
                              },
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body.application, additionalFields);
                          }
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'POST', '/applications', body);
                      }
                      else if (operation === 'delete') {
                          const softwareId = this.getNodeParameter('softwareId', i);
                          const endpoint = `/applications/${softwareId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const softwareId = this.getNodeParameter('softwareId', i);
                          const endpoint = `/applications/${softwareId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', endpoint);
                      }
                      else if (operation === 'getAll') {
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/applications');
                      }
                      else if (operation === 'update') {
                          const body = { application: {} };
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.validateUpdateFields.call(this, updateFields, resource);
                          Object.assign(body.application, updateFields);
                          const softwareId = this.getNodeParameter('softwareId', i);
                          const endpoint = `/applications/${softwareId}`;
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'PUT', endpoint, body);
                      }
                  }
                  else if (resource === 'ticket') {
                      if (operation === 'create') {
                          const body = {
                              email: this.getNodeParameter('email', i),
                              subject: this.getNodeParameter('subject', i),
                              description: this.getNodeParameter('description', i),
                              priority: this.getNodeParameter('priority', i),
                              status: this.getNodeParameter('status', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              const { cc_emails, ...rest } = additionalFields;
                              Object.assign(body, {
                                  ...(cc_emails && { cc_emails: (0, GenericFunctions_1.toArray)(cc_emails) }),
                                  ...rest,
                              });
                          }
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'POST', '/tickets', body);
                      }
                      else if (operation === 'delete') {
                          const ticketId = this.getNodeParameter('ticketId', i);
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'DELETE', `/tickets/${ticketId}`);
                      }
                      else if (operation === 'get') {
                          const ticketId = this.getNodeParameter('ticketId', i);
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'GET', `/tickets/${ticketId}`);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          let endpoint = '';
                          if (Object.keys(filters).length) {
                              Object.assign(qs, (0, GenericFunctions_1.formatFilters)(filters));
                              endpoint = '/tickets/filter';
                          }
                          else {
                              endpoint = '/tickets';
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', endpoint, {}, qs);
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          GenericFunctions_1.validateUpdateFields.call(this, updateFields, resource);
                          Object.assign(body, updateFields);
                          const ticketId = this.getNodeParameter('ticketId', i);
                          responseData = await GenericFunctions_1.freshserviceApiRequest.call(this, 'PUT', `/tickets/${ticketId}`, body);
                      }
                  }
                  if (operation === 'delete' && !responseData) {
                      responseData = { success: true };
                  }
                  else if (operation !== 'getAll') {
                      const special = {
                          agentGroup: 'group',
                          agentRole: 'role',
                          assetType: 'asset_type',
                          requesterGroup: 'requester_group',
                          software: 'application',
                      };
                      responseData = (_a = responseData[special[resource]]) !== null && _a !== void 0 ? _a : responseData[resource];
                  }
              }
              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;
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.Freshservice = Freshservice;
  //# sourceMappingURL=Freshservice.node.js.map

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

  # Freshservice node

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

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

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

  ## Operations

  * Agent
      * Create an agent
      * Delete an agent
      * Retrieve an agent
      * Retrieve all agents
      * Update an agent
  * Agent Group
      * Create an agent group
      * Delete an agent group
      * Retrieve an agent group
      * Retrieve all agent groups
      * Update an agent group
  * Agent Role
      * Retrieve an agent role
      * Retrieve all agent roles
  * Announcement
      * Create an announcement
      * Delete an announcement
      * Retrieve an announcement
      * Retrieve all announcements
      * Update an announcement
  * Asset Type
      * Create an asset type
      * Delete an asset type
      * Retrieve an asset type
      * Retrieve all asset types
      * Update an asset type
  * Change
      * Create a change
      * Delete a change
      * Retrieve a change
      * Retrieve all changes
      * Update a change
  * Department
      * Create a department
      * Delete a department
      * Retrieve a department
      * Retrieve all departments
      * Update a department
  * Location
      * Create a location
      * Delete a location
      * Retrieve a location
      * Retrieve all locations
      * Update a location
  * Problem
      * Create a problem
      * Delete a problem
      * Retrieve a problem
      * Retrieve all problems
      * Update a problem
  * Product
      * Create a product
      * Delete a product
      * Retrieve a product
      * Retrieve all products
      * Update a product
  * Release
      * Create a release
      * Delete a release
      * Retrieve a release
      * Retrieve all releases
      * Update a release
  * Requester
      * Create a requester
      * Delete a requester
      * Retrieve a requester
      * Retrieve all requesters
      * Update a requester
  * Requester Group
      * Create a requester group
      * Delete a requester group
      * Retrieve a requester group
      * Retrieve all requester groups
      * Update a requester group
  * Software
      * Create a software application
      * Delete a software application
      * Retrieve a software application
      * Retrieve all software applications
      * Update a software application
  * Ticket
      * Create a ticket
      * Delete a ticket
      * Retrieve a ticket
      * Retrieve all tickets
      * Update a ticket

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"83b82218-867d-414a-b70a-655b3fe348aa","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"af9f6ef72d3bd784e2ee4b4d22d98716ef363ca45955509976bf0eabd901a5b6"}}


node_type: n8n-nodes-base.Function
name: Function
display_name: Function
category: transform
icon: fa:code
code_hash: d68f1ab94b190161e2ec2c56ec6631f6c3992826557c100ec578efff5de96a70
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:50
updated_at: 2025-06-08 09:17:50
description:
  Run custom function code which gets executed once and allows you to add, remove, change and replace items

source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Function = void 0;
  const vm2_1 = require("@n8n/vm2");
  const n8n_workflow_1 = require("n8n-workflow");
  const JavaScriptSandbox_1 = require("../Code/JavaScriptSandbox");
  class Function {
      constructor() {
          this.description = {
              displayName: 'Function',
              name: 'function',
              hidden: true,
              icon: 'fa:code',
              group: ['transform'],
              version: 1,
              description: 'Run custom function code which gets executed once and allows you to add, remove, change and replace items',
              defaults: {
                  name: 'Function',
                  color: '#FF9922',
              },
              inputs: ['main'],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'A newer version of this node type is available, called the ‘Code’ node',
                      name: 'notice',
                      type: 'notice',
                      default: '',
                  },
                  {
                      displayName: 'JavaScript Code',
                      name: 'functionCode',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                          codeAutocomplete: 'function',
                          editor: 'code',
                          rows: 10,
                      },
                      type: 'string',
                      default: `// Code here will run only once, no matter how many input items there are.
  // More info and help:https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.function/
  // Tip: You can use luxon for dates and $jmespath for querying JSON structures

  // Loop over inputs and add a new field called 'myNewField' to the JSON of each one
  for (item of items) {
    item.json.myNewField = 1;
  }

  // You can write logs to the browser console
  console.log('Done!');

  return items;`,
                      description: 'The JavaScript code to execute',
                      noDataExpression: true,
                  },
              ],
          };
      }
      async execute() {
          let items = this.getInputData();
          items = (0, n8n_workflow_1.deepCopy)(items);
          for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
              items[itemIndex].index = itemIndex;
          }
          const cleanupData = (inputData) => {
              Object.keys(inputData).map((key) => {
                  if (inputData[key] !== null && typeof inputData[key] === 'object') {
                      if (inputData[key].constructor.name === 'Object') {
                          inputData[key] = cleanupData(inputData[key]);
                      }
                      else {
                          inputData[key] = (0, n8n_workflow_1.deepCopy)(inputData[key]);
                      }
                  }
              });
              return inputData;
          };
          const sandbox = {
              getNodeParameter: this.getNodeParameter,
              getWorkflowStaticData: this.getWorkflowStaticData,
              helpers: this.helpers,
              items,
              $item: (index) => this.getWorkflowDataProxy(index),
              getBinaryDataAsync: async (item) => {
                  var _a;
                  if ((item === null || item === void 0 ? void 0 : item.binary) && (item === null || item === void 0 ? void 0 : item.index) !== undefined && (item === null || item === void 0 ? void 0 : item.index) !== null) {
                      for (const binaryPropertyName of Object.keys(item.binary)) {
                          item.binary[binaryPropertyName].data = (_a = (await this.helpers.getBinaryDataBuffer(item.index, binaryPropertyName))) === null || _a === void 0 ? void 0 : _a.toString('base64');
                      }
                  }
                  return item.binary;
              },
              setBinaryDataAsync: async (item, data) => {
                  if (!item) {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No item was provided to setBinaryDataAsync (item: INodeExecutionData, data: IBinaryKeyData).');
                  }
                  if (!data) {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No data was provided to setBinaryDataAsync (item: INodeExecutionData, data: IBinaryKeyData).');
                  }
                  for (const binaryPropertyName of Object.keys(data)) {
                      const binaryItem = data[binaryPropertyName];
                      data[binaryPropertyName] = await this.helpers.setBinaryDataBuffer(binaryItem, Buffer.from(binaryItem.data, 'base64'));
                  }
                  item.binary = data;
              },
          };
          Object.assign(sandbox, sandbox.$item(0));
          const mode = this.getMode();
          const options = {
              console: mode === 'manual' ? 'redirect' : 'inherit',
              sandbox,
              require: JavaScriptSandbox_1.vmResolver,
          };
          const vm = new vm2_1.NodeVM(options);
          if (mode === 'manual') {
              vm.on('console.log', this.sendMessageToUI);
          }
          const functionCode = this.getNodeParameter('functionCode', 0);
          try {
              items = await vm.run(`module.exports = async function() {${functionCode}\n}()`, __dirname);
              items = this.helpers.normalizeItems(items);
              if (items === undefined) {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No data got returned. Always return an Array of items!');
              }
              if (!Array.isArray(items)) {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Always an Array of items has to be returned!');
              }
              for (const item of items) {
                  if (item.json === undefined) {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'All returned items have to contain a property named "json"!');
                  }
                  if (typeof item.json !== 'object') {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The json-property has to be an object!');
                  }
                  item.json = cleanupData(item.json);
                  if (item.binary !== undefined) {
                      if (Array.isArray(item.binary) || typeof item.binary !== 'object') {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The binary-property has to be an object!');
                      }
                  }
              }
          }
          catch (error) {
              if (this.continueOnFail()) {
                  items = [{ json: { error: error.message } }];
              }
              else {
                  const stackLines = error.stack.split('\n');
                  if (stackLines.length > 0) {
                      stackLines.shift();
                      const lineParts = stackLines.find((line) => line.includes('Function')).split(':');
                      if (lineParts.length > 2) {
                          const lineNumber = lineParts.splice(-2, 1);
                          if (!isNaN(lineNumber)) {
                              error.message = `${error.message} [Line ${lineNumber}]`;
                          }
                      }
                  }
                  throw error;
              }
          }
          return [items];
      }
  }
  exports.Function = Function;
  //# sourceMappingURL=Function.node.js.map

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

  # OpenAI Functions Agent node

  Use the OpenAI Functions Agent node to use an [OpenAI functions model](https://platform.openai.com/docs/guides/function-calling){:target=_blank .external-link}. These are models that detect when a function should be called and respond with the inputs that should be passed to the function.

  Refer to [AI Agent](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/index.md) for more information on the AI Agent node itself.

  --8<-- "_snippets/integrations/builtin/cluster-nodes/use-with-chat-trigger.md"

  /// note | OpenAI Chat Model required
  You must use the [OpenAI Chat Model](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.lmchatopenai/index.md) with this agent.
  ///

  ## Node parameters

  Configure the OpenAI Functions Agent using the following parameters.

  ### Prompt

  --8<-- "_snippets/integrations/builtin/cluster-nodes/langchain-root-nodes/prompt.md"

  ### Require Specific Output Format

  --8<-- "_snippets/integrations/builtin/cluster-nodes/langchain-root-nodes/output-format.md"

  ## Node options

  Refine the OpenAI Functions Agent node's behavior using these options:

  ### System Message 

  --8<-- "_snippets/integrations/builtin/cluster-nodes/langchain-root-nodes/system-message.md"

  ### Max Iterations

  --8<-- "_snippets/integrations/builtin/cluster-nodes/langchain-root-nodes/max-iterations.md"

  ### Return Intermediate Steps

  --8<-- "_snippets/integrations/builtin/cluster-nodes/langchain-root-nodes/return-intermediate-steps.md"

  ## Templates and examples

  Refer to the main AI Agent node's [Templates and examples](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/index.md#templates-and-examples) section.

  ## Common issues

  For common questions or issues and suggested solutions, refer to [Common issues](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/common-issues.md).

  --8<-- "_glossary/ai-glossary.md"

documentation_url:
  https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/openai-functions-agent

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"1eae7fdc-dd1e-4dc9-8e16-8e508c1267c1","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"e1057504a69824513efa9b6ab135f3f2279e9d397fff97c5c0fae23feccddc4c"}}


node_type: n8n-nodes-base.GetResponse
name: GetResponse
display_name: GetResponse
description: Consume GetResponse API
category: input
icon: file:getResponse.png
code_hash: 656f8c68066e4eb9ba77ed1ed799dde425402f50b1f72c60e09520faa5448977
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.getresponsetrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:50
updated_at: 2025-06-08 09:17:50
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.GetResponse = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const ContactDescription_1 = require("./ContactDescription");
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
  class GetResponse {
      constructor() {
          this.description = {
              displayName: 'GetResponse',
              name: 'getResponse',
              icon: 'file:getResponse.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume GetResponse API',
              defaults: {
                  name: 'GetResponse',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'getResponseApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['apiKey'],
                          },
                      },
                  },
                  {
                      name: 'getResponseOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth2'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'API Key',
                              value: 'apiKey',
                          },
                          {
                              name: 'OAuth2',
                              value: 'oAuth2',
                          },
                      ],
                      default: 'apiKey',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Contact',
                              value: 'contact',
                          },
                      ],
                      default: 'contact',
                  },
                  ...ContactDescription_1.contactOperations,
                  ...ContactDescription_1.contactFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getCampaigns() {
                      const returnData = [];
                      const campaigns = await GenericFunctions_1.getresponseApiRequest.call(this, 'GET', '/campaigns');
                      for (const campaign of campaigns) {
                          returnData.push({
                              name: campaign.name,
                              value: campaign.campaignId,
                          });
                      }
                      return returnData;
                  },
                  async getTags() {
                      const returnData = [];
                      const tags = await GenericFunctions_1.getresponseApiRequest.call(this, 'GET', '/tags');
                      for (const tag of tags) {
                          returnData.push({
                              name: tag.name,
                              value: tag.tagId,
                          });
                      }
                      return returnData;
                  },
                  async getCustomFields() {
                      const returnData = [];
                      const customFields = await GenericFunctions_1.getresponseApiRequest.call(this, 'GET', '/custom-fields');
                      for (const customField of customFields) {
                          returnData.push({
                              name: customField.name,
                              value: customField.customFieldId,
                          });
                      }
                      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++) {
              try {
                  if (resource === 'contact') {
                      if (operation === 'create') {
                          const email = this.getNodeParameter('email', i);
                          const campaignId = this.getNodeParameter('campaignId', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              email,
                              campaign: {
                                  campaignId,
                              },
                          };
                          Object.assign(body, additionalFields);
                          if (additionalFields.customFieldsUi) {
                              const customFieldValues = additionalFields.customFieldsUi
                                  .customFieldValues;
                              if (customFieldValues) {
                                  body.customFieldValues = customFieldValues;
                                  for (let index = 0; index < customFieldValues.length; index++) {
                                      if (!Array.isArray(customFieldValues[index].value)) {
                                          customFieldValues[index].value = [customFieldValues[index].value];
                                      }
                                  }
                                  delete body.customFieldsUi;
                              }
                          }
                          responseData = await GenericFunctions_1.getresponseApiRequest.call(this, 'POST', '/contacts', body);
                          responseData = { success: true };
                      }
                      if (operation === 'delete') {
                          const contactId = this.getNodeParameter('contactId', i);
                          const options = this.getNodeParameter('options', i);
                          Object.assign(qs, options);
                          responseData = await GenericFunctions_1.getresponseApiRequest.call(this, 'DELETE', `/contacts/${contactId}`, {}, qs);
                          responseData = { success: true };
                      }
                      if (operation === 'get') {
                          const contactId = this.getNodeParameter('contactId', i);
                          const options = this.getNodeParameter('options', i);
                          Object.assign(qs, options);
                          responseData = await GenericFunctions_1.getresponseApiRequest.call(this, 'GET', `/contacts/${contactId}`, {}, qs);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          const timezone = this.getTimezone();
                          Object.assign(qs, options);
                          const isNotQuery = ['sortBy', 'sortOrder', 'additionalFlags', 'fields', 'exactMatch'];
                          const isDate = ['createdOnFrom', 'createdOnTo', 'changeOnFrom', 'changeOnTo'];
                          const dateMapToKey = {
                              createdOnFrom: '[createdOn][from]',
                              createdOnTo: '[createdOn][to]',
                              changeOnFrom: '[changeOn][from]',
                              changeOnTo: '[changeOn][to]',
                          };
                          for (const key of Object.keys(qs)) {
                              if (!isNotQuery.includes(key)) {
                                  if (isDate.includes(key)) {
                                      qs[`query${dateMapToKey[key]}`] = moment_timezone_1.default
                                          .tz(qs[key], timezone)
                                          .format('YYYY-MM-DDTHH:mm:ssZZ');
                                  }
                                  else {
                                      qs[`query[${key}]`] = qs[key];
                                  }
                                  delete qs[key];
                              }
                          }
                          if (qs.sortBy) {
                              qs[`sort[${qs.sortBy}]`] = qs.sortOrder || 'ASC';
                          }
                          if (qs.exactMatch === true) {
                              qs.additionalFlags = 'exactMatch';
                              delete qs.exactMatch;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.getResponseApiRequestAllItems.call(this, 'GET', '/contacts', {}, qs);
                          }
                          else {
                              qs.perPage = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.getresponseApiRequest.call(this, 'GET', '/contacts', {}, qs);
                          }
                      }
                      if (operation === 'update') {
                          const contactId = this.getNodeParameter('contactId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          Object.assign(body, updateFields);
                          if (updateFields.customFieldsUi) {
                              const customFieldValues = updateFields.customFieldsUi
                                  .customFieldValues;
                              if (customFieldValues) {
                                  body.customFieldValues = customFieldValues;
                                  delete body.customFieldsUi;
                              }
                          }
                          responseData = await GenericFunctions_1.getresponseApiRequest.call(this, 'POST', `/contacts/${contactId}`, body);
                      }
                  }
                  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.GetResponse = GetResponse;
  //# sourceMappingURL=GetResponse.node.js.map

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

  # GetResponse Trigger node

  [GetResponse](https://www.getresponse.com/){:target=_blank .external-link} is an online platform that offers email marketing software, landing page creator, webinar hosting, and much more.

  /// note | Credentials
  You can find authentication information for this node [here](/integrations/builtin/credentials/getresponse.md).
  ///

  ///  note  | Examples and templates
  For usage examples and templates to help you get started, refer to n8n's [GetResponse Trigger integrations](https://n8n.io/integrations/getresponse-trigger/){:target=_blank .external-link} page.
  ///

  ## Events

  - Receive notifications when a customer is subscribed to a list
  - Receive notifications when a customer is unsubscribed from a list
  - Receive notifications when an email is opened
  - Receive notifications when an email is clicked
  - Receive notifications when a survey is submitted

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"7e98e93c-ca88-4afb-a16f-bdca028b4d05","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"8aa9926f2055570d0187a154f5f5a9ba2b7f5cf3e56271892777a1214e20f7b1"}}


node_type: n8n-nodes-base.Ghost
name: Ghost
display_name: Ghost
description: Consume Ghost API
category: input
icon: file:ghost.svg
code_hash: d71663706631c3fa7968cf9519d85bac19bdfb4b37d8043b0ed29130df735818
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.ghost
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:51
updated_at: 2025-06-08 09:17:51
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.Ghost = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const PostDescription_1 = require("./PostDescription");
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
  class Ghost {
      constructor() {
          this.description = {
              displayName: 'Ghost',
              name: 'ghost',
              icon: 'file:ghost.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Ghost API',
              defaults: {
                  name: 'Ghost',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'ghostAdminApi',
                      required: true,
                      displayOptions: {
                          show: {
                              source: ['adminApi'],
                          },
                      },
                  },
                  {
                      name: 'ghostContentApi',
                      required: true,
                      displayOptions: {
                          show: {
                              source: ['contentApi'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Source',
                      name: 'source',
                      type: 'options',
                      description: 'Pick where your data comes from, Content or Admin API',
                      options: [
                          {
                              name: 'Admin API',
                              value: 'adminApi',
                          },
                          {
                              name: 'Content API',
                              value: 'contentApi',
                          },
                      ],
                      default: 'contentApi',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      options: [
                          {
                              name: 'Post',
                              value: 'post',
                          },
                      ],
                      noDataExpression: true,
                      default: 'post',
                  },
                  ...PostDescription_1.postOperations,
                  ...PostDescription_1.postFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getAuthors() {
                      const returnData = [];
                      const users = await GenericFunctions_1.ghostApiRequestAllItems.call(this, 'users', 'GET', '/admin/users');
                      for (const user of users) {
                          returnData.push({
                              name: user.name,
                              value: user.id,
                          });
                      }
                      return returnData;
                  },
                  async getTags() {
                      const returnData = [];
                      const tags = await GenericFunctions_1.ghostApiRequestAllItems.call(this, 'tags', 'GET', '/admin/tags');
                      for (const tag of tags) {
                          returnData.push({
                              name: tag.name,
                              value: tag.name,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const timezone = this.getTimezone();
          const qs = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          const source = this.getNodeParameter('source', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (source === 'contentApi') {
                      if (resource === 'post') {
                          if (operation === 'get') {
                              const by = this.getNodeParameter('by', i);
                              const identifier = this.getNodeParameter('identifier', i);
                              const options = this.getNodeParameter('options', i);
                              Object.assign(qs, options);
                              let endpoint;
                              if (by === 'slug') {
                                  endpoint = `/content/posts/slug/${identifier}`;
                              }
                              else {
                                  endpoint = `/content/posts/${identifier}`;
                              }
                              responseData = await GenericFunctions_1.ghostApiRequest.call(this, 'GET', endpoint, {}, qs);
                              responseData = responseData.posts;
                          }
                          if (operation === 'getAll') {
                              const returnAll = this.getNodeParameter('returnAll', 0);
                              const options = this.getNodeParameter('options', i);
                              Object.assign(qs, options);
                              if (returnAll) {
                                  responseData = await GenericFunctions_1.ghostApiRequestAllItems.call(this, 'posts', 'GET', '/content/posts', {}, qs);
                              }
                              else {
                                  qs.limit = this.getNodeParameter('limit', 0);
                                  responseData = await GenericFunctions_1.ghostApiRequest.call(this, 'GET', '/content/posts', {}, qs);
                                  responseData = responseData.posts;
                              }
                          }
                      }
                  }
                  if (source === 'adminApi') {
                      if (resource === 'post') {
                          if (operation === 'create') {
                              const title = this.getNodeParameter('title', i);
                              const contentFormat = this.getNodeParameter('contentFormat', i);
                              const content = this.getNodeParameter('content', i);
                              const additionalFields = this.getNodeParameter('additionalFields', i);
                              const post = {
                                  title,
                              };
                              if (contentFormat === 'html') {
                                  post.html = content;
                                  qs.source = 'html';
                              }
                              else if (contentFormat === 'lexical') {
                                  const lexical = (0, GenericFunctions_1.validateJSON)(content);
                                  if (lexical === undefined) {
                                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Content must be a valid JSON', {
                                          itemIndex: i,
                                      });
                                  }
                                  post.lexical = content;
                              }
                              else {
                                  const mobileDoc = (0, GenericFunctions_1.validateJSON)(content);
                                  if (mobileDoc === undefined) {
                                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Content must be a valid JSON', {
                                          itemIndex: i,
                                      });
                                  }
                                  post.mobiledoc = content;
                              }
                              delete post.content;
                              Object.assign(post, additionalFields);
                              if (post.published_at) {
                                  post.published_at = moment_timezone_1.default.tz(post.published_at, timezone).utc().format();
                              }
                              if (post.status === 'scheduled' && post.published_at === undefined) {
                                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Published at must be define when status is scheduled', { itemIndex: i });
                              }
                              responseData = await GenericFunctions_1.ghostApiRequest.call(this, 'POST', '/admin/posts', { posts: [post] }, qs);
                              responseData = responseData.posts;
                          }
                          if (operation === 'delete') {
                              const postId = this.getNodeParameter('postId', i);
                              responseData = await GenericFunctions_1.ghostApiRequest.call(this, 'DELETE', `/admin/posts/${postId}`);
                          }
                          if (operation === 'get') {
                              const by = this.getNodeParameter('by', i);
                              const identifier = this.getNodeParameter('identifier', i);
                              const options = this.getNodeParameter('options', i);
                              Object.assign(qs, options);
                              let endpoint;
                              if (by === 'slug') {
                                  endpoint = `/admin/posts/slug/${identifier}`;
                              }
                              else {
                                  endpoint = `/admin/posts/${identifier}`;
                              }
                              responseData = await GenericFunctions_1.ghostApiRequest.call(this, 'GET', endpoint, {}, qs);
                              responseData = responseData.posts;
                          }
                          if (operation === 'getAll') {
                              const returnAll = this.getNodeParameter('returnAll', 0);
                              const options = this.getNodeParameter('options', i);
                              Object.assign(qs, options);
                              if (returnAll) {
                                  responseData = await GenericFunctions_1.ghostApiRequestAllItems.call(this, 'posts', 'GET', '/admin/posts', {}, qs);
                              }
                              else {
                                  qs.limit = this.getNodeParameter('limit', 0);
                                  responseData = await GenericFunctions_1.ghostApiRequest.call(this, 'GET', '/admin/posts', {}, qs);
                                  responseData = responseData.posts;
                              }
                          }
                          if (operation === 'update') {
                              const postId = this.getNodeParameter('postId', i);
                              const contentFormat = this.getNodeParameter('contentFormat', i);
                              const updateFields = this.getNodeParameter('updateFields', i);
                              const post = {};
                              if (contentFormat === 'html') {
                                  post.html = updateFields.content || '';
                                  qs.source = 'html';
                                  delete updateFields.content;
                              }
                              else if (contentFormat === 'lexical') {
                                  const lexical = (0, GenericFunctions_1.validateJSON)(updateFields.contentJson || undefined);
                                  if (lexical === undefined) {
                                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Content must be a valid JSON', {
                                          itemIndex: i,
                                      });
                                  }
                                  post.lexical = updateFields.contentJson;
                                  delete updateFields.contentJson;
                              }
                              else {
                                  const mobileDoc = (0, GenericFunctions_1.validateJSON)(updateFields.contentJson || undefined);
                                  if (mobileDoc === undefined) {
                                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Content must be a valid JSON', {
                                          itemIndex: i,
                                      });
                                  }
                                  post.mobiledoc = updateFields.contentJson;
                                  delete updateFields.contentJson;
                              }
                              Object.assign(post, updateFields);
                              const { posts } = await GenericFunctions_1.ghostApiRequest.call(this, 'GET', `/admin/posts/${postId}`, {}, { fields: 'id, updated_at' });
                              if (post.published_at) {
                                  post.published_at = moment_timezone_1.default.tz(post.published_at, timezone).utc().format();
                              }
                              if (post.status === 'scheduled' && post.published_at === undefined) {
                                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Published at must be define when status is scheduled', { itemIndex: i });
                              }
                              post.updated_at = posts[0].updated_at;
                              responseData = await GenericFunctions_1.ghostApiRequest.call(this, 'PUT', `/admin/posts/${postId}`, { posts: [post] }, qs);
                              responseData = responseData.posts;
                          }
                      }
                  }
                  responseData = this.helpers.returnJsonArray(responseData);
                  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.Ghost = Ghost;
  //# sourceMappingURL=Ghost.node.js.map

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

  # Ghost node

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

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

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

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

  ## Operations

  ### Admin API

  * **Post**
      * Create a post
      * Delete a post
      * Get a post
      * Get all posts
      * Update a post


  ### Content API

  * **Post**
      * Get a post
      * Get all posts

  ## Templates and examples

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

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"ec81eaee-3e12-485d-8944-8736509dc00d","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"124afd1b2f39d760f62faa8ea4f2c1726ec98fc8960f51a56eb10ed6b6ad3e81"}}


node_type: n8n-nodes-base.Github
name: Github
display_name: GitHub
description: Consume GitHub API
category: input
icon: file:github.svg
code_hash: 749f403fea31f46ff0b72d3f102f45d2b3b252be9caad1c740dbf910d757f364
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:52
updated_at: 2025-06-08 09:17:52
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Github = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const change_case_1 = require("change-case");
  const SearchFunctions_1 = require("./SearchFunctions");
  class Github {
      constructor() {
          this.description = {
              displayName: 'GitHub',
              name: 'github',
              icon: 'file:github.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume GitHub API',
              defaults: {
                  name: 'GitHub',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'githubApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['accessToken'],
                          },
                      },
                  },
                  {
                      name: 'githubOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth2'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'Access Token',
                              value: 'accessToken',
                          },
                          {
                              name: 'OAuth2',
                              value: 'oAuth2',
                          },
                      ],
                      default: 'accessToken',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'File',
                              value: 'file',
                          },
                          {
                              name: 'Issue',
                              value: 'issue',
                          },
                          {
                              name: 'Organization',
                              value: 'organization',
                          },
                          {
                              name: 'Release',
                              value: 'release',
                          },
                          {
                              name: 'Repository',
                              value: 'repository',
                          },
                          {
                              name: 'Review',
                              value: 'review',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                      ],
                      default: 'issue',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['organization'],
                          },
                      },
                      options: [
                          {
                              name: 'Get Repositories',
                              value: 'getRepositories',
                              description: 'Returns all repositories of an organization',
                              action: 'Get repositories for an organization',
                          },
                      ],
                      default: 'getRepositories',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['issue'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a new issue',
                              action: 'Create an issue',
                          },
                          {
                              name: 'Create Comment',
                              value: 'createComment',
                              description: 'Create a new comment on an issue',
                              action: 'Create a comment on an issue',
                          },
                          {
                              name: 'Edit',
                              value: 'edit',
                              description: 'Edit an issue',
                              action: 'Edit an issue',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get the data of a single issue',
                              action: 'Get an issue',
                          },
                          {
                              name: 'Lock',
                              value: 'lock',
                              description: 'Lock an issue',
                              action: 'Lock an issue',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['file'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a new file in repository',
                              action: 'Create a file',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete a file in repository',
                              action: 'Delete a file',
                          },
                          {
                              name: 'Edit',
                              value: 'edit',
                              description: 'Edit a file in repository',
                              action: 'Edit a file',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get the data of a single file',
                              action: 'Get a file',
                          },
                          {
                              name: 'List',
                              value: 'list',
                              description: 'List contents of a folder',
                              action: 'List a file',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['repository'],
                          },
                      },
                      options: [
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get the data of a single repository',
                              action: 'Get a repository',
                          },
                          {
                              name: 'Get Issues',
                              value: 'getIssues',
                              description: 'Returns issues of a repository',
                              action: 'Get issues of a repository',
                          },
                          {
                              name: 'Get License',
                              value: 'getLicense',
                              description: "Returns the contents of the repository's license file, if one is detected",
                              action: 'Get the license of a repository',
                          },
                          {
                              name: 'Get Profile',
                              value: 'getProfile',
                              description: 'Get the community profile of a repository with metrics, health score, description, license, etc',
                              action: 'Get the profile of a repository',
                          },
                          {
                              name: 'List Popular Paths',
                              value: 'listPopularPaths',
                              description: 'Get the top 10 popular content paths over the last 14 days',
                              action: 'List popular paths in a repository',
                          },
                          {
                              name: 'List Referrers',
                              value: 'listReferrers',
                              description: 'Get the top 10 referrering domains over the last 14 days',
                              action: 'List the top referrers of a repository',
                          },
                      ],
                      default: 'getIssues',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['user'],
                          },
                      },
                      options: [
                          {
                              name: 'Get Repositories',
                              value: 'getRepositories',
                              description: 'Returns the repositories of a user',
                              action: "Get a user's repositories",
                          },
                          {
                              name: 'Invite',
                              value: 'invite',
                              description: 'Invites a user to an organization',
                              action: 'Invite a user',
                          },
                      ],
                      default: 'getRepositories',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['release'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Creates a new release',
                              action: 'Create a release',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete a release',
                              action: 'Delete a release',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a release',
                              action: 'Get a release',
                          },
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'Get many repository releases',
                              action: 'Get many releases',
                          },
                          {
                              name: 'Update',
                              value: 'update',
                              description: 'Update a release',
                              action: 'Update a release',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['review'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Creates a new review',
                              action: 'Create a review',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a review for a pull request',
                              action: 'Get a review',
                          },
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'Get many reviews for a pull request',
                              action: 'Get many reviews',
                          },
                          {
                              name: 'Update',
                              value: 'update',
                              description: 'Update a review',
                              action: 'Update a review',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'Repository Owner',
                      name: 'owner',
                      type: 'resourceLocator',
                      default: { mode: 'list', value: '' },
                      required: true,
                      modes: [
                          {
                              displayName: 'Repository Owner',
                              name: 'list',
                              type: 'list',
                              placeholder: 'Select an owner...',
                              typeOptions: {
                                  searchListMethod: 'getUsers',
                                  searchable: true,
                                  searchFilterRequired: true,
                              },
                          },
                          {
                              displayName: 'Link',
                              name: 'url',
                              type: 'string',
                              placeholder: 'e.g. https://github.com/n8n-io',
                              extractValue: {
                                  type: 'regex',
                                  regex: 'https:\\/\\/github.com\\/([-_0-9a-zA-Z]+)',
                              },
                              validation: [
                                  {
                                      type: 'regex',
                                      properties: {
                                          regex: 'https:\\/\\/github.com\\/([-_0-9a-zA-Z]+)(?:.*)',
                                          errorMessage: 'Not a valid Github URL',
                                      },
                                  },
                              ],
                          },
                          {
                              displayName: 'By Name',
                              name: 'name',
                              type: 'string',
                              placeholder: 'e.g. n8n-io',
                              validation: [
                                  {
                                      type: 'regex',
                                      properties: {
                                          regex: '[-_a-zA-Z0-9]+',
                                          errorMessage: 'Not a valid Github Owner Name',
                                      },
                                  },
                              ],
                              url: '=https://github.com/{{$value}}',
                          },
                      ],
                      displayOptions: {
                          hide: {
                              operation: ['invite'],
                          },
                      },
                  },
                  {
                      displayName: 'Repository Name',
                      name: 'repository',
                      type: 'resourceLocator',
                      default: { mode: 'list', value: '' },
                      required: true,
                      modes: [
                          {
                              displayName: 'Repository Name',
                              name: 'list',
                              type: 'list',
                              placeholder: 'Select an Repository...',
                              typeOptions: {
                                  searchListMethod: 'getRepositories',
                                  searchable: true,
                              },
                          },
                          {
                              displayName: 'Link',
                              name: 'url',
                              type: 'string',
                              placeholder: 'e.g. https://github.com/n8n-io/n8n',
                              extractValue: {
                                  type: 'regex',
                                  regex: 'https:\\/\\/github.com\\/(?:[-_0-9a-zA-Z]+)\\/([-_.0-9a-zA-Z]+)',
                              },
                              validation: [
                                  {
                                      type: 'regex',
                                      properties: {
                                          regex: 'https:\\/\\/github.com\\/(?:[-_0-9a-zA-Z]+)\\/([-_.0-9a-zA-Z]+)(?:.*)',
                                          errorMessage: 'Not a valid Github Repository URL',
                                      },
                                  },
                              ],
                          },
                          {
                              displayName: 'By Name',
                              name: 'name',
                              type: 'string',
                              placeholder: 'e.g. n8n',
                              validation: [
                                  {
                                      type: 'regex',
                                      properties: {
                                          regex: '[-_.0-9a-zA-Z]+',
                                          errorMessage: 'Not a valid Github Repository Name',
                                      },
                                  },
                              ],
                              url: '=https://github.com/{{$parameter["owner"]}}/{{$value}}',
                          },
                      ],
                      displayOptions: {
                          hide: {
                              resource: ['user', 'organization'],
                              operation: ['getRepositories'],
                          },
                      },
                  },
                  {
                      displayName: 'File Path',
                      name: 'filePath',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['file'],
                          },
                          hide: {
                              operation: ['list'],
                          },
                      },
                      placeholder: 'docs/README.md',
                      description: 'The file path of the file. Has to contain the full path.',
                  },
                  {
                      displayName: 'Path',
                      name: 'filePath',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['file'],
                              operation: ['list'],
                          },
                      },
                      placeholder: 'docs/',
                      description: 'The path of the folder to list',
                  },
                  {
                      displayName: 'Binary Data',
                      name: 'binaryData',
                      type: 'boolean',
                      default: false,
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['create', 'edit'],
                              resource: ['file'],
                          },
                      },
                      description: 'Whether the data to upload should be taken from binary field',
                  },
                  {
                      displayName: 'File Content',
                      name: 'fileContent',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              binaryData: [false],
                              operation: ['create', 'edit'],
                              resource: ['file'],
                          },
                      },
                      placeholder: '',
                      description: 'The text content of the file',
                  },
                  {
                      displayName: 'Binary Property',
                      name: 'binaryPropertyName',
                      type: 'string',
                      default: 'data',
                      required: true,
                      displayOptions: {
                          show: {
                              binaryData: [true],
                              operation: ['create', 'edit'],
                              resource: ['file'],
                          },
                      },
                      placeholder: '',
                      description: 'Name of the binary property which contains the data for the file',
                  },
                  {
                      displayName: 'Commit Message',
                      name: 'commitMessage',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['create', 'delete', 'edit'],
                              resource: ['file'],
                          },
                      },
                  },
                  {
                      displayName: 'Additional Parameters',
                      name: 'additionalParameters',
                      placeholder: 'Add Parameter',
                      description: 'Additional fields to add',
                      type: 'fixedCollection',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['create', 'delete', 'edit'],
                              resource: ['file'],
                          },
                      },
                      options: [
                          {
                              name: 'author',
                              displayName: 'Author',
                              values: [
                                  {
                                      displayName: 'Name',
                                      name: 'name',
                                      type: 'string',
                                      default: '',
                                      description: 'The name of the author of the commit',
                                  },
                                  {
                                      displayName: 'Email',
                                      name: 'email',
                                      type: 'string',
                                      placeholder: 'name@email.com',
                                      default: '',
                                      description: 'The email of the author of the commit',
                                  },
                              ],
                          },
                          {
                              name: 'branch',
                              displayName: 'Branch',
                              values: [
                                  {
                                      displayName: 'Branch',
                                      name: 'branch',
                                      type: 'string',
                                      default: '',
                                      description: 'The branch to commit to. If not set the repository’s default branch (usually master) is used.',
                                  },
                              ],
                          },
                          {
                              name: 'committer',
                              displayName: 'Committer',
                              values: [
                                  {
                                      displayName: 'Name',
                                      name: 'name',
                                      type: 'string',
                                      default: '',
                                      description: 'The name of the committer of the commit',
                                  },
                                  {
                                      displayName: 'Email',
                                      name: 'email',
                                      type: 'string',
                                      placeholder: 'name@email.com',
                                      default: '',
                                      description: 'The email of the committer of the commit',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'As Binary Property',
                      name: 'asBinaryProperty',
                      type: 'boolean',
                      default: true,
                      displayOptions: {
                          show: {
                              operation: ['get'],
                              resource: ['file'],
                          },
                      },
                      description: 'Whether to set the data of the file as binary property instead of returning the raw API response',
                  },
                  {
                      displayName: 'Binary Property',
                      name: 'binaryPropertyName',
                      type: 'string',
                      default: 'data',
                      required: true,
                      displayOptions: {
                          show: {
                              asBinaryProperty: [true],
                              operation: ['get'],
                              resource: ['file'],
                          },
                      },
                      placeholder: '',
                      description: 'Name of the binary property in which to save the binary data of the received file',
                  },
                  {
                      displayName: 'Additional Parameters',
                      name: 'additionalParameters',
                      placeholder: 'Add Parameter',
                      description: 'Additional fields to add',
                      type: 'collection',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['get'],
                              resource: ['file'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Reference',
                              name: 'reference',
                              type: 'string',
                              default: '',
                              placeholder: 'master',
                              description: 'The name of the commit/branch/tag. Default: the repository’s default branch (usually master).',
                          },
                      ],
                  },
                  {
                      displayName: 'Title',
                      name: 'title',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['issue'],
                          },
                      },
                      description: 'The title of the issue',
                  },
                  {
                      displayName: 'Body',
                      name: 'body',
                      type: 'string',
                      typeOptions: {
                          rows: 5,
                      },
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['issue'],
                          },
                      },
                      description: 'The body of the issue',
                  },
                  {
                      displayName: 'Labels',
                      name: 'labels',
                      type: 'collection',
                      typeOptions: {
                          multipleValues: true,
                          multipleValueButtonText: 'Add Label',
                      },
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['issue'],
                          },
                      },
                      default: { label: '' },
                      options: [
                          {
                              displayName: 'Label',
                              name: 'label',
                              type: 'string',
                              default: '',
                              description: 'Label to add to issue',
                          },
                      ],
                  },
                  {
                      displayName: 'Assignees',
                      name: 'assignees',
                      type: 'collection',
                      typeOptions: {
                          multipleValues: true,
                          multipleValueButtonText: 'Add Assignee',
                      },
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['issue'],
                          },
                      },
                      default: { assignee: '' },
                      options: [
                          {
                              displayName: 'Assignee',
                              name: 'assignee',
                              type: 'string',
                              default: '',
                              description: 'User to assign issue too',
                          },
                      ],
                  },
                  {
                      displayName: 'Issue Number',
                      name: 'issueNumber',
                      type: 'number',
                      default: 0,
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['createComment'],
                              resource: ['issue'],
                          },
                      },
                      description: 'The number of the issue on which to create the comment on',
                  },
                  {
                      displayName: 'Body',
                      name: 'body',
                      type: 'string',
                      typeOptions: {
                          rows: 5,
                      },
                      displayOptions: {
                          show: {
                              operation: ['createComment'],
                              resource: ['issue'],
                          },
                      },
                      default: '',
                      description: 'The body of the comment',
                  },
                  {
                      displayName: 'Issue Number',
                      name: 'issueNumber',
                      type: 'number',
                      default: 0,
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['edit'],
                              resource: ['issue'],
                          },
                      },
                      description: 'The number of the issue edit',
                  },
                  {
                      displayName: 'Edit Fields',
                      name: 'editFields',
                      type: 'collection',
                      typeOptions: {
                          multipleValueButtonText: 'Add Field',
                      },
                      displayOptions: {
                          show: {
                              operation: ['edit'],
                              resource: ['issue'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Title',
                              name: 'title',
                              type: 'string',
                              default: '',
                              description: 'The title of the issue',
                          },
                          {
                              displayName: 'Body',
                              name: 'body',
                              type: 'string',
                              typeOptions: {
                                  rows: 5,
                              },
                              default: '',
                              description: 'The body of the issue',
                          },
                          {
                              displayName: 'State',
                              name: 'state',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Closed',
                                      value: 'closed',
                                      description: 'Set the state to "closed"',
                                  },
                                  {
                                      name: 'Open',
                                      value: 'open',
                                      description: 'Set the state to "open"',
                                  },
                              ],
                              default: 'open',
                              description: 'The state to set',
                          },
                          {
                              displayName: 'Labels',
                              name: 'labels',
                              type: 'collection',
                              typeOptions: {
                                  multipleValues: true,
                                  multipleValueButtonText: 'Add Label',
                              },
                              default: { label: '' },
                              options: [
                                  {
                                      displayName: 'Label',
                                      name: 'label',
                                      type: 'string',
                                      default: '',
                                      description: 'Label to add to issue',
                                  },
                              ],
                          },
                          {
                              displayName: 'Assignees',
                              name: 'assignees',
                              type: 'collection',
                              typeOptions: {
                                  multipleValues: true,
                                  multipleValueButtonText: 'Add Assignee',
                              },
                              default: { assignee: '' },
                              options: [
                                  {
                                      displayName: 'Assignees',
                                      name: 'assignee',
                                      type: 'string',
                                      default: '',
                                      description: 'User to assign issue to',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Issue Number',
                      name: 'issueNumber',
                      type: 'number',
                      default: 0,
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['get'],
                              resource: ['issue'],
                          },
                      },
                      description: 'The number of the issue get data of',
                  },
                  {
                      displayName: 'Issue Number',
                      name: 'issueNumber',
                      type: 'number',
                      default: 0,
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['lock'],
                              resource: ['issue'],
                          },
                      },
                      description: 'The number of the issue to lock',
                  },
                  {
                      displayName: 'Lock Reason',
                      name: 'lockReason',
                      type: 'options',
                      displayOptions: {
                          show: {
                              operation: ['lock'],
                              resource: ['issue'],
                          },
                      },
                      options: [
                          {
                              name: 'Off-Topic',
                              value: 'off-topic',
                              description: 'The issue is Off-Topic',
                          },
                          {
                              name: 'Too Heated',
                              value: 'too heated',
                              description: 'The discussion is too heated',
                          },
                          {
                              name: 'Resolved',
                              value: 'resolved',
                              description: 'The issue got resolved',
                          },
                          {
                              name: 'Spam',
                              value: 'spam',
                              description: 'The issue is spam',
                          },
                      ],
                      default: 'resolved',
                      description: 'The reason to lock the issue',
                  },
                  {
                      displayName: 'Tag',
                      name: 'releaseTag',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['release'],
                          },
                      },
                      description: 'The tag of the release',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      typeOptions: {
                          multipleValueButtonText: 'Add Field',
                      },
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['release'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Name',
                              name: 'name',
                              type: 'string',
                              default: '',
                              description: 'The name of the issue',
                          },
                          {
                              displayName: 'Body',
                              name: 'body',
                              type: 'string',
                              typeOptions: {
                                  rows: 5,
                              },
                              default: '',
                              description: 'The body of the release',
                          },
                          {
                              displayName: 'Draft',
                              name: 'draft',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to create a draft (unpublished) release, "false" to create a published one',
                          },
                          {
                              displayName: 'Prerelease',
                              name: 'prerelease',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to point out that the release is non-production ready',
                          },
                          {
                              displayName: 'Target Commitish',
                              name: 'target_commitish',
                              type: 'string',
                              default: '',
                              description: "Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch(usually master).",
                          },
                      ],
                  },
                  {
                      displayName: 'Release ID',
                      name: 'release_id',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['release'],
                              operation: ['get', 'delete', 'update'],
                          },
                      },
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      typeOptions: {
                          multipleValueButtonText: 'Add Field',
                      },
                      displayOptions: {
                          show: {
                              operation: ['update'],
                              resource: ['release'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Body',
                              name: 'body',
                              type: 'string',
                              typeOptions: {
                                  rows: 5,
                              },
                              default: '',
                              description: 'The body of the release',
                          },
                          {
                              displayName: 'Draft',
                              name: 'draft',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to create a draft (unpublished) release, "false" to create a published one',
                          },
                          {
                              displayName: 'Name',
                              name: 'name',
                              type: 'string',
                              default: '',
                              description: 'The name of the release',
                          },
                          {
                              displayName: 'Prerelease',
                              name: 'prerelease',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to point out that the release is non-production ready',
                          },
                          {
                              displayName: 'Tag Name',
                              name: 'tag_name',
                              type: 'string',
                              default: '',
                              description: 'The name of the tag',
                          },
                          {
                              displayName: 'Target Commitish',
                              name: 'target_commitish',
                              type: 'string',
                              default: '',
                              description: "Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch(usually master).",
                          },
                      ],
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              resource: ['release'],
                              operation: ['getAll'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              resource: ['release'],
                              operation: ['getAll'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 100,
                      },
                      default: 50,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              resource: ['repository'],
                              operation: ['getIssues'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              resource: ['repository'],
                              operation: ['getIssues'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 100,
                      },
                      default: 50,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Filters',
                      name: 'getRepositoryIssuesFilters',
                      type: 'collection',
                      typeOptions: {
                          multipleValueButtonText: 'Add Filter',
                      },
                      displayOptions: {
                          show: {
                              operation: ['getIssues'],
                              resource: ['repository'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Assignee',
                              name: 'assignee',
                              type: 'string',
                              default: '',
                              description: 'Return only issues which are assigned to a specific user',
                          },
                          {
                              displayName: 'Creator',
                              name: 'creator',
                              type: 'string',
                              default: '',
                              description: 'Return only issues which were created by a specific user',
                          },
                          {
                              displayName: 'Mentioned',
                              name: 'mentioned',
                              type: 'string',
                              default: '',
                              description: 'Return only issues in which a specific user was mentioned',
                          },
                          {
                              displayName: 'Labels',
                              name: 'labels',
                              type: 'string',
                              default: '',
                              description: 'Return only issues with the given labels. Multiple lables can be separated by comma.',
                          },
                          {
                              displayName: 'Updated Since',
                              name: 'since',
                              type: 'dateTime',
                              default: '',
                              description: 'Return only issues updated at or after this time',
                          },
                          {
                              displayName: 'State',
                              name: 'state',
                              type: 'options',
                              options: [
                                  {
                                      name: 'All',
                                      value: 'all',
                                      description: 'Returns issues with any state',
                                  },
                                  {
                                      name: 'Closed',
                                      value: 'closed',
                                      description: 'Return issues with "closed" state',
                                  },
                                  {
                                      name: 'Open',
                                      value: 'open',
                                      description: 'Return issues with "open" state',
                                  },
                              ],
                              default: 'open',
                              description: 'The state to set',
                          },
                          {
                              displayName: 'Sort',
                              name: 'sort',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Created',
                                      value: 'created',
                                      description: 'Sort by created date',
                                  },
                                  {
                                      name: 'Updated',
                                      value: 'updated',
                                      description: 'Sort by updated date',
                                  },
                                  {
                                      name: 'Comments',
                                      value: 'comments',
                                      description: 'Sort by comments',
                                  },
                              ],
                              default: 'created',
                              description: 'The order the issues should be returned in',
                          },
                          {
                              displayName: 'Direction',
                              name: 'direction',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Ascending',
                                      value: 'asc',
                                      description: 'Sort in ascending order',
                                  },
                                  {
                                      name: 'Descending',
                                      value: 'desc',
                                      description: 'Sort in descending order',
                                  },
                              ],
                              default: 'desc',
                              description: 'The sort order',
                          },
                      ],
                  },
                  {
                      displayName: 'PR Number',
                      name: 'pullRequestNumber',
                      type: 'number',
                      default: 0,
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['get', 'update'],
                              resource: ['review'],
                          },
                      },
                      description: 'The number of the pull request',
                  },
                  {
                      displayName: 'Review ID',
                      name: 'reviewId',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['get', 'update'],
                              resource: ['review'],
                          },
                      },
                      description: 'ID of the review',
                  },
                  {
                      displayName: 'PR Number',
                      name: 'pullRequestNumber',
                      type: 'number',
                      default: 0,
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['getAll'],
                              resource: ['review'],
                          },
                      },
                      description: 'The number of the pull request',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              resource: ['review'],
                              operation: ['getAll'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              resource: ['review'],
                              operation: ['getAll'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 100,
                      },
                      default: 50,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'PR Number',
                      name: 'pullRequestNumber',
                      type: 'number',
                      default: 0,
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['review'],
                          },
                      },
                      description: 'The number of the pull request to review',
                  },
                  {
                      displayName: 'Event',
                      name: 'event',
                      type: 'options',
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['review'],
                          },
                      },
                      options: [
                          {
                              name: 'Approve',
                              value: 'approve',
                              description: 'Approve the pull request',
                          },
                          {
                              name: 'Request Change',
                              value: 'requestChanges',
                              description: 'Request code changes',
                          },
                          {
                              name: 'Comment',
                              value: 'comment',
                              description: 'Add a comment without approval or change requests',
                          },
                          {
                              name: 'Pending',
                              value: 'pending',
                              description: 'You will need to submit the pull request review when you are ready',
                          },
                      ],
                      default: 'approve',
                      description: 'The review action you want to perform',
                  },
                  {
                      displayName: 'Body',
                      name: 'body',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['review'],
                              event: ['requestChanges', 'comment'],
                          },
                      },
                      default: '',
                      description: 'The body of the review (required for events Request Changes or Comment)',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      placeholder: 'Add Field',
                      type: 'collection',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['review'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Commit ID',
                              name: 'commitId',
                              type: 'string',
                              default: '',
                              description: 'The SHA of the commit that needs a review, if different from the latest',
                          },
                      ],
                  },
                  {
                      displayName: 'Body',
                      name: 'body',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['update'],
                              resource: ['review'],
                          },
                      },
                      default: '',
                      description: 'The body of the review',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              resource: ['user'],
                              operation: ['getRepositories'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              resource: ['user'],
                              operation: ['getRepositories'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 100,
                      },
                      default: 50,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Organization',
                      name: 'organization',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['invite'],
                              resource: ['user'],
                          },
                      },
                      description: 'The GitHub organization that the user is being invited to',
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['invite'],
                              resource: ['user'],
                          },
                      },
                      description: 'The email address of the invited user',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              resource: ['organization'],
                              operation: ['getRepositories'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              resource: ['organization'],
                              operation: ['getRepositories'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 100,
                      },
                      default: 50,
                      description: 'Max number of results to return',
                  },
              ],
          };
          this.methods = {
              listSearch: {
                  getUsers: SearchFunctions_1.getUsers,
                  getRepositories: SearchFunctions_1.getRepositories,
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          let returnAll = false;
          let responseData;
          const overwriteDataOperations = [
              'file:create',
              'file:delete',
              'file:edit',
              'file:get',
              'issue:create',
              'issue:createComment',
              'issue:edit',
              'issue:get',
              'release:create',
              'release:delete',
              'release:get',
              'release:update',
              'repository:get',
              'repository:getLicense',
              'repository:getProfile',
              'review:create',
              'review:get',
              'review:update',
              'user:invite',
          ];
          const overwriteDataOperationsArray = [
              'file:list',
              'repository:getIssues',
              'repository:listPopularPaths',
              'repository:listReferrers',
              'user:getRepositories',
              'release:getAll',
              'review:getAll',
              'organization:getRepositories',
          ];
          let body;
          let qs;
          let requestMethod;
          let endpoint;
          const operation = this.getNodeParameter('operation', 0);
          const resource = this.getNodeParameter('resource', 0);
          const fullOperation = `${resource}:${operation}`;
          for (let i = 0; i < items.length; i++) {
              try {
                  requestMethod = 'GET';
                  endpoint = '';
                  body = {};
                  qs = {};
                  let owner = '';
                  if (fullOperation !== 'user:invite') {
                      owner = this.getNodeParameter('owner', i, '', { extractValue: true });
                  }
                  let repository = '';
                  if (fullOperation !== 'user:getRepositories' &&
                      fullOperation !== 'user:invite' &&
                      fullOperation !== 'organization:getRepositories') {
                      repository = this.getNodeParameter('repository', i, '', { extractValue: true });
                  }
                  if (resource === 'file') {
                      if (['create', 'edit'].includes(operation)) {
                          requestMethod = 'PUT';
                          const filePath = this.getNodeParameter('filePath', i);
                          const additionalParameters = this.getNodeParameter('additionalParameters', i, {});
                          if (additionalParameters.author) {
                              body.author = additionalParameters.author;
                          }
                          if (additionalParameters.committer) {
                              body.committer = additionalParameters.committer;
                          }
                          if (additionalParameters.branch &&
                              additionalParameters.branch.branch) {
                              body.branch = additionalParameters.branch.branch;
                          }
                          if (operation === 'edit') {
                              body.sha = await GenericFunctions_1.getFileSha.call(this, owner, repository, filePath, body.branch);
                          }
                          body.message = this.getNodeParameter('commitMessage', i);
                          if (this.getNodeParameter('binaryData', i)) {
                              const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                              const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                              body.content = binaryData.data;
                          }
                          else {
                              body.content = Buffer.from(this.getNodeParameter('fileContent', i)).toString('base64');
                          }
                          endpoint = `/repos/${owner}/${repository}/contents/${encodeURI(filePath)}`;
                      }
                      else if (operation === 'delete') {
                          requestMethod = 'DELETE';
                          const additionalParameters = this.getNodeParameter('additionalParameters', i, {});
                          if (additionalParameters.author) {
                              body.author = additionalParameters.author;
                          }
                          if (additionalParameters.committer) {
                              body.committer = additionalParameters.committer;
                          }
                          if (additionalParameters.branch &&
                              additionalParameters.branch.branch) {
                              body.branch = additionalParameters.branch.branch;
                          }
                          const filePath = this.getNodeParameter('filePath', i);
                          body.message = this.getNodeParameter('commitMessage', i);
                          body.sha = await GenericFunctions_1.getFileSha.call(this, owner, repository, filePath, body.branch);
                          endpoint = `/repos/${owner}/${repository}/contents/${encodeURI(filePath)}`;
                      }
                      else if (operation === 'get') {
                          requestMethod = 'GET';
                          const filePath = this.getNodeParameter('filePath', i);
                          const additionalParameters = this.getNodeParameter('additionalParameters', i);
                          if (additionalParameters.reference) {
                              qs.ref = additionalParameters.reference;
                          }
                          endpoint = `/repos/${owner}/${repository}/contents/${encodeURI(filePath)}`;
                      }
                      else if (operation === 'list') {
                          requestMethod = 'GET';
                          const filePath = this.getNodeParameter('filePath', i);
                          endpoint = `/repos/${owner}/${repository}/contents/${encodeURI(filePath)}`;
                      }
                  }
                  else if (resource === 'issue') {
                      if (operation === 'create') {
                          requestMethod = 'POST';
                          body.title = this.getNodeParameter('title', i);
                          body.body = this.getNodeParameter('body', i);
                          const labels = this.getNodeParameter('labels', i);
                          const assignees = this.getNodeParameter('assignees', i);
                          body.labels = labels.map((data) => data.label);
                          body.assignees = assignees.map((data) => data.assignee);
                          endpoint = `/repos/${owner}/${repository}/issues`;
                      }
                      else if (operation === 'createComment') {
                          requestMethod = 'POST';
                          const issueNumber = this.getNodeParameter('issueNumber', i);
                          body.body = this.getNodeParameter('body', i);
                          endpoint = `/repos/${owner}/${repository}/issues/${issueNumber}/comments`;
                      }
                      else if (operation === 'edit') {
                          requestMethod = 'PATCH';
                          const issueNumber = this.getNodeParameter('issueNumber', i);
                          body = this.getNodeParameter('editFields', i, {});
                          if (body.labels !== undefined) {
                              body.labels = body.labels.map((data) => data.label);
                          }
                          if (body.assignees !== undefined) {
                              body.assignees = body.assignees.map((data) => data.assignee);
                          }
                          endpoint = `/repos/${owner}/${repository}/issues/${issueNumber}`;
                      }
                      else if (operation === 'get') {
                          requestMethod = 'GET';
                          const issueNumber = this.getNodeParameter('issueNumber', i);
                          endpoint = `/repos/${owner}/${repository}/issues/${issueNumber}`;
                      }
                      else if (operation === 'lock') {
                          requestMethod = 'PUT';
                          const issueNumber = this.getNodeParameter('issueNumber', i);
                          qs.lock_reason = this.getNodeParameter('lockReason', i);
                          endpoint = `/repos/${owner}/${repository}/issues/${issueNumber}/lock`;
                      }
                  }
                  else if (resource === 'release') {
                      if (operation === 'create') {
                          requestMethod = 'POST';
                          body = this.getNodeParameter('additionalFields', i, {});
                          body.tag_name = this.getNodeParameter('releaseTag', i);
                          endpoint = `/repos/${owner}/${repository}/releases`;
                      }
                      if (operation === 'delete') {
                          requestMethod = 'DELETE';
                          const releaseId = this.getNodeParameter('release_id', i);
                          endpoint = `/repos/${owner}/${repository}/releases/${releaseId}`;
                      }
                      if (operation === 'get') {
                          requestMethod = 'GET';
                          const releaseId = this.getNodeParameter('release_id', i);
                          endpoint = `/repos/${owner}/${repository}/releases/${releaseId}`;
                      }
                      if (operation === 'getAll') {
                          requestMethod = 'GET';
                          endpoint = `/repos/${owner}/${repository}/releases`;
                          returnAll = this.getNodeParameter('returnAll', 0);
                          if (!returnAll) {
                              qs.per_page = this.getNodeParameter('limit', 0);
                          }
                      }
                      if (operation === 'update') {
                          requestMethod = 'PATCH';
                          const releaseId = this.getNodeParameter('release_id', i);
                          body = this.getNodeParameter('additionalFields', i, {});
                          endpoint = `/repos/${owner}/${repository}/releases/${releaseId}`;
                      }
                  }
                  else if (resource === 'repository') {
                      if (operation === 'listPopularPaths') {
                          requestMethod = 'GET';
                          endpoint = `/repos/${owner}/${repository}/traffic/popular/paths`;
                      }
                      else if (operation === 'listReferrers') {
                          requestMethod = 'GET';
                          endpoint = `/repos/${owner}/${repository}/traffic/popular/referrers`;
                      }
                      else if (operation === 'get') {
                          requestMethod = 'GET';
                          endpoint = `/repos/${owner}/${repository}`;
                      }
                      else if (operation === 'getLicense') {
                          requestMethod = 'GET';
                          endpoint = `/repos/${owner}/${repository}/license`;
                      }
                      else if (operation === 'getIssues') {
                          requestMethod = 'GET';
                          qs = this.getNodeParameter('getRepositoryIssuesFilters', i);
                          endpoint = `/repos/${owner}/${repository}/issues`;
                          returnAll = this.getNodeParameter('returnAll', 0);
                          if (!returnAll) {
                              qs.per_page = this.getNodeParameter('limit', 0);
                          }
                      }
                  }
                  else if (resource === 'review') {
                      if (operation === 'get') {
                          requestMethod = 'GET';
                          const reviewId = this.getNodeParameter('reviewId', i);
                          const pullRequestNumber = this.getNodeParameter('pullRequestNumber', i);
                          endpoint = `/repos/${owner}/${repository}/pulls/${pullRequestNumber}/reviews/${reviewId}`;
                      }
                      else if (operation === 'getAll') {
                          requestMethod = 'GET';
                          returnAll = this.getNodeParameter('returnAll', 0);
                          const pullRequestNumber = this.getNodeParameter('pullRequestNumber', i);
                          if (!returnAll) {
                              qs.per_page = this.getNodeParameter('limit', 0);
                          }
                          endpoint = `/repos/${owner}/${repository}/pulls/${pullRequestNumber}/reviews`;
                      }
                      else if (operation === 'create') {
                          requestMethod = 'POST';
                          const pullRequestNumber = this.getNodeParameter('pullRequestNumber', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          Object.assign(body, additionalFields);
                          body.event = (0, change_case_1.snakeCase)(this.getNodeParameter('event', i)).toUpperCase();
                          if (body.event === 'REQUEST_CHANGES' || body.event === 'COMMENT') {
                              body.body = this.getNodeParameter('body', i);
                          }
                          endpoint = `/repos/${owner}/${repository}/pulls/${pullRequestNumber}/reviews`;
                      }
                      else if (operation === 'update') {
                          requestMethod = 'PUT';
                          const pullRequestNumber = this.getNodeParameter('pullRequestNumber', i);
                          const reviewId = this.getNodeParameter('reviewId', i);
                          body.body = this.getNodeParameter('body', i);
                          endpoint = `/repos/${owner}/${repository}/pulls/${pullRequestNumber}/reviews/${reviewId}`;
                      }
                  }
                  else if (resource === 'user') {
                      if (operation === 'getRepositories') {
                          requestMethod = 'GET';
                          endpoint = `/users/${owner}/repos`;
                          returnAll = this.getNodeParameter('returnAll', 0);
                          if (!returnAll) {
                              qs.per_page = this.getNodeParameter('limit', 0);
                          }
                      }
                      else if (operation === 'invite') {
                          requestMethod = 'POST';
                          const org = this.getNodeParameter('organization', i);
                          endpoint = `/orgs/${org}/invitations`;
                          body.email = this.getNodeParameter('email', i);
                      }
                  }
                  else if (resource === 'organization') {
                      if (operation === 'getRepositories') {
                          requestMethod = 'GET';
                          endpoint = `/orgs/${owner}/repos`;
                          returnAll = this.getNodeParameter('returnAll', 0);
                          if (!returnAll) {
                              qs.per_page = this.getNodeParameter('limit', 0);
                          }
                      }
                  }
                  else {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, {
                          itemIndex: i,
                      });
                  }
                  const asBinaryProperty = this.getNodeParameter('asBinaryProperty', i, false);
                  if (returnAll) {
                      responseData = await GenericFunctions_1.githubApiRequestAllItems.call(this, requestMethod, endpoint, body, qs);
                  }
                  else {
                      responseData = await GenericFunctions_1.githubApiRequest.call(this, requestMethod, endpoint, body, qs);
                  }
                  if (fullOperation === 'file:get') {
                      if (asBinaryProperty) {
                          if (Array.isArray(responseData) && responseData.length > 1) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'File Path is a folder, not a file.', {
                                  itemIndex: i,
                              });
                          }
                          const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                          const newItem = {
                              json: items[i].json,
                              binary: {},
                          };
                          if (items[i].binary !== undefined) {
                              Object.assign(newItem.binary, items[i].binary);
                          }
                          const { content, path } = responseData;
                          newItem.binary[binaryPropertyName] = await this.helpers.prepareBinaryData(Buffer.from(content, 'base64'), path);
                          items[i] = newItem;
                          return [items];
                      }
                  }
                  if (fullOperation === 'release:delete') {
                      responseData = { success: true };
                  }
                  if (overwriteDataOperations.includes(fullOperation) ||
                      overwriteDataOperationsArray.includes(fullOperation)) {
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      if (overwriteDataOperations.includes(fullOperation) ||
                          overwriteDataOperationsArray.includes(fullOperation)) {
                          const executionErrorData = this.helpers.constructExecutionMetaData([
                              {
                                  json: {
                                      error: error.message,
                                  },
                              },
                          ], { itemData: { item: i } });
                          returnData.push(...executionErrorData);
                      }
                      else {
                          items[i].json = { error: error.message };
                      }
                      continue;
                  }
                  throw error;
              }
          }
          if (overwriteDataOperations.includes(fullOperation) ||
              overwriteDataOperationsArray.includes(fullOperation)) {
              return [returnData];
          }
          else {
              return [items];
          }
      }
  }
  exports.Github = Github;
  //# sourceMappingURL=Github.node.js.map

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

  # GitHub Document Loader node

  Use the GitHub Document Loader node to load data from a GitHub repository for [vector stores](/glossary.md#ai-vector-store) or summarization.

  On this page, you'll find the node parameters for the GitHub Document Loader node, and links to more resources.

  /// note | Credentials
  You can find authentication information for this node [here](/integrations/builtin/credentials/github.md). This node doesn't support OAuth for authentication.
  ///

  --8<-- "_snippets/integrations/builtin/cluster-nodes/sub-node-expression-resolution.md"

  ## Node parameters

  * **Repository Link**: Enter the URL of your GitHub repository.
  * **Branch**: Enter the branch name to use.

  ## Node options

  * **Recursive**: Select whether to include sub-folders and files (turned on) or not (turned off).
  * **Ignore Paths**: Enter directories to ignore.

  ## Templates and examples

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

  ## Related resources

  --8<-- "_snippets/integrations/builtin/cluster-nodes/langchain-doc-loaders-link.md"

  --8<-- "_snippets/integrations/builtin/cluster-nodes/langchain-overview-link.md"
  --8<-- "_glossary/ai-glossary.md"

documentation_url:
  https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.documentgithubloader

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"9b0de38b-31d0-4acf-b863-1eef4c2b21a5","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"90488090cac70d599c454acda8af782ae65f4a1ad8c020c6eafb311ccb732c97"}}


node_type: n8n-nodes-base.Gitlab
name: Gitlab
display_name: GitLab
description: Retrieve data from GitLab API
category: input
icon: file:gitlab.svg
code_hash: 202529f826b67f848238e5d8a754b41d8ad35c4213dab7a775f0a7af3b15fbcd
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.gitlabtrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:17:52
updated_at: 2025-06-08 09:17:52
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Gitlab = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  class Gitlab {
      constructor() {
          this.description = {
              displayName: 'GitLab',
              name: 'gitlab',
              icon: 'file:gitlab.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Retrieve data from GitLab API',
              defaults: {
                  name: 'GitLab',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'gitlabApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['accessToken'],
                          },
                      },
                  },
                  {
                      name: 'gitlabOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth2'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'Access Token',
                              value: 'accessToken',
                          },
                          {
                              name: 'OAuth2',
                              value: 'oAuth2',
                          },
                      ],
                      default: 'accessToken',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'File',
                              value: 'file',
                          },
                          {
                              name: 'Issue',
                              value: 'issue',
                          },
                          {
                              name: 'Release',
                              value: 'release',
                          },
                          {
                              name: 'Repository',
                              value: 'repository',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                      ],
                      default: 'issue',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['issue'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a new issue',
                              action: 'Create an issue',
                          },
                          {
                              name: 'Create Comment',
                              value: 'createComment',
                              description: 'Create a new comment on an issue',
                              action: 'Create a comment on an issue',
                          },
                          {
                              name: 'Edit',
                              value: 'edit',
                              description: 'Edit an issue',
                              action: 'Edit an issue',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get the data of a single issue',
                              action: 'Get an issue',
                          },
                          {
                              name: 'Lock',
                              value: 'lock',
                              description: 'Lock an issue',
                              action: 'Lock an issue',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['repository'],
                          },
                      },
                      options: [
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get the data of a single repository',
                              action: 'Get a repository',
                          },
                          {
                              name: 'Get Issues',
                              value: 'getIssues',
                              description: 'Returns issues of a repository',
                              action: 'Get issues of a repository',
                          },
                      ],
                      default: 'getIssues',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['user'],
                          },
                      },
                      options: [
                          {
                              name: 'Get Repositories',
                              value: 'getRepositories',
                              description: 'Returns the repositories of a user',
                              action: "Get a user's repositories",
                          },
                      ],
                      default: 'getRepositories',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['release'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a new release',
                              action: 'Create a release',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete a release',
                              action: 'Delete a release',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a release',
                              action: 'Get a release',
                          },
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'Get many releases',
                              action: 'Get many releases',
                          },
                          {
                              name: 'Update',
                              value: 'update',
                              description: 'Update a release',
                              action: 'Update a release',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['file'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a new file in repository',
                              action: 'Create a file',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete a file in repository',
                              action: 'Delete a file',
                          },
                          {
                              name: 'Edit',
                              value: 'edit',
                              description: 'Edit a file in repository',
                              action: 'Edit a file',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get the data of a single file',
                              action: 'Get a file',
                          },
                          {
                              name: 'List',
                              value: 'list',
                              description: 'List contents of a folder',
                              action: 'List files',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'Project Owner',
                      name: 'owner',
                      type: 'string',
                      default: '',
                      required: true,
                      placeholder: 'n8n-io',
                      description: 'User, group or namespace of the project',
                  },
                  {
                      displayName: 'Project Name',
                      name: 'repository',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          hide: {
                              resource: ['user'],
                              operation: ['getRepositories'],
                          },
                      },
                      placeholder: 'n8n',
                      description: 'The name of the project',
                  },
                  {
                      displayName: 'Title',
                      name: 'title',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['issue'],
                          },
                      },
                      description: 'The title of the issue',
                  },
                  {
                      displayName: 'Body',
                      name: 'body',
                      type: 'string',
                      typeOptions: {
                          rows: 5,
                      },
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['issue'],
                          },
                      },
                      description: 'The body of the issue',
                  },
                  {
                      displayName: 'Due Date',
                      name: 'due_date',
                      type: 'dateTime',
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['issue'],
                          },
                      },
                      default: '',
                      description: 'Due Date for issue',
                  },
                  {
                      displayName: 'Labels',
                      name: 'labels',
                      type: 'collection',
                      typeOptions: {
                          multipleValues: true,
                          multipleValueButtonText: 'Add Label',
                      },
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['issue'],
                          },
                      },
                      default: { label: '' },
                      options: [
                          {
                              displayName: 'Label',
                              name: 'label',
                              type: 'string',
                              default: '',
                              description: 'Label to add to issue',
                          },
                      ],
                  },
                  {
                      displayName: 'Assignees',
                      name: 'assignee_ids',
                      type: 'collection',
                      typeOptions: {
                          multipleValues: true,
                          multipleValueButtonText: 'Add Assignee',
                      },
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['issue'],
                          },
                      },
                      default: { assignee: '' },
                      options: [
                          {
                              displayName: 'Assignee',
                              name: 'assignee',
                              type: 'number',
                              default: 0,
                              description: 'User ID to assign issue to',
                          },
                      ],
                  },
                  {
                      displayName: 'Issue Number',
                      name: 'issueNumber',
                      type: 'number',
                      default: 0,
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['createComment'],
                              resource: ['issue'],
                          },
                      },
                      description: 'The number of the issue on which to create the comment on',
                  },
                  {
                      displayName: 'Body',
                      name: 'body',
                      type: 'string',
                      typeOptions: {
                          rows: 5,
                      },
                      displayOptions: {
                          show: {
                              operation: ['createComment'],
                              resource: ['issue'],
                          },
                      },
                      default: '',
                      description: 'The body of the comment',
                  },
                  {
                      displayName: 'Issue Number',
                      name: 'issueNumber',
                      type: 'number',
                      default: 0,
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['edit'],
                              resource: ['issue'],
                          },
                      },
                      description: 'The number of the issue edit',
                  },
                  {
                      displayName: 'Edit Fields',
                      name: 'editFields',
                      type: 'collection',
                      typeOptions: {
                          multipleValueButtonText: 'Add Field',
                      },
                      displayOptions: {
                          show: {
                              operation: ['edit'],
                              resource: ['issue'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Title',
                              name: 'title',
                              type: 'string',
                              default: '',
                              description: 'The title of the issue',
                          },
                          {
                              displayName: 'Body',
                              name: 'description',
                              type: 'string',
                              typeOptions: {
                                  rows: 5,
                              },
                              default: '',
                              description: 'The body of the issue',
                          },
                          {
                              displayName: 'State',
                              name: 'state',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Closed',
                                      value: 'closed',
                                      description: 'Set the state to "closed"',
                                  },
                                  {
                                      name: 'Open',
                                      value: 'open',
                                      description: 'Set the state to "open"',
                                  },
                              ],
                              default: 'open',
                              description: 'The state to set',
                          },
                          {
                              displayName: 'Labels',
                              name: 'labels',
                              type: 'collection',
                              typeOptions: {
                                  multipleValues: true,
                                  multipleValueButtonText: 'Add Label',
                              },
                              default: { label: '' },
                              options: [
                                  {
                                      displayName: 'Label',
                                      name: 'label',
                                      type: 'string',
                                      default: '',
                                      description: 'Label to add to issue',
                                  },
                              ],
                          },
                          {
                              displayName: 'Assignees',
                              name: 'assignee_ids',
                              type: 'collection',
                              typeOptions: {
                                  multipleValues: true,
                                  multipleValueButtonText: 'Add Assignee',
                              },
                              default: { assignee: '' },
                              options: [
                                  {
                                      displayName: 'Assignees',
                                      name: 'assignee',
                                      type: 'string',
                                      default: '',
                                      description: 'User to assign issue too',
                                  },
                              ],
                          },
                          {
                              displayName: 'Due Date',
                              name: 'due_date',
                              type: 'dateTime',
                              default: '',
                              description: 'Due Date for issue',
                          },
                      ],
                  },
                  {
                      displayName: 'Issue Number',
                      name: 'issueNumber',
                      type: 'number',
                      default: 0,
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['get'],
                              resource: ['issue'],
                          },
                      },
                      description: 'The number of the issue get data of',
                  },
                  {
                      displayName: 'Issue Number',
                      name: 'issueNumber',
                      type: 'number',
                      default: 0,
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['lock'],
                              resource: ['issue'],
                          },
                      },
                      description: 'The number of the issue to lock',
                  },
                  {
                      displayName: 'Lock Reason',
                      name: 'lockReason',
                      type: 'options',
                      displayOptions: {
                          show: {
                              operation: ['lock'],
                              resource: ['issue'],
                          },
                      },
                      options: [
                          {
                              name: 'Off-Topic',
                              value: 'off-topic',
                              description: 'The issue is Off-Topic',
                          },
                          {
                              name: 'Too Heated',
                              value: 'too heated',
                              description: 'The discussion is too heated',
                          },
                          {
                              name: 'Resolved',
                              value: 'resolved',
                              description: 'The issue got resolved',
                          },
                          {
                              name: 'Spam',
                              value: 'spam',
                              description: 'The issue is spam',
                          },
                      ],
                      default: 'resolved',
                      description: 'The reason to lock the issue',
                  },
                  {
                      displayName: 'Tag',
                      name: 'releaseTag',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['release'],
                          },
                      },
                      description: 'The tag of the release',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      typeOptions: {
                          multipleValueButtonText: 'Add Field',
                      },
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['release'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Name',
                              name: 'name',
                              type: 'string',
                              default: '',
                              description: 'The name of the release',
                          },
                          {
                              displayName: 'Description',
                              name: 'description',
                              type: 'string',
                              typeOptions: {
                                  rows: 5,
                              },
                              default: '',
                              description: 'The description of the release',
                          },
                          {
                              displayName: 'Ref',
                              name: 'ref',
                              type: 'string',
                              default: '',
                              description: 'If Tag doesn’t exist, the release will be created from Ref. It can be a commit SHA, another tag name, or a branch name.',
                          },
                      ],
                  },
                  {
                      displayName: 'Project ID',
                      name: 'projectId',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['delete', 'get'],
                              resource: ['release'],
                          },
                      },
                      description: 'The ID or URL-encoded path of the project',
                  },
                  {
                      displayName: 'Tag Name',
                      name: 'tag_name',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['delete', 'get'],
                              resource: ['release'],
                          },
                      },
                      description: 'The Git tag the release is associated with',
                  },
                  {
                      displayName: 'Project ID',
                      name: 'projectId',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['getAll'],
                              resource: ['release'],
                          },
                      },
                      description: 'The ID or URL-encoded path of the project',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              resource: ['release', 'file'],
                              operation: ['getAll', 'list'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              resource: ['release', 'file'],
                              operation: ['getAll', 'list'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 100,
                      },
                      default: 20,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      typeOptions: {
                          multipleValueButtonText: 'Add Field',
                      },
                      displayOptions: {
                          show: {
                              operation: ['getAll'],
                              resource: ['release'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Order By',
                              name: 'order_by',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Created At',
                                      value: 'created_at',
                                  },
                                  {
                                      name: 'Released At',
                                      value: 'released_at',
                                  },
                              ],
                              default: 'released_at',
                              description: 'The field to use as order',
                          },
                          {
                              displayName: 'Sort',
                              name: 'sort',
                              type: 'options',
                              options: [
                                  {
                                      name: 'ASC',
                                      value: 'asc',
                                  },
                                  {
                                      name: 'DESC',
                                      value: 'desc',
                                  },
                              ],
                              default: 'desc',
                              description: 'The direction of the order. .',
                          },
                      ],
                  },
                  {
                      displayName: 'Project ID',
                      name: 'projectId',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['update'],
                              resource: ['release'],
                          },
                      },
                      description: 'The ID or URL-encoded path of the project',
                  },
                  {
                      displayName: 'Tag Name',
                      name: 'tag_name',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['update'],
                              resource: ['release'],
                          },
                      },
                      description: 'The Git tag the release is associated with',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      typeOptions: {
                          multipleValueButtonText: 'Add Field',
                      },
                      displayOptions: {
                          show: {
                              operation: ['update'],
                              resource: ['release'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Name',
                              name: 'name',
                              type: 'string',
                              default: '',
                              description: 'The release name',
                          },
                          {
                              displayName: 'Description',
                              name: 'description',
                              type: 'string',
                              default: '',
                              description: 'The description of the release. You can use Markdown.',
                          },
                          {
                              displayName: 'Milestones',
                              name: 'milestones',
                              type: 'string',
                              default: '',
                              description: 'The title of each milestone to associate with the release (provide a titles list spearated with comma)',
                          },
                          {
                              displayName: 'Released At',
                              name: 'released_at',
                              type: 'dateTime',
                              default: '',
                              description: 'The date when the release is/was ready',
                          },
                      ],
                  },
                  {
                      displayName: 'Filters',
                      name: 'getRepositoryIssuesFilters',
                      type: 'collection',
                      typeOptions: {
                          multipleValueButtonText: 'Add Filter',
                      },
                      displayOptions: {
                          show: {
                              operation: ['getIssues'],
                              resource: ['repository'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Assignee',
                              name: 'assignee_username',
                              type: 'string',
                              default: '',
                              description: 'Return only issues which are assigned to a specific user',
                          },
                          {
                              displayName: 'Creator',
                              name: 'author_username',
                              type: 'string',
                              default: '',
                              description: 'Return only issues which were created by a specific user',
                          },
                          {
                              displayName: 'Labels',
                              name: 'labels',
                              type: 'string',
                              default: '',
                              description: 'Return only issues with the given labels. Multiple lables can be separated by comma.',
                          },
                          {
                              displayName: 'Updated After',
                              name: 'updated_after',
                              type: 'dateTime',
                              default: '',
                              description: 'Return only issues updated at or after this time',
                          },
                          {
                              displayName: 'State',
                              name: 'state',
                              type: 'options',
                              options: [
                                  {
                                      name: 'All',
                                      value: '',
                                      description: 'Returns issues with any state',
                                  },
                                  {
                                      name: 'Closed',
                                      value: 'closed',
                                      description: 'Return issues with "closed" state',
                                  },
                                  {
                                      name: 'Open',
                                      value: 'opened',
                                      description: 'Return issues with "open" state',
                                  },
                              ],
                              default: 'opened',
                              description: 'The state to filter by',
                          },
                          {
                              displayName: 'Sort',
                              name: 'order_by',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Created At',
                                      value: 'created_at',
                                      description: 'Sort by created date',
                                  },
                                  {
                                      name: 'Updated At',
                                      value: 'updated_at',
                                      description: 'Sort by updated date',
                                  },
                                  {
                                      name: 'Priority',
                                      value: 'priority',
                                      description: 'Sort by priority',
                                  },
                              ],
                              default: 'created_at',
                              description: 'The order the issues should be returned in',
                          },
                          {
                              displayName: 'Direction',
                              name: 'sort',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Ascending',
                                      value: 'asc',
                                      description: 'Sort in ascending order',
                                  },
                                  {
                                      name: 'Descending',
                                      value: 'desc',
                                      description: 'Sort in descending order',
                                  },
                              ],
                              default: 'desc',
                              description: 'The sort order',
                          },
                      ],
                  },
                  {
                      displayName: 'File Path',
                      name: 'filePath',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['file'],
                          },
                          hide: {
                              operation: ['list'],
                          },
                      },
                      placeholder: 'docs/README.md',
                      description: 'The file path of the file. Has to contain the full path or leave it empty for root folder.',
                  },
                  {
                      displayName: 'Path',
                      name: 'filePath',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['file'],
                              operation: ['list'],
                          },
                      },
                      placeholder: 'docs/',
                      description: 'The path of the folder to list',
                  },
                  {
                      displayName: 'Page',
                      name: 'page',
                      type: 'number',
                      displayOptions: {
                          show: {
                              resource: ['file'],
                              operation: ['list'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 1000,
                      },
                      default: 1,
                      description: 'Page of results to display',
                  },
                  {
                      displayName: 'Additional Parameters',
                      name: 'additionalParameters',
                      placeholder: 'Add Parameter',
                      description: 'Additional fields to add',
                      type: 'collection',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['file'],
                              operation: ['list'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Reference',
                              name: 'ref',
                              type: 'string',
                              default: '',
                              placeholder: 'main',
                              description: 'The name of the commit/branch/tag. Default: the repository’s default branch (usually main).',
                          },
                          {
                              displayName: 'Recursive',
                              name: 'recursive',
                              type: 'boolean',
                              default: false,
                              description: 'Whether or not to get a recursive file tree. Default is false.',
                          },
                      ],
                  },
                  {
                      displayName: 'As Binary Property',
                      name: 'asBinaryProperty',
                      type: 'boolean',
                      default: true,
                      displayOptions: {
                          show: {
                              operation: ['get'],
                              resource: ['file'],
                          },
                      },
                      description: 'Whether to set the data of the file as binary property instead of returning the raw API response',
                  },
                  {
                      displayName: 'Binary Property',
                      name: 'binaryPropertyName',
                      type: 'string',
                      default: 'data',
                      required: true,
                      displayOptions: {
                          show: {
                              asBinaryProperty: [true],
                              operation: ['get'],
                              resource: ['file'],
                          },
                      },
                      placeholder: '',
                      description: 'Name of the binary property in which to save the binary data of the received file',
                  },
                  {
                      displayName: 'Additional Parameters',
                      name: 'additionalParameters',
                      placeholder: 'Add Parameter',
                      description: 'Additional fields to add',
                      type: 'collection',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['get'],
                              resource: ['file'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Reference',
                              name: 'reference',
                              type: 'string',
                              default: '',
                              placeholder: 'main',
                              description: 'The name of the commit/branch/tag. Default: the repository’s default branch (usually main).',
                          },
                      ],
                  },
                  {
                      displayName: 'Binary Data',
                      name: 'binaryData',
                      type: 'boolean',
                      default: false,
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['create', 'edit'],
                              resource: ['file'],
                          },
                      },
                      description: 'Whether the data to upload should be taken from binary field',
                  },
                  {
                      displayName: 'File Content',
                      name: 'fileContent',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              binaryData: [false],
                              operation: ['create', 'edit'],
                              resource: ['file'],
                          },
                      },
                      placeholder: '',
                      description: 'The text content of the file',
                  },
                  {
                      displayName: 'Binary Property',
                      name: 'binaryPropertyName',
                      type: 'string',
                      default: 'data',
                      required: true,
                      displayOptions: {
                          show: {
                              binaryData: [true],
                              operation: ['create', 'edit'],
                              resource: ['file'],
                          },
                      },
                      placeholder: '',
                      description: 'Name of the binary property which contains the data for the file',
                  },
                  {
                      displayName: 'Commit Message',
                      name: 'commitMessage',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['create', 'delete', 'edit'],
                              resource: ['file'],
                          },
                      },
                  },
                  {
                      displayName: 'Branch',
                      name: 'branch',
                      type: 'string',
                      default: '',
                      description: 'Name of the new branch to create. The commit is added to this branch.',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['create', 'delete', 'edit'],
                              resource: ['file'],
                          },
                      },
                  },
                  {
                      displayName: 'Additional Parameters',
                      name: 'additionalParameters',
                      placeholder: 'Add Parameter',
                      description: 'Additional fields to add',
                      type: 'fixedCollection',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['create', 'delete', 'edit'],
                              resource: ['file'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Start Branch',
                              name: 'branchStart',
                              values: [
                                  {
                                      displayName: 'Start Branch',
                                      name: 'branchStart',
                                      type: 'string',
                                      default: '',
                                      description: 'Name of the base branch to create the new branch from',
                                  },
                              ],
                          },
                          {
                              name: 'author',
                              displayName: 'Author',
                              values: [
                                  {
                                      displayName: 'Name',
                                      name: 'name',
                                      type: 'string',
                                      default: '',
                                      description: 'The name of the author of the commit',
                                  },
                                  {
                                      displayName: 'Email',
                                      name: 'email',
                                      type: 'string',
                                      placeholder: 'name@email.com',
                                      default: '',
                                      description: 'The email of the author of the commit',
                                  },
                              ],
                          },
                          {
                              name: 'encoding',
                              displayName: 'Encoding',
                              values: [
                                  {
                                      displayName: 'Encoding',
                                      name: 'encoding',
                                      type: 'string',
                                      default: 'text',
                                      description: 'Change encoding to base64. Default is text.',
                                  },
                              ],
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const overwriteDataOperations = [
              'file:get',
              'file:create',
              'file:edit',
              'file:delete',
              'issue:create',
              'issue:createComment',
              'issue:edit',
              'issue:get',
              'release:create',
              'release:delete',
              'release:get',
              'release:update',
              'repository:get',
          ];
          const overwriteDataOperationsArray = [
              'file:list',
              'release:getAll',
              'repository:getIssues',
              'user:getRepositories',
          ];
          let responseData;
          let body;
          let qs;
          let requestMethod;
          let endpoint;
          let returnAll = false;
          const operation = this.getNodeParameter('operation', 0);
          const resource = this.getNodeParameter('resource', 0);
          const fullOperation = `${resource}:${operation}`;
          for (let i = 0; i < items.length; i++) {
              try {
                  requestMethod = 'GET';
                  endpoint = '';
                  body = {};
                  qs = {};
                  let owner = this.getNodeParameter('owner', i);
                  owner = owner.replace(new RegExp(/\//g), '%2F');
                  let repository = '';
                  if (fullOperation !== 'user:getRepositories') {
                      repository = this.getNodeParameter('repository', i);
                  }
                  const baseEndpoint = `/projects/${owner}%2F${repository}`;
                  if (resource === 'issue') {
                      if (operation === 'create') {
                          requestMethod = 'POST';
                          body.title = this.getNodeParameter('title', i);
                          body.description = this.getNodeParameter('body', i);
                          body.due_date = this.getNodeParameter('due_date', i);
                          const labels = this.getNodeParameter('labels', i);
                          const assigneeIds = this.getNodeParameter('assignee_ids', i);
                          body.labels = labels.map((data) => data.label).join(',');
                          body.assignee_ids = assigneeIds.map((data) => data.assignee);
                          endpoint = `${baseEndpoint}/issues`;
                      }
                      else if (operation === 'createComment') {
                          requestMethod = 'POST';
                          const issueNumber = this.getNodeParameter('issueNumber', i);
                          body.body = this.getNodeParameter('body', i);
                          endpoint = `${baseEndpoint}/issues/${issueNumber}/notes`;
                      }
                      else if (operation === 'edit') {
                          requestMethod = 'PUT';
                          const issueNumber = this.getNodeParameter('issueNumber', i);
                          body = this.getNodeParameter('editFields', i, {});
                          if (body.labels !== undefined) {
                              body.labels = body.labels.map((data) => data.label).join(',');
                          }
                          if (body.assignee_ids !== undefined) {
                              body.assignee_ids = body.assignee_ids.map((data) => data.assignee);
                          }
                          endpoint = `${baseEndpoint}/issues/${issueNumber}`;
                      }
                      else if (operation === 'get') {
                          requestMethod = 'GET';
                          const issueNumber = this.getNodeParameter('issueNumber', i);
                          endpoint = `${baseEndpoint}/issues/${issueNumber}`;
                      }
                      else if (operation === 'lock') {
                          requestMethod = 'PUT';
                          const issueNumber = this.getNodeParameter('issueNumber', i);
                          body.discussion_locked = true;
                          endpoint = `${baseEndpoint}/issues/${issueNumber}`;
                      }
                  }
                  else if (resource === 'release') {
                      if (operation === 'create') {
                          requestMethod = 'POST';
                          body = this.getNodeParameter('additionalFields', i, {});
                          body.tag_name = this.getNodeParameter('releaseTag', i);
                          endpoint = `${baseEndpoint}/releases`;
                      }
                      if (operation === 'delete') {
                          requestMethod = 'DELETE';
                          const id = this.getNodeParameter('projectId', i);
                          const tagName = this.getNodeParameter('tag_name', i);
                          endpoint = `/projects/${id}/releases/${tagName}`;
                      }
                      if (operation === 'get') {
                          requestMethod = 'GET';
                          const id = this.getNodeParameter('projectId', i);
                          const tagName = this.getNodeParameter('tag_name', i);
                          endpoint = `/projects/${id}/releases/${tagName}`;
                      }
                      if (operation === 'getAll') {
                          requestMethod = 'GET';
                          const id = this.getNodeParameter('projectId', i);
                          qs = this.getNodeParameter('additionalFields', i, {});
                          returnAll = this.getNodeParameter('returnAll', 0);
                          if (!returnAll) {
                              qs.per_page = this.getNodeParameter('limit', 0);
                          }
                          endpoint = `/projects/${id}/releases`;
                      }
                      if (operation === 'update') {
                          requestMethod = 'PUT';
                          const id = this.getNodeParameter('projectId', i);
                          const tagName = this.getNodeParameter('tag_name', i);
                          body = this.getNodeParameter('additionalFields', i, {});
                          if (body.milestones) {
                              body.milestones = body.milestones.split(',');
                          }
                          endpoint = `/projects/${id}/releases/${tagName}`;
                      }
                  }
                  else if (resource === 'repository') {
                      if (operation === 'get') {
                          requestMethod = 'GET';
                          endpoint = `${baseEndpoint}`;
                      }
                      else if (operation === 'getIssues') {
                          requestMethod = 'GET';
                          qs = this.getNodeParameter('getRepositoryIssuesFilters', i);
                          endpoint = `${baseEndpoint}/issues`;
                      }
                  }
                  else if (resource === 'user') {
                      if (operation === 'getRepositories') {
                          requestMethod = 'GET';
                          endpoint = `/users/${owner}/projects`;
                      }
                  }
                  else if (resource === 'file') {
                      if (['create', 'edit'].includes(operation)) {
                          requestMethod = operation === 'create' ? 'POST' : 'PUT';
                          const filePath = this.getNodeParameter('filePath', i);
                          const additionalParameters = this.getNodeParameter('additionalParameters', i);
                          body.branch = this.getNodeParameter('branch', i);
                          body.commit_message = this.getNodeParameter('commitMessage', i);
                          if (additionalParameters.author) {
                              body.author = additionalParameters.author;
                          }
                          if (additionalParameters.branchStart &&
                              additionalParameters.branchStart.branchStart) {
                              body.start_branch = additionalParameters.branchStart.branchStart;
                          }
                          if (this.getNodeParameter('binaryData', i)) {
                              const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                              const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                              body.content = binaryData.data;
                              body.encoding = 'base64';
                          }
                          else {
                              if (additionalParameters.encoding === 'base64') {
                                  body.content = Buffer.from(this.getNodeParameter('fileContent', i)).toString('base64');
                              }
                              else {
                                  body.content = this.getNodeParameter('fileContent', i);
                              }
                          }
                          endpoint = `${baseEndpoint}/repository/files/${encodeURIComponent(filePath)}`;
                      }
                      else if (operation === 'delete') {
                          requestMethod = 'DELETE';
                          const additionalParameters = this.getNodeParameter('additionalParameters', i, {});
                          if (additionalParameters.author) {
                              body.author = additionalParameters.author;
                          }
                          body.branch = this.getNodeParameter('branch', i);
                          body.commit_message = this.getNodeParameter('commitMessage', i);
                          const filePath = this.getNodeParameter('filePath', i);
                          endpoint = `${baseEndpoint}/repository/files/${encodeURIComponent(filePath)}`;
                      }
                      else if (operation === 'get') {
                          requestMethod = 'GET';
                          const filePath = this.getNodeParameter('filePath', i);
                          const additionalParameters = this.getNodeParameter('additionalParameters', i);
                          if (additionalParameters.reference) {
                              qs.ref = additionalParameters.reference;
                          }
                          else {
                              qs.ref = 'master';
                          }
                          endpoint = `${baseEndpoint}/repository/files/${encodeURIComponent(filePath)}`;
                      }
                      else if (operation === 'list') {
                          requestMethod = 'GET';
                          const filePath = this.getNodeParameter('filePath', i);
                          qs = this.getNodeParameter('additionalParameters', i, {});
                          returnAll = this.getNodeParameter('returnAll', i);
                          if (!returnAll) {
                              qs.per_page = this.getNodeParameter('limit', i);
                              qs.page = this.getNodeParameter('page', i);
                          }
                          if (filePath) {
                              qs.path = filePath;
                          }
                          endpoint = `${baseEndpoint}/repository/tree`;
                      }
                  }
                  else {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, {
                          itemIndex: i,
                      });
                  }
                  const asBinaryProperty = this.getNodeParameter('asBinaryProperty', i, false);
                  if (returnAll) {
                      responseData = await GenericFunctions_1.gitlabApiRequestAllItems.call(this, requestMethod, endpoint, body, qs);
                  }
                  else {
                      responseData = await GenericFunctions_1.gitlabApiRequest.call(this, requestMethod, endpoint, body, qs);
                  }
                  if (fullOperation === 'file:get' && asBinaryProperty) {
                      if (Array.isArray(responseData) && responseData.length > 1) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'File Path is a folder, not a file.', {
                              itemIndex: i,
                          });
                      }
                      const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                      const newItem = {
                          json: items[i].json,
                          binary: {},
                      };
                      if (items[i].binary !== undefined) {
                          Object.assign(newItem.binary, items[i].binary);
                      }
                      const { content, path } = responseData;
                      newItem.binary[binaryPropertyName] = await this.helpers.prepareBinaryData(Buffer.from(content, 'base64'), path);
                      items[i] = newItem;
                      return [items];
                  }
                  if (overwriteDataOperations.includes(fullOperation) ||
                      overwriteDataOperationsArray.includes(fullOperation)) {
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      if (overwriteDataOperations.includes(fullOperation) ||
                          overwriteDataOperationsArray.includes(fullOperation)) {
                          const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                          returnData.push(...executionErrorData);
                      }
                      else {
                          items[i].json = { error: error.message };
                      }
                      continue;
                  }
                  throw error;
              }
          }
          if (overwriteDataOperations.includes(fullOperation) ||
              overwriteDataOperationsArray.includes(fullOperation)) {
              return [returnData];
          }
          else {
              return [items];
          }
      }
  }
  exports.Gitlab = Gitlab;
  //# sourceMappingURL=Gitlab.node.js.map

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

  # GitLab Trigger node

  [GitLab](https://gitlab.com/){:target=_blank .external-link} is a web-based DevOps lifecycle tool that provides a Git-repository manager providing wiki, issue-tracking, and continuous integration/continuous installation pipeline features.

  /// note | Credentials
  You can find authentication information for this node [here](/integrations/builtin/credentials/gitlab.md).
  ///

  ///  note  | Examples and templates
  For usage examples and templates to help you get started, refer to n8n's [GitLab Trigger integrations](https://n8n.io/integrations/gitlab-trigger/){:target=_blank .external-link} page.
  ///

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"9aa6e28e-e2b7-4ad8-94de-49cc851e86ee","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"44640cf41149e9dc194282b0c6897f51e296f43efe477cb3bf73d9090a440c80"}}


