# nodes

node_type: n8n-nodes-base.Shopify
name: Shopify
display_name: Shopify
description: Consume Shopify API
category: output
icon: file:shopify.svg
code_hash: c9006b14af5d35b4e773b5812c0f324f95620663fb6b23c928b1c58ccc43a99c
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.shopifytrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:28
updated_at: 2025-06-08 09:18:28
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Shopify = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const OrderDescription_1 = require("./OrderDescription");
  const ProductDescription_1 = require("./ProductDescription");
  class Shopify {
      constructor() {
          this.description = {
              displayName: 'Shopify',
              name: 'shopify',
              icon: 'file:shopify.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Shopify API',
              defaults: {
                  name: 'Shopify',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'shopifyApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['apiKey'],
                          },
                      },
                  },
                  {
                      name: 'shopifyAccessTokenApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['accessToken'],
                          },
                      },
                  },
                  {
                      name: 'shopifyOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth2'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'Access Token',
                              value: 'accessToken',
                          },
                          {
                              name: 'OAuth2',
                              value: 'oAuth2',
                          },
                          {
                              name: 'API Key',
                              value: 'apiKey',
                          },
                      ],
                      default: 'apiKey',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Order',
                              value: 'order',
                          },
                          {
                              name: 'Product',
                              value: 'product',
                          },
                      ],
                      default: 'order',
                  },
                  ...OrderDescription_1.orderOperations,
                  ...OrderDescription_1.orderFields,
                  ...ProductDescription_1.productOperations,
                  ...ProductDescription_1.productFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getProducts() {
                      const returnData = [];
                      const products = await GenericFunctions_1.shopifyApiRequestAllItems.call(this, 'products', 'GET', '/products.json', {}, { fields: 'id,title' });
                      for (const product of products) {
                          const productName = product.title;
                          const productId = product.id;
                          returnData.push({
                              name: productName,
                              value: productId,
                          });
                      }
                      return returnData;
                  },
                  async getLocations() {
                      const returnData = [];
                      const locations = await GenericFunctions_1.shopifyApiRequestAllItems.call(this, 'locations', 'GET', '/locations.json', {}, { fields: 'id,name' });
                      for (const location of locations) {
                          const locationName = location.name;
                          const locationId = location.id;
                          returnData.push({
                              name: locationName,
                              value: locationId,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          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++) {
              try {
                  if (resource === 'order') {
                      if (operation === 'create') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const discount = additionalFields.discountCodesUi;
                          const billing = additionalFields.billingAddressUi;
                          const shipping = additionalFields.shippingAddressUi;
                          const lineItem = this.getNodeParameter('limeItemsUi', i)
                              .lineItemValues;
                          if (lineItem === undefined) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'At least one line item has to be added', { itemIndex: i });
                          }
                          const body = {
                              test: true,
                              line_items: (0, GenericFunctions_1.keysToSnakeCase)(lineItem),
                          };
                          if (additionalFields.fulfillmentStatus) {
                              body.fulfillment_status = additionalFields.fulfillmentStatus;
                          }
                          if (additionalFields.inventoryBehaviour) {
                              body.inventory_behaviour = additionalFields.inventoryBehaviour;
                          }
                          if (additionalFields.locationId) {
                              body.location_id = additionalFields.locationId;
                          }
                          if (additionalFields.note) {
                              body.note = additionalFields.note;
                          }
                          if (additionalFields.sendFulfillmentReceipt) {
                              body.send_fulfillment_receipt = additionalFields.sendFulfillmentReceipt;
                          }
                          if (additionalFields.sendReceipt) {
                              body.send_receipt = additionalFields.sendReceipt;
                          }
                          if (additionalFields.sendReceipt) {
                              body.send_receipt = additionalFields.sendReceipt;
                          }
                          if (additionalFields.sourceName) {
                              body.source_name = additionalFields.sourceName;
                          }
                          if (additionalFields.tags) {
                              body.tags = additionalFields.tags;
                          }
                          if (additionalFields.test) {
                              body.test = additionalFields.test;
                          }
                          if (additionalFields.email) {
                              body.email = additionalFields.email;
                          }
                          if (discount) {
                              body.discount_codes = discount.discountCodesValues;
                          }
                          if (billing) {
                              body.billing_address = (0, GenericFunctions_1.keysToSnakeCase)(billing.billingAddressValues)[0];
                          }
                          if (shipping) {
                              body.shipping_address = (0, GenericFunctions_1.keysToSnakeCase)(shipping.shippingAddressValues)[0];
                          }
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'POST', '/orders.json', {
                              order: body,
                          });
                          responseData = responseData.order;
                      }
                      if (operation === 'delete') {
                          const orderId = this.getNodeParameter('orderId', i);
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'DELETE', `/orders/${orderId}.json`);
                          responseData = { success: true };
                      }
                      if (operation === 'get') {
                          const orderId = this.getNodeParameter('orderId', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.fields) {
                              qs.fields = options.fields;
                          }
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'GET', `/orders/${orderId}.json`, {}, qs);
                          responseData = responseData.order;
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.fields) {
                              qs.fields = options.fields;
                          }
                          if (options.attributionAppId) {
                              qs.attribution_app_id = options.attributionAppId;
                          }
                          if (options.createdAtMin) {
                              qs.created_at_min = options.createdAtMin;
                          }
                          if (options.createdAtMax) {
                              qs.created_at_max = options.createdAtMax;
                          }
                          if (options.updatedAtMax) {
                              qs.updated_at_max = options.updatedAtMax;
                          }
                          if (options.updatedAtMin) {
                              qs.updated_at_min = options.updatedAtMin;
                          }
                          if (options.processedAtMin) {
                              qs.processed_at_min = options.processedAtMin;
                          }
                          if (options.processedAtMax) {
                              qs.processed_at_max = options.processedAtMax;
                          }
                          if (options.sinceId) {
                              qs.since_id = options.sinceId;
                          }
                          if (options.ids) {
                              qs.ids = options.ids;
                          }
                          if (options.status) {
                              qs.status = options.status;
                          }
                          if (options.financialStatus) {
                              qs.financial_status = options.financialStatus;
                          }
                          if (options.fulfillmentStatus) {
                              qs.fulfillment_status = options.fulfillmentStatus;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.shopifyApiRequestAllItems.call(this, 'orders', 'GET', '/orders.json', {}, qs);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'GET', '/orders.json', {}, qs);
                              responseData = responseData.orders;
                          }
                      }
                      if (operation === 'update') {
                          const orderId = this.getNodeParameter('orderId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const shipping = updateFields.shippingAddressUi;
                          const body = {};
                          if (updateFields.locationId) {
                              body.location_id = updateFields.locationId;
                          }
                          if (updateFields.note) {
                              body.note = updateFields.note;
                          }
                          if (updateFields.sourceName) {
                              body.source_name = updateFields.sourceName;
                          }
                          if (updateFields.tags) {
                              body.tags = updateFields.tags;
                          }
                          if (updateFields.email) {
                              body.email = updateFields.email;
                          }
                          if (shipping) {
                              body.shipping_address = (0, GenericFunctions_1.keysToSnakeCase)(shipping.shippingAddressValues)[0];
                          }
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'PUT', `/orders/${orderId}.json`, {
                              order: body,
                          });
                          responseData = responseData.order;
                      }
                  }
                  else if (resource === 'product') {
                      const productId = this.getNodeParameter('productId', i, '');
                      let body = {};
                      if (operation === 'create') {
                          const title = this.getNodeParameter('title', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i, {});
                          if (additionalFields.productOptions) {
                              const metadata = additionalFields.productOptions
                                  .option;
                              additionalFields.options = {};
                              for (const data of metadata) {
                                  additionalFields.options[data.name] = data.value;
                              }
                              delete additionalFields.productOptions;
                          }
                          body = additionalFields;
                          body.title = title;
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'POST', '/products.json', {
                              product: body,
                          });
                          responseData = responseData.product;
                      }
                      if (operation === 'delete') {
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'DELETE', `/products/${productId}.json`);
                          responseData = { success: true };
                      }
                      if (operation === 'get') {
                          const additionalFields = this.getNodeParameter('additionalFields', i, {});
                          Object.assign(qs, additionalFields);
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'GET', `/products/${productId}.json`, {}, qs);
                          responseData = responseData.product;
                      }
                      if (operation === 'getAll') {
                          const additionalFields = this.getNodeParameter('additionalFields', i, {});
                          const returnAll = this.getNodeParameter('returnAll', i);
                          Object.assign(qs, additionalFields);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.shopifyApiRequestAllItems.call(this, 'products', 'GET', '/products.json', {}, qs);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'GET', '/products.json', {}, qs);
                              responseData = responseData.products;
                          }
                      }
                      if (operation === 'update') {
                          const updateFields = this.getNodeParameter('updateFields', i, {});
                          if (updateFields.productOptions) {
                              const metadata = updateFields.productOptions.option;
                              updateFields.options = {};
                              for (const data of metadata) {
                                  updateFields.options[data.name] = data.value;
                              }
                              delete updateFields.productOptions;
                          }
                          body = updateFields;
                          responseData = await GenericFunctions_1.shopifyApiRequest.call(this, 'PUT', `/products/${productId}.json`, { product: body });
                          responseData = responseData.product;
                      }
                  }
                  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.Shopify = Shopify;
  //# sourceMappingURL=Shopify.node.js.map

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

  # Shopify Trigger node

  [Shopify](https://www.shopify.com/){:target=_blank .external-link} is an e-commerce platform that allows users to set up an online store and sell their products.

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

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"df469fd1-d4a7-4342-93fa-0e10372dad5b","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"b11f5ddd1bdb65e8e45900af10c9a6f4216f4483b01f22d8f4ae66c4669a9194"}}


node_type: n8n-nodes-base.Slack
name: Slack
display_name: Slack
description: Consume Slack API
category: output
icon: file:slack.svg
code_hash: 0ed10d0646f3c595406359edfa2c293dac41991cee59ad4fb3ccf2bb70eca6fc
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.slacktrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 09:18:28
updated_at: 2025-06-08 09:18:28
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Slack = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const SlackV1_node_1 = require("./V1/SlackV1.node");
  const SlackV2_node_1 = require("./V2/SlackV2.node");
  class Slack extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'Slack',
              name: 'slack',
              icon: 'file:slack.svg',
              group: ['output'],
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Slack API',
              defaultVersion: 2.1,
          };
          const nodeVersions = {
              1: new SlackV1_node_1.SlackV1(baseDescription),
              2: new SlackV2_node_1.SlackV2(baseDescription),
              2.1: new SlackV2_node_1.SlackV2(baseDescription),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.Slack = Slack;
  //# sourceMappingURL=Slack.node.js.map

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

  # Slack Trigger node

  Use the Slack Trigger node to respond to events in [Slack](https://slack.com/){:target=_blank .external-link} and integrate Slack with other applications. n8n has built-in support for a wide range of Slack events, including new messages, reactions, and new channels.

  On this page, you'll find a list of events the Slack Trigger node can respond to and links to more resources.

  ///  note  | Credentials
  You can find authentication information for this node [here](/integrations/builtin/credentials/slack.md).
  ///
  ///  note  | Examples and templates
  For usage examples and templates to help you get started, refer to n8n's [Slack integrations](https://n8n.io/integrations/slack-trigger/){:target=_blank .external-link} page.
  ///

  ## Events

  * **Any Event**: The node triggers on any event in Slack.
  * **Bot / App Mention**: The node triggers when your bot or app is [mentioned](https://slack.com/help/articles/205240127-Use-mentions-in-Slack){:target=_blank .external-link} in a channel the app is in.
  * **File Made Public**: The node triggers when a file is [made public](https://slack.com/help/articles/4412651915539-Manage-public-file-sharing){:target=_blank .external-link}.
  * **File Shared**: The node triggers when a file is [shared](https://slack.com/help/articles/201330736-Add-files-to-Slack){:target=_blank .external-link} in a channel the app is in.
  * **New Message Posted to Channel**: The node triggers when a new message is posted to a channel the app is in.
  * **New Public Channel Created**: The node triggers when a new [public channel](https://slack.com/help/articles/360017938993-What-is-a-channel){:target=_blank .external-link} is created.
  * **New User**: The node triggers when a new user is added to Slack.
  * **Reaction Added**: The node triggers when a [reaction](https://slack.com/help/articles/202931348-Use-emoji-and-reactions){:target=_blank .external-link} is added to a message the app is added to.

  ## Parameters

  Once you've set the events to trigger on, use the remaining parameters to further define the node's behavior:

  * **Watch Whole Workspace**: Whether the node should watch for the selected **Events** in all channels in the workspace (turned on) or not (turned off, default).

      ///warning | Caution
      This will use one execution for every event in any channel your bot or app is in. Use with caution!
      ///

  * **Channel to Watch**: Select the channel your node should watch for the selected **Events**. This parameter only appears if you don't turn on **Watch Whole Workspace**. You can select a channel:
      * **From list**: The node uses your credential to look up a list of channels in the workspace so you can select the channel you want.
      * **By ID**: Enter the ID of a channel you want to watch. Slack displays the channel ID at the bottom of the channel details with a one-click copy button.
      * **By URL**: Enter the URL of the channel you want to watch, formatted as `https://app.slack.com/client/<channel-address>`.
  * **Download Files**: Whether to download files and use them in the node's output (turned on) or not (turned off, default). Use this parameter with the **File Made Public** and **File Shared** events.

  ## Options

  You can further refine the node's behavior when you **Add Option**s:

  * **Resolve IDs**: Whether to resolve the IDs to their respective names and return them (turned on) or not (turned off, default).
  * **Usernames or IDs to ignore**: Select usernames or enter a comma-separated string of encoded user IDs to ignore events from. Choose from the list, or specify IDs using an [expression](/code/expressions.md).

  ## Related resources

  n8n provides an app node for Slack. You can find the node docs [here](/integrations/builtin/app-nodes/n8n-nodes-base.slack.md).

  View [example workflows and related content](https://n8n.io/integrations/slack-trigger/){:target=_blank .external-link} on n8n's website.

  Refer to [Slack's documentation](https://api.slack.com/apis/connections/events-api){:target=_blank .external-link} for details about their API.

  ## Required scopes

  To use this node, you need to create an application in Slack and enable event subscriptions. Refer to [Slack credentials | Slack Trigger configuration](/integrations/builtin/credentials/slack.md#slack-trigger-configuration) for more information.

  You must add the appropriate scopes to your Slack app for this trigger node to work.

  The node requires scopes for the [conversations.list](https://api.slack.com/methods/conversations.list){:target=blank .external-link} and [users.list](https://api.slack.com/methods/users.list){:target=blank .external-link} methods at minimum. Check out the [Scopes | Slack credentials](/integrations/builtin/credentials/slack.md#scopes) list for a more complete list of scopes.

  ## Common issues

  Here are some common errors and issues with the Slack Trigger node and steps to resolve or troubleshoot them.

  ### Workflow only works in testing or production

  Slack only allows you to register a single webhook per app. This means that you can't switch from using the testing URL to the production URL (and vice versa) without reconfiguring the registered webhook URL. 

  You may have trouble with this if you try to test a workflow that's also active in production. Slack will only send events to one of the two webhook URLs, so the other will never receive event notifications.

  To work around this, you can disable your workflow when testing:

  /// warning | Halts production traffic
  This temporarily disables your production workflow for testing. Your workflow will no longer receive production traffic while it's deactivated.
  ///

  1. Go to your workflow page.
  2. Toggle the **Active** switch in the top panel to disable the workflow temporarily.
  3. Edit the **Request URL** in your the [Slack Trigger configuration](/integrations/builtin/credentials/slack.md#slack-trigger-configuration) to use the testing webhook URL instead of the production webhook URL.
  4. Test your workflow using the test webhook URL.
  5. When you finish testing, edit the **Request URL** in your the [Slack Trigger configuration](/integrations/builtin/credentials/slack.md#slack-trigger-configuration) to use the production webhook URL instead of the testing webhook URL.
  6. Toggle the **Inactive** toggle to enable the workflow again. The production webhook URL should resume working.

  ### Token expired

  --8<-- "_snippets/integrations/builtin/credentials/slack/token-rotation.md"

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"cde1c29f-45ed-40d4-9704-0a6091d19150","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"fb862f493db98026c1429e3ed0b17fee1c9978067a3b503a9ced9d05a1a5c5f3"}}


node_type: n8n-nodes-base.Snowflake
name: Snowflake
display_name: Snowflake
description: Get, add and update data in Snowflake
category: input
icon: file:snowflake.svg
code_hash: 500143dab0de2d112b6848ed3cc32c7b191fca0b0aa4323cb3c8b7da66b93cc4
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.snowflake
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:29
updated_at: 2025-06-08 09:18:29
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.Snowflake = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const snowflake_sdk_1 = __importDefault(require("snowflake-sdk"));
  const utilities_1 = require("../../utils/utilities");
  class Snowflake {
      constructor() {
          this.description = {
              displayName: 'Snowflake',
              name: 'snowflake',
              icon: 'file:snowflake.svg',
              group: ['input'],
              version: 1,
              description: 'Get, add and update data in Snowflake',
              defaults: {
                  name: 'Snowflake',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'snowflake',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Execute Query',
                              value: 'executeQuery',
                              description: 'Execute an SQL query',
                              action: 'Execute a SQL query',
                          },
                          {
                              name: 'Insert',
                              value: 'insert',
                              description: 'Insert rows in database',
                              action: 'Insert rows in database',
                          },
                          {
                              name: 'Update',
                              value: 'update',
                              description: 'Update rows in database',
                              action: 'Update rows in database',
                          },
                      ],
                      default: 'insert',
                  },
                  {
                      displayName: 'Query',
                      name: 'query',
                      type: 'string',
                      noDataExpression: true,
                      typeOptions: {
                          editor: 'sqlEditor',
                          rows: 5,
                      },
                      displayOptions: {
                          show: {
                              operation: ['executeQuery'],
                          },
                      },
                      default: '',
                      placeholder: 'SELECT id, name FROM product WHERE id < 40',
                      required: true,
                      description: 'The SQL query to execute',
                  },
                  {
                      displayName: 'Table',
                      name: 'table',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['insert'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Name of the table in which to insert data to',
                  },
                  {
                      displayName: 'Columns',
                      name: 'columns',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['insert'],
                          },
                      },
                      default: '',
                      placeholder: 'id,name,description',
                      description: 'Comma-separated list of the properties which should used as columns for the new rows',
                  },
                  {
                      displayName: 'Table',
                      name: 'table',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['update'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Name of the table in which to update data in',
                  },
                  {
                      displayName: 'Update Key',
                      name: 'updateKey',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['update'],
                          },
                      },
                      default: 'id',
                      required: true,
                      description: 'Name of the property which decides which rows in the database should be updated. Normally that would be "id".',
                  },
                  {
                      displayName: 'Columns',
                      name: 'columns',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['update'],
                          },
                      },
                      default: '',
                      placeholder: 'name,description',
                      description: 'Comma-separated list of the properties which should used as columns for rows to update',
                  },
              ],
          };
      }
      async execute() {
          const credentials = (await this.getCredentials('snowflake'));
          const returnData = [];
          let responseData;
          const connection = snowflake_sdk_1.default.createConnection(credentials);
          await (0, GenericFunctions_1.connect)(connection);
          const items = this.getInputData();
          const operation = this.getNodeParameter('operation', 0);
          if (operation === 'executeQuery') {
              for (let i = 0; i < items.length; i++) {
                  let query = this.getNodeParameter('query', i);
                  for (const resolvable of (0, utilities_1.getResolvables)(query)) {
                      query = query.replace(resolvable, this.evaluateExpression(resolvable, i));
                  }
                  responseData = await (0, GenericFunctions_1.execute)(connection, query, []);
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                  returnData.push(...executionData);
              }
          }
          if (operation === 'insert') {
              const table = this.getNodeParameter('table', 0);
              const columnString = this.getNodeParameter('columns', 0);
              const columns = columnString.split(',').map((column) => column.trim());
              const query = `INSERT INTO ${table}(${columns.join(',')}) VALUES (${columns
                  .map((_column) => '?')
                  .join(',')})`;
              const data = this.helpers.copyInputItems(items, columns);
              const binds = data.map((element) => Object.values(element));
              await (0, GenericFunctions_1.execute)(connection, query, binds);
              data.forEach((d, i) => {
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(d), { itemData: { item: i } });
                  returnData.push(...executionData);
              });
          }
          if (operation === 'update') {
              const table = this.getNodeParameter('table', 0);
              const updateKey = this.getNodeParameter('updateKey', 0);
              const columnString = this.getNodeParameter('columns', 0);
              const columns = columnString.split(',').map((column) => column.trim());
              if (!columns.includes(updateKey)) {
                  columns.unshift(updateKey);
              }
              const query = `UPDATE ${table} SET ${columns
                  .map((column) => `${column} = ?`)
                  .join(',')} WHERE ${updateKey} = ?;`;
              const data = this.helpers.copyInputItems(items, columns);
              const binds = data.map((element) => Object.values(element).concat(element[updateKey]));
              for (let i = 0; i < binds.length; i++) {
                  await (0, GenericFunctions_1.execute)(connection, query, binds[i]);
              }
              data.forEach((d, i) => {
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(d), { itemData: { item: i } });
                  returnData.push(...executionData);
              });
          }
          await (0, GenericFunctions_1.destroy)(connection);
          return [returnData];
      }
  }
  exports.Snowflake = Snowflake;
  //# sourceMappingURL=Snowflake.node.js.map

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

  # Snowflake node

  Use the Snowflake node to automate work in Snowflake, and integrate Snowflake with other applications. n8n has built-in support for a wide range of Snowflake features, including executing SQL queries, and inserting rows in a database. 

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

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

  ## Operations

  * Execute an SQL query.
  * Insert rows in database.
  * Update rows in database.

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"319b69f6-e113-4b15-b0c7-eb2142d9ac42","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"c4eb7279079b379cc75a24632699a5ce249e3494e2d4a6908035863d07ebc711"}}


node_type: n8n-nodes-base.SplitInBatches
name: SplitInBatches
display_name: Split In Batches
description: Split data into batches and iterate over each batch
category: organization
icon: fa:th-large
code_hash: c751422a11e30bf361a6c4803376289740a40434aeb77f90e18cd4dd7ba5c019
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.splitinbatches
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 09:18:29
updated_at: 2025-06-08 09:18:29
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SplitInBatches = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const SplitInBatchesV1_node_1 = require("./v1/SplitInBatchesV1.node");
  const SplitInBatchesV2_node_1 = require("./v2/SplitInBatchesV2.node");
  const SplitInBatchesV3_node_1 = require("./v3/SplitInBatchesV3.node");
  class SplitInBatches extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'Split In Batches',
              name: 'splitInBatches',
              icon: 'fa:th-large',
              group: ['organization'],
              description: 'Split data into batches and iterate over each batch',
              defaultVersion: 3,
          };
          const nodeVersions = {
              1: new SplitInBatchesV1_node_1.SplitInBatchesV1(),
              2: new SplitInBatchesV2_node_1.SplitInBatchesV2(),
              3: new SplitInBatchesV3_node_1.SplitInBatchesV3(),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.SplitInBatches = SplitInBatches;
  //# sourceMappingURL=SplitInBatches.node.js.map

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

  # Loop Over Items

  The Loop Over Items node helps you loop through data when needed.

  The node saves the original incoming data, and with each iteration, returns a predefined amount of data through the **loop** output.

  When the node execution completes, it combines all of the processed data and returns it through the **done** output.

  ## When to use the Loop Over Items node

  By default, n8n nodes are designed to process a list of input items (with some exceptions, detailed below). Depending on what you're trying to achieve, you often don't need the Loop Over Items node in your workflow. You can learn more about how n8n processes multiple items on the [looping in n8n](/flow-logic/looping.md) page.

  These links highlight some of the cases where the Loop Over Items node can be useful:

  * [Loop until all items are processed](/flow-logic/looping.md#loop-until-all-items-are-processed): describes how the Loop Over Items node differs from normal item processing and when you might want to incorporate this node.
  * [Node exceptions](/flow-logic/looping.md#node-exceptions): outlines specific cases and nodes where you may need to use the Loop Over Items node to manually build looping logic.
  * [Avoiding rate limiting](/integrations/builtin/rate-limits.md): demonstrates how to batch API requests to avoid rate limits from other services.

  ## Node parameters

  ### Batch Size

  Enter the number of items to return with each call.

  ## Node options

  ### Reset

  If turned on, the node will reset with the current input-data newly initialized with each loop. Use this when you want the Loop Over Items node to treat incoming data as a new set of data instead of a continuation of previous items.

  For example, you can use the Loop Over Items node with the reset option and an [If node](/integrations/builtin/core-nodes/n8n-nodes-base.if.md) to query a paginated service when you don't know how many pages you need in advance. The loop queries pages one at a time, performs any processing, and increments the page number. The loop reset ensures the loop recognizes each iteration as a new set of data. The If node evaluates an exit condition to decide whether to perform another iteration or not.

  /// warning | Include a valid termination condition
  For workflows like the example described above, it's critical to include a valid termination condition for the loop. If your termination condition never matches, your workflow execution will get stuck in an infinite loop.
  ///

  When enabled, you can adjust the reset conditions by switching the parameter representation from **Fixed** to **Expression**. The results of your expression evaluation determine when the node will reset item processing.

  ## Templates and examples

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

  ### Read RSS feed from two different sources

  This workflow allows you to read an RSS feed from two different sources using the Loop Over Items node. You need the Loop Over Items node in the workflow as the RSS Feed Read node only processes the first item it receives. You can also find the [workflow](https://n8n.io/workflows/687-read-rss-feed-from-two-different-sources/){:target=_blank .external-link} on n8n.io.

  The example walks through building the workflow, but assumes you are already familiar with n8n. To build your first workflow, including learning how to add nodes to a workflow, refer to [Try it out](/try-it-out/index.md).

  The final workflow looks like this:

  [[ workflowDemo("file:///integrations/builtin/core-nodes/n8n-nodes-base.splitinbatches/rss-feed-example.json") ]]

  Copy the workflow file above and paste into your instance, or manually build it by following these steps:

  1. Add the manual trigger.
  2. Add the Code node.
  3. Copy this code into the Code node:
  	```js
  	return [
  		{
  			json: {
  				url: 'https://medium.com/feed/n8n-io',
  			}
  		},
  		{
  			json: {
  				url: 'https://dev.to/feed/n8n',
  			}
  		}
  	];
  	```
  4. Add the Loop Over Items node.
  5. Configure Loop Over Items: set the batch size to `1` in the **Batch Size** field.
  6. Add the RSS Feed Read node.
  7. Select **Test Workflow**. This runs the workflow to load data into the RSS Feed Read node.
  8. Configure RSS Feed Read: map `url` from the input to the **URL** field. You can do this by dragging and dropping from the **INPUT** panel, or using this expression: `{{ $json.url }}`.
  9. Select **Test Workflow** to run the workflow and see the resulting data.

  ### Check that the node has processed all items

  To check if the node still has items to process, use the following expression: `{{$node["Loop Over Items"].context["noItemsLeft"]}}`. This expression returns a boolean value. If the node still has data to process, the expression returns `false`, otherwise it returns `true`.

  ### Get the current running index of the node

  To get the current running index of the node, use the following expression: `{{$node["Loop Over Items"].context["currentRunIndex"];}}`.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"90888cb5-18d0-49ee-a810-440deb7022c1","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"0fcad9c86d7419a0c08e5df76b6ebf3a9f0a34f3b76df25b9d499efc2dfc5554"}}


node_type: n8n-nodes-base.Spontit
name: Spontit
display_name: Spontit
description: Consume Spontit API
category: output
icon: file:spontit.png
code_hash: 33769d94fd78408d188102c331b5795082646047dcc5544e182e4f3a11529f4d
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.spontit
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:29
updated_at: 2025-06-08 09:18:29
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.Spontit = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const PushDescription_1 = require("./PushDescription");
  const moment_1 = __importDefault(require("moment"));
  class Spontit {
      constructor() {
          this.description = {
              displayName: 'Spontit',
              name: 'spontit',
              icon: 'file:spontit.png',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Spontit API',
              defaults: {
                  name: 'Spontit',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'spontitApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Push',
                              value: 'push',
                          },
                      ],
                      default: 'push',
                  },
                  ...PushDescription_1.pushOperations,
                  ...PushDescription_1.pushFields,
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const timezone = this.getTimezone();
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'push') {
                      if (operation === 'create') {
                          const content = this.getNodeParameter('content', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              content,
                          };
                          Object.assign(body, additionalFields);
                          if (body.pushToFollowers) {
                              body.pushToFollowers = body.pushToFollowers.split(',');
                          }
                          if (body.pushToPhoneNumbers) {
                              body.pushToPhoneNumbers = body.pushToPhoneNumbers.split(',');
                          }
                          if (body.pushToEmails) {
                              body.pushToEmails = body.pushToEmails.split(',');
                          }
                          if (body.schedule) {
                              body.scheduled = moment_1.default.tz(body.schedule, timezone).unix();
                          }
                          if (body.expirationStamp) {
                              body.expirationStamp = moment_1.default.tz(body.expirationStamp, timezone).unix();
                          }
                          responseData = await GenericFunctions_1.spontitApiRequest.call(this, 'POST', '/push', body);
                          responseData = responseData.data;
                      }
                  }
                  if (Array.isArray(responseData)) {
                      returnData.push.apply(returnData, responseData);
                  }
                  else if (responseData !== undefined) {
                      returnData.push(responseData);
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ error: error.message });
                      continue;
                  }
                  throw error;
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Spontit = Spontit;
  //# sourceMappingURL=Spontit.node.js.map

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

  # Spontit node

  Use the Spontit node to automate work in Spontit, and integrate Spontit with other applications. n8n supports creating push notifications with Spontit. 

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

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

  ## Operations

  * Push
      * Create a push notification

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"212d0a86-8c78-4f23-9d1c-d8887d406122","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"9f0985a637d4a1c14b624670b85b19accfea6d5ad4de05c5bf420cdb467f9255"}}


node_type: n8n-nodes-base.Splunk
name: Splunk
display_name: Splunk
description: Consume the Splunk Enterprise API
category: transform
icon: file:splunk.svg
code_hash: 8970779a0ac1a63e37de3d5c596afa6149c66570fc8fc6f0f3a952c70a600f74
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.splunk
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:29
updated_at: 2025-06-08 09:18:29
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Splunk = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const descriptions_1 = require("./descriptions");
  class Splunk {
      constructor() {
          this.description = {
              displayName: 'Splunk',
              name: 'splunk',
              icon: 'file:splunk.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the Splunk Enterprise API',
              defaults: {
                  name: 'Splunk',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'splunkApi',
                      required: true,
                      testedBy: 'splunkApiTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Fired Alert',
                              value: 'firedAlert',
                          },
                          {
                              name: 'Search Configuration',
                              value: 'searchConfiguration',
                          },
                          {
                              name: 'Search Job',
                              value: 'searchJob',
                          },
                          {
                              name: 'Search Result',
                              value: 'searchResult',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                      ],
                      default: 'searchJob',
                  },
                  ...descriptions_1.firedAlertOperations,
                  ...descriptions_1.searchConfigurationOperations,
                  ...descriptions_1.searchConfigurationFields,
                  ...descriptions_1.searchJobOperations,
                  ...descriptions_1.searchJobFields,
                  ...descriptions_1.searchResultOperations,
                  ...descriptions_1.searchResultFields,
                  ...descriptions_1.userOperations,
                  ...descriptions_1.userFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getRoles() {
                      const endpoint = '/services/authorization/roles';
                      const responseData = (await GenericFunctions_1.splunkApiRequest.call(this, 'GET', endpoint));
                      const { entry: entries } = responseData.feed;
                      return Array.isArray(entries)
                          ? entries.map((entry) => ({ name: entry.title, value: entry.title }))
                          : [{ name: entries.title, value: entries.title }];
                  },
              },
              credentialTest: {
                  async splunkApiTest(credential) {
                      const { authToken, baseUrl, allowUnauthorizedCerts } = credential.data;
                      const endpoint = '/services/alerts/fired_alerts';
                      const options = {
                          headers: {
                              Authorization: `Bearer ${authToken}`,
                              'Content-Type': 'application/x-www-form-urlencoded',
                          },
                          method: 'GET',
                          form: {},
                          qs: {},
                          uri: `${baseUrl}${endpoint}`,
                          json: true,
                          rejectUnauthorized: !allowUnauthorizedCerts,
                      };
                      try {
                          await this.helpers.request(options);
                          return {
                              status: 'OK',
                              message: 'Authentication successful',
                          };
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                  },
              },
          };
      }
      async execute() {
          var _a;
          const items = this.getInputData();
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          let responseData;
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'firedAlert') {
                      if (operation === 'getReport') {
                          const endpoint = '/services/alerts/fired_alerts';
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'GET', endpoint).then(GenericFunctions_1.formatFeed);
                      }
                  }
                  else if (resource === 'searchConfiguration') {
                      if (operation === 'delete') {
                          const partialEndpoint = '/services/saved/searches/';
                          const searchConfigurationId = GenericFunctions_1.getId.call(this, i, 'searchConfigurationId', '/search/saved/searches/');
                          const endpoint = `${partialEndpoint}/${searchConfigurationId}`;
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const partialEndpoint = '/services/saved/searches/';
                          const searchConfigurationId = GenericFunctions_1.getId.call(this, i, 'searchConfigurationId', '/search/saved/searches/');
                          const endpoint = `${partialEndpoint}/${searchConfigurationId}`;
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'GET', endpoint).then(GenericFunctions_1.formatFeed);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const options = this.getNodeParameter('options', i);
                          (0, GenericFunctions_1.populate)(options, qs);
                          GenericFunctions_1.setCount.call(this, qs);
                          const endpoint = '/services/saved/searches';
                          responseData = await GenericFunctions_1.splunkApiRequest
                              .call(this, 'GET', endpoint, {}, qs)
                              .then(GenericFunctions_1.formatFeed);
                      }
                  }
                  else if (resource === 'searchJob') {
                      if (operation === 'create') {
                          const body = {
                              search: this.getNodeParameter('search', i),
                          };
                          const { earliest_time, latest_time, index_earliest, index_latest, ...rest } = this.getNodeParameter('additionalFields', i);
                          (0, GenericFunctions_1.populate)({
                              ...(earliest_time && { earliest_time: (0, GenericFunctions_1.toUnixEpoch)(earliest_time) }),
                              ...(latest_time && { latest_time: (0, GenericFunctions_1.toUnixEpoch)(latest_time) }),
                              ...(index_earliest && { index_earliest: (0, GenericFunctions_1.toUnixEpoch)(index_earliest) }),
                              ...(index_latest && { index_latest: (0, GenericFunctions_1.toUnixEpoch)(index_latest) }),
                              ...rest,
                          }, body);
                          const endpoint = '/services/search/jobs';
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'POST', endpoint, body);
                          const getEndpoint = `/services/search/jobs/${responseData.response.sid}`;
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'GET', getEndpoint).then(GenericFunctions_1.formatSearch);
                      }
                      else if (operation === 'delete') {
                          const partialEndpoint = '/services/search/jobs/';
                          const searchJobId = GenericFunctions_1.getId.call(this, i, 'searchJobId', partialEndpoint);
                          const endpoint = `${partialEndpoint}/${searchJobId}`;
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'DELETE', endpoint);
                      }
                      else if (operation === 'get') {
                          const partialEndpoint = '/services/search/jobs/';
                          const searchJobId = GenericFunctions_1.getId.call(this, i, 'searchJobId', partialEndpoint);
                          const endpoint = `${partialEndpoint}/${searchJobId}`;
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'GET', endpoint).then(GenericFunctions_1.formatSearch);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const options = this.getNodeParameter('options', i);
                          (0, GenericFunctions_1.populate)(options, qs);
                          GenericFunctions_1.setCount.call(this, qs);
                          const endpoint = '/services/search/jobs';
                          responseData = (await GenericFunctions_1.splunkApiRequest.call(this, 'GET', endpoint, {}, qs));
                          responseData = (0, GenericFunctions_1.formatFeed)(responseData);
                      }
                  }
                  else if (resource === 'searchResult') {
                      if (operation === 'getAll') {
                          const searchJobId = this.getNodeParameter('searchJobId', i);
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          const options = this.getNodeParameter('options', i);
                          const keyValuePair = (_a = filters === null || filters === void 0 ? void 0 : filters.keyValueMatch) === null || _a === void 0 ? void 0 : _a.keyValuePair;
                          if ((keyValuePair === null || keyValuePair === void 0 ? void 0 : keyValuePair.key) && (keyValuePair === null || keyValuePair === void 0 ? void 0 : keyValuePair.value)) {
                              qs.search = `search ${keyValuePair.key}=${keyValuePair.value}`;
                          }
                          (0, GenericFunctions_1.populate)(options, qs);
                          GenericFunctions_1.setCount.call(this, qs);
                          const endpoint = `/services/search/jobs/${searchJobId}/results`;
                          responseData = await GenericFunctions_1.splunkApiRequest
                              .call(this, 'GET', endpoint, {}, qs)
                              .then(GenericFunctions_1.formatResults);
                      }
                  }
                  else if (resource === 'user') {
                      if (operation === 'create') {
                          const roles = this.getNodeParameter('roles', i);
                          const body = {
                              name: this.getNodeParameter('name', i),
                              roles,
                              password: this.getNodeParameter('password', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          (0, GenericFunctions_1.populate)(additionalFields, body);
                          const endpoint = '/services/authentication/users';
                          responseData = (await GenericFunctions_1.splunkApiRequest.call(this, 'POST', endpoint, body));
                          responseData = (0, GenericFunctions_1.formatFeed)(responseData);
                      }
                      else if (operation === 'delete') {
                          const partialEndpoint = '/services/authentication/users';
                          const userId = GenericFunctions_1.getId.call(this, i, 'userId', partialEndpoint);
                          const endpoint = `${partialEndpoint}/${userId}`;
                          await GenericFunctions_1.splunkApiRequest.call(this, 'DELETE', endpoint);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const partialEndpoint = '/services/authentication/users/';
                          const userId = GenericFunctions_1.getId.call(this, i, 'userId', '/services/authentication/users/');
                          const endpoint = `${partialEndpoint}/${userId}`;
                          responseData = await GenericFunctions_1.splunkApiRequest.call(this, 'GET', endpoint).then(GenericFunctions_1.formatFeed);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          GenericFunctions_1.setCount.call(this, qs);
                          const endpoint = '/services/authentication/users';
                          responseData = await GenericFunctions_1.splunkApiRequest
                              .call(this, 'GET', endpoint, {}, qs)
                              .then(GenericFunctions_1.formatFeed);
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const { roles, ...rest } = this.getNodeParameter('updateFields', i);
                          (0, GenericFunctions_1.populate)({
                              ...(roles && { roles }),
                              ...rest,
                          }, body);
                          const partialEndpoint = '/services/authentication/users/';
                          const userId = GenericFunctions_1.getId.call(this, i, 'userId', partialEndpoint);
                          const endpoint = `${partialEndpoint}/${userId}`;
                          responseData = await GenericFunctions_1.splunkApiRequest
                              .call(this, 'POST', endpoint, body)
                              .then(GenericFunctions_1.formatFeed);
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ error: error.cause.error });
                      continue;
                  }
                  throw error;
              }
              Array.isArray(responseData)
                  ? returnData.push(...responseData)
                  : returnData.push(responseData);
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Splunk = Splunk;
  //# sourceMappingURL=Splunk.node.js.map

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

  # Splunk node

  Use the Splunk node to automate work in Splunk, and integrate Splunk with other applications. n8n has built-in support for a wide range of Splunk features, including getting fired alerts reports, as well as deleting and getting search configuration. 

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

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

  ## Operations

  * Fired Alert
      * Get a fired alerts report
  * Search Configuration
      * Delete a search configuration
      * Get a search configuration
      * Get many search configurations
  * Search Job
      * Create a search job
      * Delete a search job
      * Get a search job
      * Get many search jobs
  * Search Result
      * Get many search results
  * User
      * Create a user
      * Delete a user
      * Get a user
      * Get many users
      * Update a user

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"c2a4c86b-e645-4a6e-b234-97b79e22fd36","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"adf9277aac3ebd41682276d4facfc85389935f1375c36d6b457267a46cba129c"}}


node_type: n8n-nodes-base.Sms77
name: Sms77
display_name: seven
description: Send SMS and make text-to-speech calls
category: transform
icon: file:seven.svg
code_hash: aa9de8dde48b46654d68fcb68dc969e66a6ebb93af370b08a8c8919f7d65d0fd
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.sms77
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:29
updated_at: 2025-06-08 09:18:29
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Sms77 = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  class Sms77 {
      constructor() {
          this.description = {
              displayName: 'seven',
              name: 'sms77',
              icon: 'file:seven.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Send SMS and make text-to-speech calls',
              defaults: {
                  name: 'seven',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'sms77Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'SMS',
                              value: 'sms',
                          },
                          {
                              name: 'Voice Call',
                              value: 'voice',
                          },
                      ],
                      default: 'sms',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['sms'],
                          },
                      },
                      options: [
                          {
                              name: 'Send',
                              value: 'send',
                              description: 'Send SMS',
                              action: 'Send an SMS',
                          },
                      ],
                      default: 'send',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['voice'],
                          },
                      },
                      options: [
                          {
                              name: 'Send',
                              value: 'send',
                              description: 'Converts text to voice and calls a given number',
                              action: 'Convert text to voice',
                          },
                      ],
                      default: 'send',
                  },
                  {
                      displayName: 'From',
                      name: 'from',
                      type: 'string',
                      default: '',
                      placeholder: '+4901234567890',
                      displayOptions: {
                          show: {
                              operation: ['send'],
                              resource: ['sms'],
                          },
                      },
                      description: 'The caller ID displayed in the receivers display. Max 16 numeric or 11 alphanumeric characters.',
                  },
                  {
                      displayName: 'To',
                      name: 'to',
                      type: 'string',
                      default: '',
                      placeholder: '+49876543210, MyGroup',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['send'],
                              resource: ['sms', 'voice'],
                          },
                      },
                      description: 'The number of your recipient(s) separated by comma. Can be regular numbers or contact/groups from seven.',
                  },
                  {
                      displayName: 'Message',
                      name: 'message',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['send'],
                              resource: ['sms', 'voice'],
                          },
                      },
                      description: 'The message to send. Max. 1520 characters',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Opton',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['send'],
                              resource: ['sms'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Debug',
                              name: 'debug',
                              type: 'boolean',
                              default: false,
                              description: 'Whether the API returns fake responses like in a sandbox',
                          },
                          {
                              displayName: 'Delay',
                              name: 'delay',
                              type: 'dateTime',
                              default: '',
                              description: 'Pick a date for time delayed dispatch',
                          },
                          {
                              displayName: 'Foreign ID',
                              name: 'foreign_id',
                              type: 'string',
                              default: '',
                              placeholder: 'MyCustomForeignID',
                              description: 'Custom foreign ID returned in DLR callbacks',
                          },
                          {
                              displayName: 'Flash',
                              name: 'flash',
                              type: 'boolean',
                              default: false,
                              description: "Send as flash message being displayed directly the receiver's display",
                          },
                          {
                              displayName: 'Label',
                              name: 'label',
                              type: 'string',
                              default: '',
                              placeholder: 'MyCustomLabel',
                              description: 'Custom label used to group analytics',
                          },
                          {
                              displayName: 'No Reload',
                              name: 'no_reload',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to disable reload lock to allow sending duplicate messages',
                          },
                          {
                              displayName: 'Performance Tracking',
                              name: 'performance_tracking',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to enable performance tracking for URLs found in the message text',
                          },
                          {
                              displayName: 'TTL',
                              name: 'ttl',
                              type: 'number',
                              default: 2880,
                              typeOptions: {
                                  minValue: 1,
                              },
                              description: 'Custom time to live specifying the validity period of a message in minutes',
                          },
                      ],
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Opton',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['send'],
                              resource: ['voice'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Debug',
                              name: 'debug',
                              type: 'boolean',
                              default: false,
                              description: 'Whether the API returns fake responses like in a sandbox',
                          },
                          {
                              displayName: 'From',
                              name: 'from',
                              type: 'string',
                              default: '',
                              placeholder: '+4901234567890',
                              description: 'The caller ID. Please use only verified sender IDs, one of your virtual inbound numbers or one of our shared virtual numbers.',
                          },
                          {
                              displayName: 'XML',
                              name: 'xml',
                              type: 'boolean',
                              default: false,
                              description: 'Whether the text is in XML format',
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const returnData = [];
          for (let i = 0; i < this.getInputData().length; i++) {
              const resource = this.getNodeParameter('resource', i);
              const operation = this.getNodeParameter('operation', i);
              let responseData;
              try {
                  if (resource === 'sms') {
                      if (operation === 'send') {
                          const from = this.getNodeParameter('from', i);
                          const to = this.getNodeParameter('to', i);
                          const text = this.getNodeParameter('message', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              from,
                              to,
                              text,
                              ...options,
                          };
                          responseData = await GenericFunctions_1.sms77ApiRequest.call(this, 'POST', '/sms', body);
                      }
                  }
                  if (resource === 'voice') {
                      if (operation === 'send') {
                          const to = this.getNodeParameter('to', i);
                          const text = this.getNodeParameter('message', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              to,
                              text,
                              ...options,
                          };
                          responseData = await GenericFunctions_1.sms77ApiRequest.call(this, 'POST', '/voice', body);
                      }
                  }
                  if (Array.isArray(responseData)) {
                      returnData.push.apply(returnData, responseData);
                  }
                  else if (responseData !== undefined) {
                      returnData.push(responseData);
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ error: error.message });
                      continue;
                  }
                  throw error;
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Sms77 = Sms77;
  //# sourceMappingURL=Sms77.node.js.map

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

  # seven node

  Use the seven node to automate work in seven, and integrate seven with other applications. n8n has built-in support for a wide range of seven features, including sending SMS, and converting text to voice. 

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

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

  ## Operations

  * SMS
      * Send SMS
  * Voice Call
      * Converts text to voice and calls a given number

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"6eb206e9-5c81-47ce-ae54-6a511d22fcea","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"0a8d6aa529870a9d4a041affd198269cd61b51a010f7edf0a840d1d142efe15b"}}


node_type: n8n-nodes-base.SpreadsheetFile
name: SpreadsheetFile
display_name: Spreadsheet File
description: Reads and writes data from a spreadsheet file like CSV, XLS, ODS, etc
category: transform
icon: fa:table
code_hash: 6e655ee1172b11636b5c4634ce0a591a107d5056c258f5cdf9cda099aa7973ea
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 09:18:31
updated_at: 2025-06-08 09:18:31
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SpreadsheetFile = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const SpreadsheetFileV1_node_1 = require("./v1/SpreadsheetFileV1.node");
  const SpreadsheetFileV2_node_1 = require("./v2/SpreadsheetFileV2.node");
  class SpreadsheetFile extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'Spreadsheet File',
              name: 'spreadsheetFile',
              icon: 'fa:table',
              group: ['transform'],
              description: 'Reads and writes data from a spreadsheet file like CSV, XLS, ODS, etc',
              defaultVersion: 2,
          };
          const nodeVersions = {
              1: new SpreadsheetFileV1_node_1.SpreadsheetFileV1(baseDescription),
              2: new SpreadsheetFileV2_node_1.SpreadsheetFileV2(baseDescription),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.SpreadsheetFile = SpreadsheetFile;
  //# sourceMappingURL=SpreadsheetFile.node.js.map

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"81b3a75f-31f8-49f4-b6fd-879dacca22a9","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"f620df0be6fd967a9e589ce491b8c914a86193faa4f2b0bb23d2321867b389f8"}}


node_type: n8n-nodes-base.StickyNote
name: StickyNote
display_name: Sticky Note
description: Make your workflow easier to understand
category: input
icon: fa:sticky-note
code_hash: 71536993abcfd47e981e96d368c60bcc43b74fc57c1cb59cf8688071356f8bf0
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:31
updated_at: 2025-06-08 09:18:31
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.StickyNote = void 0;
  class StickyNote {
      constructor() {
          this.description = {
              displayName: 'Sticky Note',
              name: 'stickyNote',
              icon: 'fa:sticky-note',
              group: ['input'],
              version: 1,
              description: 'Make your workflow easier to understand',
              defaults: {
                  name: 'Sticky Note',
                  color: '#FFD233',
              },
              inputs: [],
              outputs: [],
              properties: [
                  {
                      displayName: 'Content',
                      name: 'content',
                      type: 'string',
                      required: true,
                      default: "## I'm a note \n**Double click** to edit me. [Guide](https://docs.n8n.io/workflows/sticky-notes/)",
                  },
                  {
                      displayName: 'Height',
                      name: 'height',
                      type: 'number',
                      required: true,
                      default: 160,
                  },
                  {
                      displayName: 'Width',
                      name: 'width',
                      type: 'number',
                      required: true,
                      default: 240,
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          return [items];
      }
  }
  exports.StickyNote = StickyNote;
  //# sourceMappingURL=StickyNote.node.js.map

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"fc0a509b-39f6-4df1-a54f-9cbe8d475ae6","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"b474c422d22bd601f4739e246541a4546ef94cdb9ea27b980c6de925f5e026e2"}}


node_type: n8n-nodes-base.Start
name: Start
display_name: Start
description: Starts the workflow execution from this node
category: input
icon: fa:play
code_hash: 327ac4d08639ec3324f54dd7f64f0b4df659eb5c371c63fa6ce8c346517717e8
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:31
updated_at: 2025-06-08 09:18:31
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Start = void 0;
  class Start {
      constructor() {
          this.description = {
              displayName: 'Start',
              name: 'start',
              icon: 'fa:play',
              group: ['input'],
              version: 1,
              description: 'Starts the workflow execution from this node',
              maxNodes: 1,
              hidden: true,
              defaults: {
                  name: 'Start',
                  color: '#00e000',
              },
              inputs: [],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'This node is where a manual workflow execution starts. To make one, go back to the canvas and click ‘execute workflow’',
                      name: 'notice',
                      type: 'notice',
                      default: '',
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          return [items];
      }
  }
  exports.Start = Start;
  //# sourceMappingURL=Start.node.js.map

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"4be72fb1-9ba5-498d-855b-ac4b1df2a675","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"3c47873119b7f3a4101eebb8a3e56a88ef06517a0c9c68fb4f6524c7e065d97e"}}


node_type: n8n-nodes-base.Spotify
name: Spotify
display_name: Spotify
description: Access public song data via the Spotify API
category: input
icon: file:spotify.svg
code_hash: 1a821c70bcb95f1080d2a7f8f2884b566c30771e6de24c0a9a28da9a76c8f677
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.spotify
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:31
updated_at: 2025-06-08 09:18:31
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Spotify = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const IsoCountryCodes_1 = require("./IsoCountryCodes");
  class Spotify {
      constructor() {
          this.description = {
              displayName: 'Spotify',
              name: 'spotify',
              icon: 'file:spotify.svg',
              group: ['input'],
              version: 1,
              description: 'Access public song data via the Spotify API',
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              defaults: {
                  name: 'Spotify',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'spotifyOAuth2Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Album',
                              value: 'album',
                          },
                          {
                              name: 'Artist',
                              value: 'artist',
                          },
                          {
                              name: 'Library',
                              value: 'library',
                          },
                          {
                              name: 'My Data',
                              value: 'myData',
                          },
                          {
                              name: 'Player',
                              value: 'player',
                          },
                          {
                              name: 'Playlist',
                              value: 'playlist',
                          },
                          {
                              name: 'Track',
                              value: 'track',
                          },
                      ],
                      default: 'player',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['player'],
                          },
                      },
                      options: [
                          {
                              name: 'Add Song to Queue',
                              value: 'addSongToQueue',
                              description: 'Add a song to your queue',
                              action: 'Add a song to a queue',
                          },
                          {
                              name: 'Currently Playing',
                              value: 'currentlyPlaying',
                              description: 'Get your currently playing track',
                              action: 'Get the currently playing track',
                          },
                          {
                              name: 'Next Song',
                              value: 'nextSong',
                              description: 'Skip to your next track',
                              action: 'Skip to the next track',
                          },
                          {
                              name: 'Pause',
                              value: 'pause',
                              description: 'Pause your music',
                              action: 'Pause the player',
                          },
                          {
                              name: 'Previous Song',
                              value: 'previousSong',
                              description: 'Skip to your previous song',
                              action: 'Skip to the previous song',
                          },
                          {
                              name: 'Recently Played',
                              value: 'recentlyPlayed',
                              description: 'Get your recently played tracks',
                              action: 'Get the recently played tracks',
                          },
                          {
                              name: 'Resume',
                              value: 'resume',
                              description: 'Resume playback on the current active device',
                              action: 'Resume the player',
                          },
                          {
                              name: 'Set Volume',
                              value: 'volume',
                              description: 'Set volume on the current active device',
                              action: 'Set volume on the player',
                          },
                          {
                              name: 'Start Music',
                              value: 'startMusic',
                              description: 'Start playing a playlist, artist, or album',
                              action: 'Start music on the player',
                          },
                      ],
                      default: 'addSongToQueue',
                  },
                  {
                      displayName: 'Resource ID',
                      name: 'id',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['player'],
                              operation: ['startMusic'],
                          },
                      },
                      placeholder: 'spotify:album:1YZ3k65Mqw3G8FzYlW1mmp',
                      description: 'Enter a playlist, artist, or album URI or ID',
                  },
                  {
                      displayName: 'Track ID',
                      name: 'id',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['player'],
                              operation: ['addSongToQueue'],
                          },
                      },
                      placeholder: 'spotify:track:0xE4LEFzSNGsz1F6kvXsHU',
                      description: 'Enter a track URI or ID',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['album'],
                          },
                      },
                      options: [
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get an album by URI or ID',
                              action: 'Get an album',
                          },
                          {
                              name: 'Get New Releases',
                              value: 'getNewReleases',
                              description: 'Get a list of new album releases',
                              action: 'Get new album releases',
                          },
                          {
                              name: 'Get Tracks',
                              value: 'getTracks',
                              description: "Get an album's tracks by URI or ID",
                              action: "Get an album's tracks by URI or ID",
                          },
                          {
                              name: 'Search',
                              value: 'search',
                              description: 'Search albums by keyword',
                              action: 'Search albums by keyword',
                          },
                      ],
                      default: 'get',
                  },
                  {
                      displayName: 'Album ID',
                      name: 'id',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['album'],
                              operation: ['get', 'getTracks'],
                          },
                          hide: {
                              operation: ['search'],
                          },
                      },
                      placeholder: 'spotify:album:1YZ3k65Mqw3G8FzYlW1mmp',
                      description: "The album's Spotify URI or ID",
                  },
                  {
                      displayName: 'Search Keyword',
                      name: 'query',
                      type: 'string',
                      required: true,
                      default: '',
                      description: 'The keyword term to search for',
                      displayOptions: {
                          show: {
                              resource: ['album'],
                              operation: ['search'],
                          },
                      },
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['artist'],
                          },
                      },
                      options: [
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get an artist by URI or ID',
                              action: 'Get an artist',
                          },
                          {
                              name: 'Get Albums',
                              value: 'getAlbums',
                              description: "Get an artist's albums by URI or ID",
                              action: "Get an artist's albums by URI or ID",
                          },
                          {
                              name: 'Get Related Artists',
                              value: 'getRelatedArtists',
                              description: "Get an artist's related artists by URI or ID",
                              action: "Get an artist's related artists by URI or ID",
                          },
                          {
                              name: 'Get Top Tracks',
                              value: 'getTopTracks',
                              description: "Get an artist's top tracks by URI or ID",
                              action: "Get an artist's top tracks by URI or ID",
                          },
                          {
                              name: 'Search',
                              value: 'search',
                              description: 'Search artists by keyword',
                              action: 'Search artists by keyword',
                          },
                      ],
                      default: 'get',
                  },
                  {
                      displayName: 'Artist ID',
                      name: 'id',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['artist'],
                          },
                          hide: {
                              operation: ['search'],
                          },
                      },
                      placeholder: 'spotify:artist:4LLpKhyESsyAXpc4laK94U',
                      description: "The artist's Spotify URI or ID",
                  },
                  {
                      displayName: 'Country',
                      name: 'country',
                      type: 'string',
                      default: 'US',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['artist'],
                              operation: ['getTopTracks'],
                          },
                      },
                      placeholder: 'US',
                      description: 'Top tracks in which country? Enter the postal abbreviation',
                  },
                  {
                      displayName: 'Search Keyword',
                      name: 'query',
                      type: 'string',
                      required: true,
                      default: '',
                      description: 'The keyword term to search for',
                      displayOptions: {
                          show: {
                              resource: ['artist'],
                              operation: ['search'],
                          },
                      },
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['playlist'],
                          },
                      },
                      options: [
                          {
                              name: 'Add an Item',
                              value: 'add',
                              description: 'Add tracks to a playlist by track and playlist URI or ID',
                              action: 'Add an Item to a playlist',
                          },
                          {
                              name: 'Create a Playlist',
                              value: 'create',
                              description: 'Create a new playlist',
                              action: 'Create a playlist',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a playlist by URI or ID',
                              action: 'Get a playlist',
                          },
                          {
                              name: "Get the User's Playlists",
                              value: 'getUserPlaylists',
                              description: "Get a user's playlists",
                              action: "Get a user's playlists",
                          },
                          {
                              name: 'Get Tracks',
                              value: 'getTracks',
                              description: "Get a playlist's tracks by URI or ID",
                              action: "Get a playlist's tracks by URI or ID",
                          },
                          {
                              name: 'Remove an Item',
                              value: 'delete',
                              description: 'Remove tracks from a playlist by track and playlist URI or ID',
                              action: 'Remove an item from a playlist',
                          },
                          {
                              name: 'Search',
                              value: 'search',
                              description: 'Search playlists by keyword',
                              action: 'Search playlists by keyword',
                          },
                      ],
                      default: 'add',
                  },
                  {
                      displayName: 'Playlist ID',
                      name: 'id',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['playlist'],
                              operation: ['add', 'delete', 'get', 'getTracks'],
                          },
                      },
                      placeholder: 'spotify:playlist:37i9dQZF1DWUhI3iC1khPH',
                      description: "The playlist's Spotify URI or its ID",
                  },
                  {
                      displayName: 'Name',
                      name: 'name',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['playlist'],
                              operation: ['create'],
                          },
                      },
                      placeholder: 'Favorite Songs',
                      description: 'Name of the playlist to create',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['playlist'],
                              operation: ['create'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Description',
                              name: 'description',
                              type: 'string',
                              default: '',
                              placeholder: 'These are all my favorite songs.',
                              description: 'Description for the playlist to create',
                          },
                          {
                              displayName: 'Public',
                              name: 'public',
                              type: 'boolean',
                              default: true,
                              description: 'Whether the playlist is publicly accessible',
                          },
                      ],
                  },
                  {
                      displayName: 'Track ID',
                      name: 'trackID',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['playlist'],
                              operation: ['add', 'delete'],
                          },
                      },
                      placeholder: 'spotify:track:0xE4LEFzSNGsz1F6kvXsHU',
                      description: "The track's Spotify URI or its ID. The track to add/delete from the playlist.",
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['playlist'],
                              operation: ['add'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Position',
                              name: 'position',
                              type: 'number',
                              typeOptions: {
                                  minValue: 0,
                              },
                              default: 0,
                              placeholder: '0',
                              description: "The new track's position in the playlist",
                          },
                      ],
                  },
                  {
                      displayName: 'Search Keyword',
                      name: 'query',
                      type: 'string',
                      required: true,
                      default: '',
                      description: 'The keyword term to search for',
                      displayOptions: {
                          show: {
                              resource: ['playlist'],
                              operation: ['search'],
                          },
                      },
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['track'],
                          },
                      },
                      options: [
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a track by its URI or ID',
                              action: 'Get a track',
                          },
                          {
                              name: 'Get Audio Features',
                              value: 'getAudioFeatures',
                              description: 'Get audio features for a track by URI or ID',
                              action: 'Get audio features of a track',
                          },
                          {
                              name: 'Search',
                              value: 'search',
                              description: 'Search tracks by keyword',
                              action: 'Search tracks by keyword',
                          },
                      ],
                      default: 'track',
                  },
                  {
                      displayName: 'Track ID',
                      name: 'id',
                      type: 'string',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['track'],
                          },
                          hide: {
                              operation: ['search'],
                          },
                      },
                      placeholder: 'spotify:track:0xE4LEFzSNGsz1F6kvXsHU',
                      description: "The track's Spotify URI or ID",
                  },
                  {
                      displayName: 'Search Keyword',
                      name: 'query',
                      type: 'string',
                      required: true,
                      default: '',
                      description: 'The keyword term to search for',
                      displayOptions: {
                          show: {
                              resource: ['track'],
                              operation: ['search'],
                          },
                      },
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['library'],
                          },
                      },
                      options: [
                          {
                              name: 'Get Liked Tracks',
                              value: 'getLikedTracks',
                              description: "Get the user's liked tracks",
                              action: 'Get liked tracks',
                          },
                      ],
                      default: 'getLikedTracks',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['myData'],
                          },
                      },
                      options: [
                          {
                              name: 'Get Following Artists',
                              value: 'getFollowingArtists',
                              description: 'Get your followed artists',
                              action: 'Get your followed artists',
                          },
                      ],
                      default: 'getFollowingArtists',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      default: false,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['album', 'artist', 'library', 'myData', 'playlist', 'track', 'player'],
                              operation: [
                                  'getTracks',
                                  'getAlbums',
                                  'getUserPlaylists',
                                  'getNewReleases',
                                  'getLikedTracks',
                                  'getFollowingArtists',
                                  'search',
                                  'recentlyPlayed',
                              ],
                          },
                      },
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      default: 50,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['album', 'artist', 'library', 'playlist', 'track'],
                              operation: [
                                  'getTracks',
                                  'getAlbums',
                                  'getUserPlaylists',
                                  'getNewReleases',
                                  'getLikedTracks',
                                  'search',
                              ],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 100,
                      },
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      default: 50,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['myData', 'player'],
                              operation: ['getFollowingArtists', 'recentlyPlayed'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 50,
                      },
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Volume',
                      name: 'volumePercent',
                      type: 'number',
                      default: 50,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['player'],
                              operation: ['volume'],
                          },
                      },
                      typeOptions: {
                          minValue: 0,
                          maxValue: 100,
                      },
                      description: 'The volume percentage to set',
                  },
                  {
                      displayName: 'Filters',
                      name: 'filters',
                      type: 'collection',
                      placeholder: 'Add Filter',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['album'],
                              operation: ['getNewReleases'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Country',
                              name: 'country',
                              type: 'options',
                              default: 'US',
                              options: IsoCountryCodes_1.isoCountryCodes.map(({ name, alpha2 }) => ({ name, value: alpha2 })),
                              description: 'Country to filter new releases by',
                          },
                      ],
                  },
                  {
                      displayName: 'Filters',
                      name: 'filters',
                      type: 'collection',
                      placeholder: 'Add Filter',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['playlist', 'artist', 'track', 'album'],
                              operation: ['search'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Country',
                              name: 'market',
                              type: 'options',
                              options: IsoCountryCodes_1.isoCountryCodes.map(({ name, alpha2 }) => ({ name, value: alpha2 })),
                              default: '',
                              description: 'If a country code is specified, only content that is playable in that market is returned',
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const body = {};
          let qs;
          let requestMethod;
          let endpoint;
          let returnAll;
          let propertyName = '';
          let responseData;
          const operation = this.getNodeParameter('operation', 0);
          const resource = this.getNodeParameter('resource', 0);
          requestMethod = 'GET';
          endpoint = '';
          qs = {};
          returnAll = false;
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'player') {
                      if (operation === 'pause') {
                          requestMethod = 'PUT';
                          endpoint = '/me/player/pause';
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'recentlyPlayed') {
                          requestMethod = 'GET';
                          endpoint = '/me/player/recently-played';
                          returnAll = this.getNodeParameter('returnAll', i);
                          propertyName = 'items';
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs = {
                                  limit,
                              };
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.items;
                          }
                      }
                      else if (operation === 'currentlyPlaying') {
                          requestMethod = 'GET';
                          endpoint = '/me/player/currently-playing';
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                      }
                      else if (operation === 'nextSong') {
                          requestMethod = 'POST';
                          endpoint = '/me/player/next';
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'previousSong') {
                          requestMethod = 'POST';
                          endpoint = '/me/player/previous';
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'startMusic') {
                          requestMethod = 'PUT';
                          endpoint = '/me/player/play';
                          const id = this.getNodeParameter('id', i);
                          body.context_uri = id;
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'addSongToQueue') {
                          requestMethod = 'POST';
                          endpoint = '/me/player/queue';
                          const id = this.getNodeParameter('id', i);
                          qs = {
                              uri: id,
                          };
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'resume') {
                          requestMethod = 'PUT';
                          endpoint = '/me/player/play';
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = { success: true };
                      }
                      else if (operation === 'volume') {
                          requestMethod = 'PUT';
                          endpoint = '/me/player/volume';
                          const volumePercent = this.getNodeParameter('volumePercent', i);
                          qs = {
                              volume_percent: volumePercent,
                          };
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = { success: true };
                      }
                  }
                  else if (resource === 'album') {
                      if (operation === 'get') {
                          const uri = this.getNodeParameter('id', i);
                          const id = uri.replace('spotify:album:', '');
                          requestMethod = 'GET';
                          endpoint = `/albums/${id}`;
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                      }
                      else if (operation === 'getNewReleases') {
                          endpoint = '/browse/new-releases';
                          requestMethod = 'GET';
                          propertyName = 'albums.items';
                          const filters = this.getNodeParameter('filters', i);
                          if (Object.keys(filters).length) {
                              Object.assign(qs, filters);
                          }
                          returnAll = this.getNodeParameter('returnAll', i);
                          if (!returnAll) {
                              qs.limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.albums.items;
                          }
                      }
                      else if (operation === 'getTracks') {
                          const uri = this.getNodeParameter('id', i);
                          const id = uri.replace('spotify:album:', '');
                          requestMethod = 'GET';
                          endpoint = `/albums/${id}/tracks`;
                          propertyName = 'tracks';
                          returnAll = this.getNodeParameter('returnAll', i);
                          propertyName = 'items';
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs = {
                                  limit,
                              };
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.items;
                          }
                      }
                      else if (operation === 'search') {
                          requestMethod = 'GET';
                          endpoint = '/search';
                          propertyName = 'albums.items';
                          returnAll = this.getNodeParameter('returnAll', i);
                          const q = this.getNodeParameter('query', i);
                          const filters = this.getNodeParameter('filters', i);
                          qs = {
                              q,
                              type: 'album',
                              ...filters,
                          };
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.limit = limit;
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.albums.items;
                          }
                      }
                  }
                  else if (resource === 'artist') {
                      const uri = this.getNodeParameter('id', i, '');
                      const id = uri.replace('spotify:artist:', '');
                      if (operation === 'getAlbums') {
                          endpoint = `/artists/${id}/albums`;
                          returnAll = this.getNodeParameter('returnAll', i);
                          propertyName = 'items';
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs = {
                                  limit,
                              };
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.items;
                          }
                      }
                      else if (operation === 'getRelatedArtists') {
                          endpoint = `/artists/${id}/related-artists`;
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = responseData.artists;
                      }
                      else if (operation === 'getTopTracks') {
                          const country = this.getNodeParameter('country', i);
                          qs = {
                              country,
                          };
                          endpoint = `/artists/${id}/top-tracks`;
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          responseData = responseData.tracks;
                      }
                      else if (operation === 'get') {
                          requestMethod = 'GET';
                          endpoint = `/artists/${id}`;
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                      }
                      else if (operation === 'search') {
                          requestMethod = 'GET';
                          endpoint = '/search';
                          propertyName = 'artists.items';
                          returnAll = this.getNodeParameter('returnAll', i);
                          const q = this.getNodeParameter('query', i);
                          const filters = this.getNodeParameter('filters', i);
                          qs = {
                              q,
                              limit: 50,
                              type: 'artist',
                              ...filters,
                          };
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.limit = limit;
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.artists.items;
                          }
                      }
                  }
                  else if (resource === 'playlist') {
                      if (['delete', 'get', 'getTracks', 'add'].includes(operation)) {
                          const uri = this.getNodeParameter('id', i);
                          const id = uri.replace('spotify:playlist:', '');
                          if (operation === 'delete') {
                              requestMethod = 'DELETE';
                              const trackId = this.getNodeParameter('trackID', i);
                              body.tracks = [
                                  {
                                      uri: trackId,
                                  },
                              ];
                              endpoint = `/playlists/${id}/tracks`;
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = { success: true };
                          }
                          else if (operation === 'get') {
                              requestMethod = 'GET';
                              endpoint = `/playlists/${id}`;
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          }
                          else if (operation === 'getTracks') {
                              requestMethod = 'GET';
                              endpoint = `/playlists/${id}/tracks`;
                              returnAll = this.getNodeParameter('returnAll', i);
                              propertyName = 'items';
                              if (!returnAll) {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs = {
                                      limit,
                                  };
                                  responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                                  responseData = responseData.items;
                              }
                          }
                          else if (operation === 'add') {
                              requestMethod = 'POST';
                              const trackId = this.getNodeParameter('trackID', i);
                              const additionalFields = this.getNodeParameter('additionalFields', i);
                              qs = {
                                  uris: trackId,
                              };
                              if (additionalFields.position !== undefined) {
                                  qs.position = additionalFields.position;
                              }
                              endpoint = `/playlists/${id}/tracks`;
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                          }
                      }
                      else if (operation === 'getUserPlaylists') {
                          requestMethod = 'GET';
                          endpoint = '/me/playlists';
                          returnAll = this.getNodeParameter('returnAll', i);
                          propertyName = 'items';
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs = {
                                  limit,
                              };
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.items;
                          }
                      }
                      else if (operation === 'create') {
                          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.spotifyApiRequest.call(this, 'POST', '/me/playlists', body, qs);
                      }
                      else if (operation === 'search') {
                          requestMethod = 'GET';
                          endpoint = '/search';
                          propertyName = 'playlists.items';
                          returnAll = this.getNodeParameter('returnAll', i);
                          const q = this.getNodeParameter('query', i);
                          const filters = this.getNodeParameter('filters', i);
                          qs = {
                              q,
                              type: 'playlist',
                              limit: 50,
                              ...filters,
                          };
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.limit = limit;
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.playlists.items;
                          }
                      }
                  }
                  else if (resource === 'track') {
                      const uri = this.getNodeParameter('id', i, '');
                      const id = uri.replace('spotify:track:', '');
                      requestMethod = 'GET';
                      if (operation === 'getAudioFeatures') {
                          endpoint = `/audio-features/${id}`;
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                      }
                      else if (operation === 'get') {
                          endpoint = `/tracks/${id}`;
                          responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                      }
                      else if (operation === 'search') {
                          requestMethod = 'GET';
                          endpoint = '/search';
                          propertyName = 'tracks.items';
                          returnAll = this.getNodeParameter('returnAll', i);
                          const q = this.getNodeParameter('query', i);
                          const filters = this.getNodeParameter('filters', i);
                          qs = {
                              q,
                              type: 'track',
                              limit: 50,
                              ...filters,
                          };
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs.limit = limit;
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.tracks.items;
                          }
                      }
                  }
                  else if (resource === 'library') {
                      if (operation === 'getLikedTracks') {
                          requestMethod = 'GET';
                          endpoint = '/me/tracks';
                          returnAll = this.getNodeParameter('returnAll', i);
                          propertyName = 'items';
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs = {
                                  limit,
                              };
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.items;
                          }
                      }
                  }
                  else if (resource === 'myData') {
                      if (operation === 'getFollowingArtists') {
                          requestMethod = 'GET';
                          endpoint = '/me/following';
                          returnAll = this.getNodeParameter('returnAll', i);
                          propertyName = 'artists.items';
                          qs = {
                              type: 'artist',
                          };
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              qs = {
                                  type: 'artist',
                                  limit,
                              };
                              responseData = await GenericFunctions_1.spotifyApiRequest.call(this, requestMethod, endpoint, body, qs);
                              responseData = responseData.artists.items;
                          }
                      }
                  }
                  if (returnAll) {
                      responseData = await GenericFunctions_1.spotifyApiRequestAllItems.call(this, propertyName, requestMethod, endpoint, body, qs);
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                  returnData.push(...executionData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionData);
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.Spotify = Spotify;
  //# sourceMappingURL=Spotify.node.js.map

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

  # Spotify node

  Use the Spotify node to automate work in Spotify, and integrate Spotify with other applications. n8n has built-in support for a wide range of Spotify features, including getting album and artist information. 

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

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

  ## Operations

  * Album
      * Get an album by URI or ID.
      * Get a list of new album releases.
      * Get an album's tracks by URI or ID.
      * Search albums by keyword.
  * Artist
      * Get an artist by URI or ID.
      * Get an artist's albums by URI or ID.
      * Get an artist's related artists by URI or ID.
      * Get an artist's top tracks by URI or ID.
      * Search artists by keyword.
  * Library
      * Get the user's liked tracks.
  * My Data
      * Get your followed artists.
  * Player
      * Add a song to your queue.
      * Get your currently playing track.
      * Skip to your next track.
      * Pause your music.
      * Skip to your previous song.
      * Get your recently played tracks.
      * Resume playback on the current active device.
      * Set volume on the current active device.
      * Start playing a playlist, artist, or album.
  * Playlist
      * Add tracks from a playlist by track and playlist URI or ID.
      * Create a new playlist.
      * Get a playlist by URI or ID.
      * Get a playlist's tracks by URI or ID.
      * Get a user's playlists.
      * Remove tracks from a playlist by track and playlist URI or ID.
      * Search playlists by keyword.
  * Track
      * Get a track by its URI or ID.
      * Get audio features for a track by URI or ID.
      * Search tracks by keyword

  ## Templates and examples

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

  --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":"aab09c32-4d68-426a-9cd3-8da2e794b4a7","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"9cf42bd523c90246f9f440c49038587cdb973fa925af1ca6ed143bfe9d69723a"}}


node_type: n8n-nodes-base.Stackby
name: Stackby
display_name: Stackby
description: Read, write, and delete data in Stackby
category: transform
icon: file:stackby.png
code_hash: 01e67da38c6f9be77eccfb21b9551d9c8fc64893991b678ddd9b4f56e2a8f463
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.stackby
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:31
updated_at: 2025-06-08 09:18:31
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Stackby = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunction_1 = require("./GenericFunction");
  const utilities_1 = require("../../utils/utilities");
  class Stackby {
      constructor() {
          this.description = {
              displayName: 'Stackby',
              name: 'stackby',
              icon: 'file:stackby.png',
              group: ['transform'],
              version: 1,
              description: 'Read, write, and delete data in Stackby',
              defaults: {
                  name: 'Stackby',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'stackbyApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Append',
                              value: 'append',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                          },
                          {
                              name: 'List',
                              value: 'list',
                          },
                          {
                              name: 'Read',
                              value: 'read',
                          },
                      ],
                      default: 'append',
                      placeholder: 'Action to perform',
                  },
                  {
                      displayName: 'Stack ID',
                      name: 'stackId',
                      type: 'string',
                      default: '',
                      required: true,
                      description: 'The ID of the stack to access',
                  },
                  {
                      displayName: 'Table',
                      name: 'table',
                      type: 'string',
                      default: '',
                      placeholder: 'Stories',
                      required: true,
                      description: 'Enter Table Name',
                  },
                  {
                      displayName: 'ID',
                      name: 'id',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['read', 'delete'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'ID of the record to return',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['list'],
                          },
                      },
                      default: true,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              operation: ['list'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 1000,
                      },
                      default: 1000,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      displayOptions: {
                          show: {
                              operation: ['list'],
                          },
                      },
                      default: {},
                      placeholder: 'Add Field',
                      options: [
                          {
                              displayName: 'View',
                              name: 'view',
                              type: 'string',
                              default: '',
                              placeholder: 'All Stories',
                              description: 'The name or ID of a view in the Stories table. If set, only the records in that view will be returned. The records will be sorted according to the order of the view.',
                          },
                      ],
                  },
                  {
                      displayName: 'Columns',
                      name: 'columns',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['append'],
                          },
                      },
                      default: '',
                      required: true,
                      placeholder: 'id,name,description',
                      description: 'Comma-separated list of the properties which should used as columns for the new rows',
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const qs = {};
          const operation = this.getNodeParameter('operation', 0);
          if (operation === 'read') {
              for (let i = 0; i < length; i++) {
                  try {
                      const stackId = this.getNodeParameter('stackId', i);
                      const table = encodeURI(this.getNodeParameter('table', i));
                      const rowIds = this.getNodeParameter('id', i);
                      qs.rowIds = [rowIds];
                      responseData = await GenericFunction_1.apiRequest.call(this, 'GET', `/rowlist/${stackId}/${table}`, {}, qs);
                      returnData.push.apply(returnData, responseData.map((data) => data.field));
                  }
                  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;
                  }
              }
          }
          if (operation === 'delete') {
              for (let i = 0; i < length; i++) {
                  try {
                      const stackId = this.getNodeParameter('stackId', i);
                      const table = encodeURI(this.getNodeParameter('table', i));
                      const rowIds = this.getNodeParameter('id', i);
                      qs.rowIds = [rowIds];
                      responseData = await GenericFunction_1.apiRequest.call(this, 'DELETE', `/rowdelete/${stackId}/${table}`, {}, qs);
                      responseData = responseData.records;
                      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;
                  }
              }
          }
          if (operation === 'append') {
              try {
                  const records = {};
                  let key = '';
                  for (let i = 0; i < length; i++) {
                      const stackId = this.getNodeParameter('stackId', i);
                      const table = encodeURI(this.getNodeParameter('table', i));
                      const columns = this.getNodeParameter('columns', i);
                      const columnList = columns.split(',').map((column) => column.trim());
                      const record = {};
                      for (const column of columnList) {
                          if (items[i].json[column] === undefined) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Column ${column} does not exist on input`, { itemIndex: i });
                          }
                          else {
                              record[column] = items[i].json[column];
                          }
                      }
                      key = `${stackId}/${table}`;
                      if (records[key] === undefined) {
                          records[key] = [];
                      }
                      records[key].push({ field: record });
                  }
                  for (const recordKey of Object.keys(records)) {
                      responseData = await GenericFunction_1.apiRequest.call(this, 'POST', `/rowcreate/${recordKey}`, {
                          records: records[recordKey],
                      });
                  }
                  returnData.push.apply(returnData, responseData.map((data) => data.field));
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const itemData = (0, utilities_1.generatePairedItemData)(items.length);
                      const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData });
                      returnData.push(...executionErrorData);
                  }
                  else {
                      throw error;
                  }
              }
          }
          if (operation === 'list') {
              for (let i = 0; i < length; i++) {
                  try {
                      const stackId = this.getNodeParameter('stackId', i);
                      const table = encodeURI(this.getNodeParameter('table', i));
                      const returnAll = this.getNodeParameter('returnAll', 0);
                      const additionalFields = this.getNodeParameter('additionalFields', i, {});
                      if (additionalFields.view) {
                          qs.view = additionalFields.view;
                      }
                      if (returnAll) {
                          responseData = await GenericFunction_1.apiRequestAllItems.call(this, 'GET', `/rowlist/${stackId}/${table}`, {}, qs);
                      }
                      else {
                          qs.maxrecord = this.getNodeParameter('limit', 0);
                          responseData = await GenericFunction_1.apiRequest.call(this, 'GET', `/rowlist/${stackId}/${table}`, {}, qs);
                      }
                      returnData.push.apply(returnData, responseData.map((data) => data.field));
                  }
                  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.Stackby = Stackby;
  //# sourceMappingURL=Stackby.node.js.map

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

  # Stackby node

  Use the Stackby node to automate work in Stackby, and integrate Stackby with other applications. n8n has built-in support for a wide range of Stackby features, including appending, deleting, listing and reading. 

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

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

  ## Operations

  - Append
  - Delete
  - List
  - Read

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"e63318d2-56d2-45ce-946e-3b7414d4e767","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"d402f15bdb8715de30738546d43498c8309b3b9315ccc6b956b53ad9cb5ef6bc"}}


node_type: n8n-nodes-base.Ssh
name: Ssh
display_name: SSH
description: Execute commands via SSH
category: input
icon: fa:terminal
code_hash: 6cd745a1e989a5652e95fb4e93213461aba20bf8defb942f71286257ab9372eb
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.ssh
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:31
updated_at: 2025-06-08 09:18:31
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Ssh = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const utilities_1 = require("../../utils/utilities");
  const promises_1 = require("fs/promises");
  const tmp_promise_1 = require("tmp-promise");
  const node_ssh_1 = require("node-ssh");
  async function resolveHomeDir(path, ssh, itemIndex) {
      if (path.startsWith('~/')) {
          let homeDir = (await ssh.execCommand('echo $HOME')).stdout;
          if (homeDir.charAt(homeDir.length - 1) !== '/') {
              homeDir += '/';
          }
          return path.replace('~/', homeDir);
      }
      if (path.startsWith('~')) {
          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid path. Replace "~" with home directory or "~/"', {
              itemIndex,
          });
      }
      return path;
  }
  class Ssh {
      constructor() {
          this.description = {
              displayName: 'SSH',
              name: 'ssh',
              icon: 'fa:terminal',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Execute commands via SSH',
              defaults: {
                  name: 'SSH',
                  color: '#000000',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'sshPassword',
                      required: true,
                      testedBy: 'sshConnectionTest',
                      displayOptions: {
                          show: {
                              authentication: ['password'],
                          },
                      },
                  },
                  {
                      name: 'sshPrivateKey',
                      required: true,
                      testedBy: 'sshConnectionTest',
                      displayOptions: {
                          show: {
                              authentication: ['privateKey'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'Password',
                              value: 'password',
                          },
                          {
                              name: 'Private Key',
                              value: 'privateKey',
                          },
                      ],
                      default: 'password',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Command',
                              value: 'command',
                          },
                          {
                              name: 'File',
                              value: 'file',
                          },
                      ],
                      default: 'command',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['command'],
                          },
                      },
                      options: [
                          {
                              name: 'Execute',
                              value: 'execute',
                              description: 'Execute a command',
                              action: 'Execute a command',
                          },
                      ],
                      default: 'execute',
                  },
                  {
                      displayName: 'Command',
                      name: 'command',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['command'],
                              operation: ['execute'],
                          },
                      },
                      default: '',
                      description: 'The command to be executed on a remote device',
                  },
                  {
                      displayName: 'Working Directory',
                      name: 'cwd',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['command'],
                              operation: ['execute'],
                          },
                      },
                      default: '/',
                      required: true,
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['file'],
                          },
                      },
                      options: [
                          {
                              name: 'Download',
                              value: 'download',
                              description: 'Download a file',
                              action: 'Download a file',
                          },
                          {
                              name: 'Upload',
                              value: 'upload',
                              description: 'Upload a file',
                              action: 'Upload a file',
                          },
                      ],
                      default: 'upload',
                  },
                  {
                      displayName: 'Binary Property',
                      name: 'binaryPropertyName',
                      type: 'string',
                      default: 'data',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['upload'],
                              resource: ['file'],
                          },
                      },
                      placeholder: '',
                      description: 'Name of the binary property which contains the data for the file to be uploaded',
                  },
                  {
                      displayName: 'Target Directory',
                      name: 'path',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['file'],
                              operation: ['upload'],
                          },
                      },
                      default: '',
                      required: true,
                      placeholder: '/home/user',
                      description: 'The directory to upload the file to. The name of the file does not need to be specified, it\'s taken from the binary data file name. To override this behavior, set the parameter "File Name" under options.',
                  },
                  {
                      displayName: 'Path',
                      displayOptions: {
                          show: {
                              resource: ['file'],
                              operation: ['download'],
                          },
                      },
                      name: 'path',
                      type: 'string',
                      default: '',
                      placeholder: '/home/user/invoice.txt',
                      description: 'The file path of the file to download. Has to contain the full path including file name.',
                      required: true,
                  },
                  {
                      displayName: 'Binary Property',
                      displayOptions: {
                          show: {
                              resource: ['file'],
                              operation: ['download'],
                          },
                      },
                      name: 'binaryPropertyName',
                      type: 'string',
                      default: 'data',
                      description: 'Object property name which holds binary data',
                      required: true,
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      displayOptions: {
                          show: {
                              resource: ['file'],
                              operation: ['upload', 'download'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'File Name',
                              name: 'fileName',
                              type: 'string',
                              default: '',
                              description: 'Overrides the binary data file name',
                          },
                      ],
                  },
              ],
          };
          this.methods = {
              credentialTest: {
                  async sshConnectionTest(credential) {
                      const credentials = credential.data;
                      const ssh = new node_ssh_1.NodeSSH();
                      const temporaryFiles = [];
                      try {
                          if (!credentials.privateKey) {
                              await ssh.connect({
                                  host: credentials.host,
                                  username: credentials.username,
                                  port: credentials.port,
                                  password: credentials.password,
                              });
                          }
                          else {
                              const options = {
                                  host: credentials.host,
                                  username: credentials.username,
                                  port: credentials.port,
                                  privateKey: (0, utilities_1.formatPrivateKey)(credentials.privateKey),
                              };
                              if (credentials.passphrase) {
                                  options.passphrase = credentials.passphrase;
                              }
                              await ssh.connect(options);
                          }
                      }
                      catch (error) {
                          const message = `SSH connection failed: ${error.message}`;
                          return {
                              status: 'Error',
                              message,
                          };
                      }
                      finally {
                          ssh.dispose();
                          for (const tempFile of temporaryFiles)
                              await (0, promises_1.rm)(tempFile);
                      }
                      return {
                          status: 'OK',
                          message: 'Connection successful!',
                      };
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnItems = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          const authentication = this.getNodeParameter('authentication', 0);
          const temporaryFiles = [];
          const ssh = new node_ssh_1.NodeSSH();
          try {
              if (authentication === 'password') {
                  const credentials = await this.getCredentials('sshPassword');
                  await ssh.connect({
                      host: credentials.host,
                      username: credentials.username,
                      port: credentials.port,
                      password: credentials.password,
                  });
              }
              else if (authentication === 'privateKey') {
                  const credentials = await this.getCredentials('sshPrivateKey');
                  const options = {
                      host: credentials.host,
                      username: credentials.username,
                      port: credentials.port,
                      privateKey: (0, utilities_1.formatPrivateKey)(credentials.privateKey),
                  };
                  if (credentials.passphrase) {
                      options.passphrase = credentials.passphrase;
                  }
                  await ssh.connect(options);
              }
              for (let i = 0; i < items.length; i++) {
                  try {
                      if (resource === 'command') {
                          if (operation === 'execute') {
                              const command = this.getNodeParameter('command', i);
                              const cwd = await resolveHomeDir.call(this, this.getNodeParameter('cwd', i), ssh, i);
                              returnItems.push({
                                  json: (await ssh.execCommand(command, { cwd })),
                                  pairedItem: {
                                      item: i,
                                  },
                              });
                          }
                      }
                      if (resource === 'file') {
                          if (operation === 'download') {
                              const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
                              const parameterPath = await resolveHomeDir.call(this, this.getNodeParameter('path', i), ssh, i);
                              const { path } = await (0, tmp_promise_1.file)({ prefix: 'n8n-ssh-' });
                              temporaryFiles.push(path);
                              await ssh.getFile(path, parameterPath);
                              const newItem = {
                                  json: items[i].json,
                                  binary: {},
                                  pairedItem: {
                                      item: i,
                                  },
                              };
                              if (items[i].binary !== undefined && newItem.binary) {
                                  Object.assign(newItem.binary, items[i].binary);
                              }
                              items[i] = newItem;
                              const fileName = this.getNodeParameter('options.fileName', i, '');
                              items[i].binary[dataPropertyNameDownload] = await this.nodeHelpers.copyBinaryFile(path, fileName || parameterPath);
                          }
                          if (operation === 'upload') {
                              const parameterPath = await resolveHomeDir.call(this, this.getNodeParameter('path', i), ssh, i);
                              const fileName = this.getNodeParameter('options.fileName', 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);
                              }
                              const { path } = await (0, tmp_promise_1.file)({ prefix: 'n8n-ssh-' });
                              temporaryFiles.push(path);
                              await (0, promises_1.writeFile)(path, uploadData);
                              await ssh.putFile(path, `${parameterPath}${parameterPath.charAt(parameterPath.length - 1) === '/' ? '' : '/'}${fileName || binaryData.fileName}`);
                              returnItems.push({
                                  json: {
                                      success: true,
                                  },
                                  pairedItem: {
                                      item: i,
                                  },
                              });
                          }
                      }
                  }
                  catch (error) {
                      if (this.continueOnFail()) {
                          if (resource === 'file' && operation === 'download') {
                              items[i] = {
                                  json: {
                                      error: error.message,
                                  },
                              };
                          }
                          else {
                              returnItems.push({
                                  json: {
                                      error: error.message,
                                  },
                                  pairedItem: {
                                      item: i,
                                  },
                              });
                          }
                          continue;
                      }
                      throw error;
                  }
              }
          }
          catch (error) {
              ssh.dispose();
              for (const tempFile of temporaryFiles)
                  await (0, promises_1.rm)(tempFile);
              throw error;
          }
          for (const tempFile of temporaryFiles)
              await (0, promises_1.rm)(tempFile);
          ssh.dispose();
          if (resource === 'file' && operation === 'download') {
              return [items];
          }
          else {
              return [returnItems];
          }
      }
  }
  exports.Ssh = Ssh;
  //# sourceMappingURL=Ssh.node.js.map

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

  # SSH

  The SSH node is useful for executing commands using the Secure Shell Protocol.

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

  ## Operations

  - [**Execute** a command](#execute-command)
  - [**Download** a file](#download-file)
  - [**Upload** a file](#upload-file)

  /// note | Uploading files
  To attach a file for upload, you will need to use an extra node such as the [Read/Write Files from Disk](/integrations/builtin/core-nodes/n8n-nodes-base.readwritefile.md) node or the [HTTP Request](/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/index.md) node to pass the file as a data property.
  ///

  ### Execute Command

  Configure this operation with these parameters:

  - **Credential to connect with**: Select an existing or create a new [SSH credential](/integrations/builtin/credentials/ssh.md) to connect with.
  - **Command**: Enter the command to execute on the remote device.
  - **Working Directory**: Enter the directory where n8n should execute the command.

  ### Download File

  - **Credential to connect with**: Select an existing or create a new [SSH credential](/integrations/builtin/credentials/ssh.md) to connect with.
  - **Path**: Enter the path for the file you want to download. This path must include the file name. The downloaded file will use this file name. To use a different name, use the **File Name** option. Refer to [Download File options](#download-file-options) for more information.
  - **File Property**: Enter the name of the object property that holds the binary data you want to download.

  #### Download File options

  You can further configure this operation with the **File Name** option. Use this option to override the binary data file name to a name of your choice.

  ### Upload File

  - **Credential to connect with**: Select an existing or create a new [SSH credential](/integrations/builtin/credentials/ssh.md) to connect with.
  - **Input Binary Field**: Enter the name of the input binary field that contains the file you want to upload.
  - **Target Directory**: The directory to upload the file to. The name of the file is taken from the binary data file name. To enter a different name, use the **File Name** option. Refer to [Upload File options](#upload-file-options) for more information.

  #### Upload File options

  You can further configure this operation with the **File Name** option. Use this option to override the binary data file name to a name of your choice.

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"29f2a960-25dd-4d6b-9a81-d168f5df7c00","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"07ef16803d7a6bf8c104fdc632004f718426a398a873e1c1af2158cd988d7f32"}}


node_type: n8n-nodes-base.SseTrigger
name: SseTrigger
display_name: SSE Trigger
description: Triggers the workflow when Server-Sent Events occur
category: trigger
icon: fa:cloud-download-alt
code_hash: 05f0871eb011af3c8b264d9249c442aca37fbbc12533aca5e843312cf67942fb
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.ssetrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:31
updated_at: 2025-06-08 09:18:31
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.SseTrigger = void 0;
  const eventsource_1 = __importDefault(require("eventsource"));
  const n8n_workflow_1 = require("n8n-workflow");
  class SseTrigger {
      constructor() {
          this.description = {
              displayName: 'SSE Trigger',
              name: 'sseTrigger',
              icon: 'fa:cloud-download-alt',
              group: ['trigger'],
              version: 1,
              description: 'Triggers the workflow when Server-Sent Events occur',
              eventTriggerDescription: '',
              activationMessage: 'You can now make calls to your SSE URL to trigger executions.',
              defaults: {
                  name: 'SSE Trigger',
                  color: '#225577',
              },
              triggerPanel: {
                  header: '',
                  executionsHelp: {
                      inactive: "<b>While building your workflow</b>, click the 'listen' button, then trigger an SSE event. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Once you're happy with your workflow</b>, <a data-key='activate'>activate</a> it. Then every time a change is detected, the workflow will execute. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.",
                      active: "<b>While building your workflow</b>, click the 'listen' button, then trigger an SSE event. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Your workflow will also execute automatically</b>, since it's activated. Every time a change is detected, this node will trigger an execution. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.",
                  },
                  activationHint: "Once you’ve finished building your workflow, <a data-key='activate'>activate</a> it to have it also listen continuously (you just won’t see those executions here).",
              },
              inputs: [],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'URL',
                      name: 'url',
                      type: 'string',
                      default: '',
                      placeholder: 'http://example.com',
                      description: 'The URL to receive the SSE from',
                      required: true,
                  },
              ],
          };
      }
      async trigger() {
          const url = this.getNodeParameter('url');
          const eventSource = new eventsource_1.default(url);
          eventSource.onmessage = (event) => {
              const eventData = (0, n8n_workflow_1.jsonParse)(event.data, {
                  errorMessage: 'Invalid JSON for event data',
              });
              this.emit([this.helpers.returnJsonArray([eventData])]);
          };
          async function closeFunction() {
              eventSource.close();
          }
          return {
              closeFunction,
          };
      }
  }
  exports.SseTrigger = SseTrigger;
  //# sourceMappingURL=SseTrigger.node.js.map

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

  # SSE Trigger node

  Server-Sent Events (SSE) is a server push technology enabling a client to receive automatic updates from a server using HTTP connection. The SSE Trigger node is used to receive server-sent events.

  ## Node parameters

  The SSE Trigger node has one parameter, the **URL**. Enter the URL from which to receive the server-sent events (SSE).


  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"474782d5-e0b9-43e5-b0fa-a4e7c9180d62","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"88ef091bcd3041d7680f078146a0cd1032c5313a603e8fe0c3d7c2d48e09f6d6"}}


node_type: n8n-nodes-base.Strapi
name: Strapi
display_name: Strapi
description: Consume Strapi API
category: input
icon: file:strapi.svg
code_hash: 6d23d2bca4436fba9185d08178d05af5842389779fe3c06be65ca04239b1eaad
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.strapi
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:31
updated_at: 2025-06-08 09:18:31
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Strapi = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const EntryDescription_1 = require("./EntryDescription");
  class Strapi {
      constructor() {
          this.description = {
              displayName: 'Strapi',
              name: 'strapi',
              icon: 'file:strapi.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Strapi API',
              defaults: {
                  name: 'Strapi',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'strapiApi',
                      required: true,
                      testedBy: 'strapiApiTest',
                      displayOptions: {
                          show: {
                              authentication: ['password'],
                          },
                      },
                  },
                  {
                      name: 'strapiTokenApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['token'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'Username & Password',
                              value: 'password',
                          },
                          {
                              name: 'API Token',
                              value: 'token',
                          },
                      ],
                      default: 'password',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      noDataExpression: true,
                      type: 'options',
                      options: [
                          {
                              name: 'Entry',
                              value: 'entry',
                          },
                      ],
                      default: 'entry',
                  },
                  ...EntryDescription_1.entryOperations,
                  ...EntryDescription_1.entryFields,
              ],
          };
          this.methods = {
              credentialTest: {
                  async strapiApiTest(credential) {
                      const credentials = credential.data;
                      let options = {};
                      const url = (0, GenericFunctions_1.removeTrailingSlash)(credentials.url);
                      options = {
                          headers: {
                              'content-type': 'application/json',
                          },
                          method: 'POST',
                          body: {
                              identifier: credentials.email,
                              password: credentials.password,
                          },
                          uri: credentials.apiVersion === 'v4' ? `${url}/api/auth/local` : `${url}/auth/local`,
                          json: true,
                      };
                      try {
                          await this.helpers.request(options);
                          return {
                              status: 'OK',
                              message: 'Authentication successful',
                          };
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: `Auth settings are not valid: ${error}`,
                          };
                      }
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const qs = {};
          const headers = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          const authenticationMethod = this.getNodeParameter('authentication', 0);
          let apiVersion;
          if (authenticationMethod === 'password') {
              const { jwt } = await GenericFunctions_1.getToken.call(this);
              apiVersion = (await this.getCredentials('strapiApi')).apiVersion;
              headers.Authorization = `Bearer ${jwt}`;
          }
          else {
              apiVersion = (await this.getCredentials('strapiTokenApi')).apiVersion;
          }
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'entry') {
                      if (operation === 'create') {
                          const body = {};
                          const contentType = this.getNodeParameter('contentType', i);
                          const columns = this.getNodeParameter('columns', i);
                          const columnList = columns.split(',').map((column) => column.trim());
                          for (const key of Object.keys(items[i].json)) {
                              if (columnList.includes(key)) {
                                  apiVersion === 'v4'
                                      ? (body.data = items[i].json)
                                      : (body[key] = items[i].json[key]);
                              }
                          }
                          responseData = await GenericFunctions_1.strapiApiRequest.call(this, 'POST', `/${contentType}`, body, qs, undefined, headers);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'delete') {
                          const contentType = this.getNodeParameter('contentType', i);
                          const entryId = this.getNodeParameter('entryId', i);
                          responseData = await GenericFunctions_1.strapiApiRequest.call(this, 'DELETE', `/${contentType}/${entryId}`, {}, qs, undefined, headers);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const contentType = this.getNodeParameter('contentType', i);
                          const options = this.getNodeParameter('options', i);
                          if (apiVersion === 'v4') {
                              if (options.sort && options.sort.length !== 0) {
                                  const sortFields = options.sort;
                                  qs.sort = sortFields.join(',');
                              }
                              if (options.where) {
                                  const query = (0, GenericFunctions_1.validateJSON)(options.where);
                                  if (query !== undefined) {
                                      qs.filters = query;
                                  }
                                  else {
                                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Query must be a valid JSON', {
                                          itemIndex: i,
                                      });
                                  }
                              }
                              if (options.publicationState) {
                                  qs.publicationState = options.publicationState;
                              }
                              if (returnAll) {
                                  responseData = await GenericFunctions_1.strapiApiRequestAllItems.call(this, 'GET', `/${contentType}`, {}, qs, headers, apiVersion);
                              }
                              else {
                                  qs['pagination[pageSize]'] = this.getNodeParameter('limit', i);
                                  ({ data: responseData } = await GenericFunctions_1.strapiApiRequest.call(this, 'GET', `/${contentType}`, {}, qs, undefined, headers));
                              }
                          }
                          else {
                              if (options.sort && options.sort.length !== 0) {
                                  const sortFields = options.sort;
                                  qs._sort = sortFields.join(',');
                              }
                              if (options.where) {
                                  const query = (0, GenericFunctions_1.validateJSON)(options.where);
                                  if (query !== undefined) {
                                      qs._where = query;
                                  }
                                  else {
                                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Query must be a valid JSON', {
                                          itemIndex: i,
                                      });
                                  }
                              }
                              if (options.publicationState) {
                                  qs._publicationState = options.publicationState;
                              }
                              if (returnAll) {
                                  responseData = await GenericFunctions_1.strapiApiRequestAllItems.call(this, 'GET', `/${contentType}`, {}, qs, headers, apiVersion);
                              }
                              else {
                                  qs._limit = this.getNodeParameter('limit', i);
                                  responseData = await GenericFunctions_1.strapiApiRequest.call(this, 'GET', `/${contentType}`, {}, qs, undefined, headers);
                              }
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'get') {
                          const contentType = this.getNodeParameter('contentType', i);
                          const entryId = this.getNodeParameter('entryId', i);
                          responseData = await GenericFunctions_1.strapiApiRequest.call(this, 'GET', `/${contentType}/${entryId}`, {}, qs, undefined, headers);
                          if (apiVersion === 'v4') {
                              responseData = responseData.data;
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      if (operation === 'update') {
                          const body = {};
                          const contentType = this.getNodeParameter('contentType', i);
                          const columns = this.getNodeParameter('columns', i);
                          const updateKey = this.getNodeParameter('updateKey', i);
                          const columnList = columns.split(',').map((column) => column.trim());
                          const entryId = items[i].json[updateKey];
                          for (const key of Object.keys(items[i].json)) {
                              if (columnList.includes(key)) {
                                  apiVersion === 'v4'
                                      ? (body.data = items[i].json)
                                      : (body[key] = items[i].json[key]);
                              }
                          }
                          responseData = await GenericFunctions_1.strapiApiRequest.call(this, 'PUT', `/${contentType}/${entryId}`, body, qs, undefined, headers);
                          if (apiVersion === 'v4') {
                              responseData = responseData.data;
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionErrorData);
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.Strapi = Strapi;
  //# sourceMappingURL=Strapi.node.js.map

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

  # Strapi node

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

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

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

  ## Operations

  * Entry
      * Create
      * Delete
      * Get
      * Get Many
      * Update

  ## Templates and examples

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

  ## Related resources

  Refer to [Strapi's documentation](https://docs.strapi.io/dev-docs/api/rest){:target=_blank .external-link} for more information about the service.

  --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":"3b2d0a21-97d0-4d1a-bae8-fea988d5b5a2","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"020a5734458f6641cacdb8c8932e8b7a019f086f8b1b874c6de2f90de13feb5b"}}


node_type: n8n-nodes-base.StopAndError
name: StopAndError
display_name: Stop and Error
description: Throw an error in the workflow
category: input
icon: fa:exclamation-triangle
code_hash: 79f3b665f4ccdb01a1faacf08233e29fbd6878e69d5d611b5dd2bf0bf9b25308
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.stopanderror
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:31
updated_at: 2025-06-08 09:18:31
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.StopAndError = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const errorObjectPlaceholder = `{
  	"code": "404",
  	"description": "The resource could not be fetched"
  }`;
  class StopAndError {
      constructor() {
          this.description = {
              displayName: 'Stop and Error',
              name: 'stopAndError',
              icon: 'fa:exclamation-triangle',
              group: ['input'],
              version: 1,
              description: 'Throw an error in the workflow',
              defaults: {
                  name: 'Stop and Error',
                  color: '#ff0000',
              },
              inputs: ['main'],
              outputs: [],
              properties: [
                  {
                      displayName: 'Error Type',
                      name: 'errorType',
                      type: 'options',
                      options: [
                          {
                              name: 'Error Message',
                              value: 'errorMessage',
                          },
                          {
                              name: 'Error Object',
                              value: 'errorObject',
                          },
                      ],
                      default: 'errorMessage',
                      description: 'Type of error to throw',
                  },
                  {
                      displayName: 'Error Message',
                      name: 'errorMessage',
                      type: 'string',
                      placeholder: 'An error occurred!',
                      default: '',
                      required: true,
                      displayOptions: {
                          show: {
                              errorType: ['errorMessage'],
                          },
                      },
                  },
                  {
                      displayName: 'Error Object',
                      name: 'errorObject',
                      type: 'json',
                      description: 'Object containing error properties',
                      default: '',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      placeholder: errorObjectPlaceholder,
                      required: true,
                      displayOptions: {
                          show: {
                              errorType: ['errorObject'],
                          },
                      },
                  },
              ],
          };
      }
      async execute() {
          const errorType = this.getNodeParameter('errorType', 0);
          const { id: workflowId, name: workflowName } = this.getWorkflow();
          let toThrow;
          if (errorType === 'errorMessage') {
              toThrow = this.getNodeParameter('errorMessage', 0);
          }
          else {
              const json = this.getNodeParameter('errorObject', 0);
              const errorObject = (0, n8n_workflow_1.jsonParse)(json);
              toThrow = {
                  name: 'User-thrown error',
                  message: `Workflow ID ${workflowId} "${workflowName}" has failed`,
                  ...errorObject,
              };
          }
          throw new n8n_workflow_1.NodeOperationError(this.getNode(), toThrow);
      }
  }
  exports.StopAndError = StopAndError;
  //# sourceMappingURL=StopAndError.node.js.map

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

  # Stop And Error

  Use the Stop And Error node to display custom error messages, cause executions to fail under certain conditions, and send custom error information to error workflows.

  ## Operations

  * Error Message
  * Error Object

  ## Node parameters

  Both operations include one node parameter, the **Error Type**. Use this parameter to select the type of error to throw. Choose between the two operations: **Error Message** and **Error Object**.

  The other parameters depend on which operation you select.

  ### Error Message parameters

  The Error Message Error Type adds one parameter, the **Error Message** field. Enter the message you'd like to throw.

  ### Error Object parameters

  The Error Object Error Type adds one parameter, the **Error Object**. Enter a JSON object that contains the error properties you'd like to throw.

  ## Templates and examples

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

  ## Related resources

  You can use the Stop And Error node with the [Error trigger](/integrations/builtin/core-nodes/n8n-nodes-base.errortrigger.md) node.

  Read more about [Error workflows](/flow-logic/error-handling.md) in n8n workflows.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"34d98fa2-c229-4927-abe8-baeef3517560","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"ae69d1d6304c407a42926bada143701b92b51dabdf2bf1026e04108d4e04ec8d"}}


node_type: n8n-nodes-base.Storyblok
name: Storyblok
display_name: Storyblok
description: Consume Storyblok API
category: output
icon: file:storyblok.svg
code_hash: 883eea1ccd320f86c2501929a0fa7ef6e0721ae17abc05a8e5c65d7b16983f24
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.storyblok
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:31
updated_at: 2025-06-08 09:18:31
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Storyblok = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const StoryContentDescription_1 = require("./StoryContentDescription");
  const StoryManagementDescription_1 = require("./StoryManagementDescription");
  class Storyblok {
      constructor() {
          this.description = {
              displayName: 'Storyblok',
              name: 'storyblok',
              icon: 'file:storyblok.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Storyblok API',
              defaults: {
                  name: 'Storyblok',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'storyblokContentApi',
                      required: true,
                      displayOptions: {
                          show: {
                              source: ['contentApi'],
                          },
                      },
                  },
                  {
                      name: 'storyblokManagementApi',
                      required: true,
                      displayOptions: {
                          show: {
                              source: ['managementApi'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Source',
                      name: 'source',
                      type: 'options',
                      default: 'contentApi',
                      description: 'Pick where your data comes from, Content or Management API',
                      options: [
                          {
                              name: 'Content API',
                              value: 'contentApi',
                          },
                          {
                              name: 'Management API',
                              value: 'managementApi',
                          },
                      ],
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Story',
                              value: 'story',
                          },
                      ],
                      default: 'story',
                      displayOptions: {
                          show: {
                              source: ['contentApi'],
                          },
                      },
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Story',
                              value: 'story',
                          },
                      ],
                      default: 'story',
                      displayOptions: {
                          show: {
                              source: ['managementApi'],
                          },
                      },
                  },
                  ...StoryContentDescription_1.storyContentOperations,
                  ...StoryContentDescription_1.storyContentFields,
                  ...StoryManagementDescription_1.storyManagementOperations,
                  ...StoryManagementDescription_1.storyManagementFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getSpaces() {
                      const returnData = [];
                      const { spaces } = await GenericFunctions_1.storyblokApiRequest.call(this, 'GET', '/v1/spaces');
                      for (const space of spaces) {
                          returnData.push({
                              name: space.name,
                              value: space.id,
                          });
                      }
                      return returnData;
                  },
                  async getComponents() {
                      const returnData = [];
                      const space = this.getCurrentNodeParameter('space');
                      const { components } = await GenericFunctions_1.storyblokApiRequest.call(this, 'GET', `/v1/spaces/${space}/components`);
                      for (const component of components) {
                          returnData.push({
                              name: `${component.name} ${component.is_root ? '(root)' : ''}`,
                              value: component.name,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const qs = {};
          let responseData;
          const source = this.getNodeParameter('source', 0);
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (source === 'contentApi') {
                      if (resource === 'story') {
                          if (operation === 'get') {
                              const identifier = this.getNodeParameter('identifier', i);
                              responseData = await GenericFunctions_1.storyblokApiRequest.call(this, 'GET', `/v1/cdn/stories/${identifier}`);
                              responseData = responseData.story;
                          }
                          if (operation === 'getAll') {
                              const filters = this.getNodeParameter('filters', i);
                              const returnAll = this.getNodeParameter('returnAll', i);
                              Object.assign(qs, filters);
                              if (returnAll) {
                                  responseData = await GenericFunctions_1.storyblokApiRequestAllItems.call(this, 'stories', 'GET', '/v1/cdn/stories', {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.per_page = limit;
                                  responseData = await GenericFunctions_1.storyblokApiRequest.call(this, 'GET', '/v1/cdn/stories', {}, qs);
                                  responseData = responseData.stories;
                              }
                          }
                      }
                  }
                  if (source === 'managementApi') {
                      if (resource === 'story') {
                          if (operation === 'delete') {
                              const space = this.getNodeParameter('space', i);
                              const storyId = this.getNodeParameter('storyId', i);
                              responseData = await GenericFunctions_1.storyblokApiRequest.call(this, 'DELETE', `/v1/spaces/${space}/stories/${storyId}`);
                              responseData = responseData.story;
                          }
                          if (operation === 'get') {
                              const space = this.getNodeParameter('space', i);
                              const storyId = this.getNodeParameter('storyId', i);
                              responseData = await GenericFunctions_1.storyblokApiRequest.call(this, 'GET', `/v1/spaces/${space}/stories/${storyId}`);
                              responseData = responseData.story;
                          }
                          if (operation === 'getAll') {
                              const space = this.getNodeParameter('space', i);
                              const filters = this.getNodeParameter('filters', i);
                              const returnAll = this.getNodeParameter('returnAll', i);
                              Object.assign(qs, filters);
                              if (returnAll) {
                                  responseData = await GenericFunctions_1.storyblokApiRequestAllItems.call(this, 'stories', 'GET', `/v1/spaces/${space}/stories`, {}, qs);
                              }
                              else {
                                  const limit = this.getNodeParameter('limit', i);
                                  qs.per_page = limit;
                                  responseData = await GenericFunctions_1.storyblokApiRequest.call(this, 'GET', `/v1/spaces/${space}/stories`, {}, qs);
                                  responseData = responseData.stories;
                              }
                          }
                          if (operation === 'publish') {
                              const space = this.getNodeParameter('space', i);
                              const storyId = this.getNodeParameter('storyId', i);
                              const options = this.getNodeParameter('options', i);
                              const query = {};
                              if (options.releaseId) {
                                  query.release_id = options.releaseId;
                              }
                              if (options.language) {
                                  query.lang = options.language;
                              }
                              responseData = await GenericFunctions_1.storyblokApiRequest.call(this, 'GET', `/v1/spaces/${space}/stories/${storyId}/publish`, {}, query);
                              responseData = responseData.story;
                          }
                          if (operation === 'unpublish') {
                              const space = this.getNodeParameter('space', i);
                              const storyId = this.getNodeParameter('storyId', i);
                              responseData = await GenericFunctions_1.storyblokApiRequest.call(this, 'GET', `/v1/spaces/${space}/stories/${storyId}/unpublish`);
                              responseData = responseData.story;
                          }
                      }
                  }
                  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.Storyblok = Storyblok;
  //# sourceMappingURL=Storyblok.node.js.map

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

  # Storyblok node

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

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

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

  ## Operations

  ### Content API

  - **Story**
      - Get a story
      - Get all stories


  ### Management API

  - **Story**
      - Delete a story
      - Get a story
      - Get all stories
      - Publish a story
      - Unpublish a story

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"f074fa60-b0ce-446a-b73f-69499ed9ed34","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"fab1ce8c10c5c2a20e317461ea72356cd9a4652d6e274a695715e1f36eeefdec"}}


node_type: n8n-nodes-base.Strava
name: Strava
display_name: Strava
description: Consume Strava API
category: input
icon: file:strava.svg
code_hash: 7a22dfb2e271c2501cb569ed4956c2717f03c82004e50494b33660c19bd5d9a5
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.stravatrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:31
updated_at: 2025-06-08 09:18:31
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Strava = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const ActivityDescription_1 = require("./ActivityDescription");
  const moment_1 = __importDefault(require("moment"));
  class Strava {
      constructor() {
          this.description = {
              displayName: 'Strava',
              name: 'strava',
              icon: 'file:strava.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Strava API',
              defaults: {
                  name: 'Strava',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'stravaOAuth2Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Activity',
                              value: 'activity',
                          },
                      ],
                      default: 'activity',
                  },
                  ...ActivityDescription_1.activityOperations,
                  ...ActivityDescription_1.activityFields,
              ],
          };
      }
      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 === 'activity') {
                      if (operation === 'create') {
                          const name = this.getNodeParameter('name', i);
                          const type = this.getNodeParameter('type', i);
                          const startDate = this.getNodeParameter('startDate', i);
                          const elapsedTime = this.getNodeParameter('elapsedTime', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (additionalFields.trainer === true) {
                              additionalFields.trainer = 1;
                          }
                          if (additionalFields.commute === true) {
                              additionalFields.commute = 1;
                          }
                          const body = {
                              name,
                              type,
                              start_date_local: (0, moment_1.default)(startDate).toISOString(),
                              elapsed_time: elapsedTime,
                          };
                          Object.assign(body, additionalFields);
                          responseData = await GenericFunctions_1.stravaApiRequest.call(this, 'POST', '/activities', body);
                      }
                      if (operation === 'get') {
                          const activityId = this.getNodeParameter('activityId', i);
                          responseData = await GenericFunctions_1.stravaApiRequest.call(this, 'GET', `/activities/${activityId}`);
                      }
                      if (['getLaps', 'getZones', 'getKudos', 'getComments'].includes(operation)) {
                          const path = {
                              getComments: 'comments',
                              getZones: 'zones',
                              getKudos: 'kudos',
                              getLaps: 'laps',
                          };
                          const activityId = this.getNodeParameter('activityId', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          responseData = await GenericFunctions_1.stravaApiRequest.call(this, 'GET', `/activities/${activityId}/${path[operation]}`);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              responseData = responseData.splice(0, limit);
                          }
                      }
                      if (operation === 'getStreams') {
                          const activityId = this.getNodeParameter('activityId', i);
                          const keys = this.getNodeParameter('keys', i);
                          qs.keys = keys.toString();
                          qs.key_by_type = true;
                          responseData = await GenericFunctions_1.stravaApiRequest.call(this, 'GET', `/activities/${activityId}/streams`, {}, qs);
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.stravaApiRequestAllItems.call(this, 'GET', '/activities', {}, qs);
                          }
                          else {
                              qs.per_page = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.stravaApiRequest.call(this, 'GET', '/activities', {}, qs);
                          }
                      }
                      if (operation === 'update') {
                          const activityId = this.getNodeParameter('activityId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {};
                          Object.assign(body, updateFields);
                          responseData = await GenericFunctions_1.stravaApiRequest.call(this, 'PUT', `/activities/${activityId}`, 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.Strava = Strava;
  //# sourceMappingURL=Strava.node.js.map

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

  # Strava Trigger node

  [Strava](https://www.strava.com/){:target=_blank .external-link} is an internet service for tracking human exercise which incorporates social network features.

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

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

  ## Events

  - **\[All\]**
      - \[All\]
      - Created
      - Deleted
      - Updated
  - **Activity**
      - \[All\]
      - Created
      - Deleted
      - Updated
  - **Athlete**
      - \[All\]
      - Created
      - Deleted
      - Updated

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"d7f59eb2-e398-4f23-b9a8-41514833a014","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"369e04ffeda12fb7abd0c0d84ba2ab4ab59f09704b44134755cbc9d840a09dae"}}


node_type: n8n-nodes-base.Stripe
name: Stripe
display_name: Stripe
description: Consume the Stripe API
category: transform
icon: file:stripe.svg
code_hash: a140efa1ba344639e26ed3feb6d57c8e4e5ed6c063161e3d63c831962c1f45ad
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.stripetrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:31
updated_at: 2025-06-08 09:18:31
source_code:
  "use strict";
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Stripe = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
  const helpers_1 = require("./helpers");
  const descriptions_1 = require("./descriptions");
  class Stripe {
      constructor() {
          this.description = {
              displayName: 'Stripe',
              name: 'stripe',
              icon: 'file:stripe.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the Stripe API',
              defaults: {
                  name: 'Stripe',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'stripeApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Balance',
                              value: 'balance',
                          },
                          {
                              name: 'Charge',
                              value: 'charge',
                          },
                          {
                              name: 'Coupon',
                              value: 'coupon',
                          },
                          {
                              name: 'Customer',
                              value: 'customer',
                          },
                          {
                              name: 'Customer Card',
                              value: 'customerCard',
                          },
                          {
                              name: 'Source',
                              value: 'source',
                          },
                          {
                              name: 'Token',
                              value: 'token',
                          },
                      ],
                      default: 'balance',
                  },
                  ...descriptions_1.balanceOperations,
                  ...descriptions_1.customerCardOperations,
                  ...descriptions_1.customerCardFields,
                  ...descriptions_1.chargeOperations,
                  ...descriptions_1.chargeFields,
                  ...descriptions_1.couponOperations,
                  ...descriptions_1.couponFields,
                  ...descriptions_1.customerOperations,
                  ...descriptions_1.customerFields,
                  ...descriptions_1.sourceOperations,
                  ...descriptions_1.sourceFields,
                  ...descriptions_1.tokenOperations,
                  ...descriptions_1.tokenFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getCustomers() {
                      return helpers_1.loadResource.call(this, 'customer');
                  },
                  async getCurrencies() {
                      const returnData = [];
                      const { data } = await helpers_1.stripeApiRequest.call(this, 'GET', '/country_specs', {});
                      for (const currency of data[0].supported_payment_currencies) {
                          returnData.push({
                              name: currency.toUpperCase(),
                              value: currency,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          let responseData;
          const returnData = [];
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'balance') {
                      if (operation === 'get') {
                          responseData = await helpers_1.stripeApiRequest.call(this, 'GET', '/balance', {}, {});
                      }
                  }
                  else if (resource === 'customerCard') {
                      if (operation === 'add') {
                          const body = {
                              source: this.getNodeParameter('token', i),
                          };
                          const customerId = this.getNodeParameter('customerId', i);
                          const endpoint = `/customers/${customerId}/sources`;
                          responseData = await helpers_1.stripeApiRequest.call(this, 'POST', endpoint, body, {});
                      }
                      else if (operation === 'remove') {
                          const customerId = this.getNodeParameter('customerId', i);
                          const cardId = this.getNodeParameter('cardId', i);
                          const endpoint = `/customers/${customerId}/sources/${cardId}`;
                          responseData = await helpers_1.stripeApiRequest.call(this, 'DELETE', endpoint, {}, {});
                      }
                      else if (operation === 'get') {
                          const customerId = this.getNodeParameter('customerId', i);
                          const sourceId = this.getNodeParameter('sourceId', i);
                          const endpoint = `/customers/${customerId}/sources/${sourceId}`;
                          responseData = await helpers_1.stripeApiRequest.call(this, 'GET', endpoint, {}, {});
                      }
                  }
                  else if (resource === 'charge') {
                      if (operation === 'create') {
                          const body = {
                              customer: this.getNodeParameter('customerId', i),
                              currency: this.getNodeParameter('currency', i).toLowerCase(),
                              amount: this.getNodeParameter('amount', i),
                              source: this.getNodeParameter('source', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (!(0, isEmpty_1.default)(additionalFields)) {
                              Object.assign(body, (0, helpers_1.adjustChargeFields)(additionalFields));
                          }
                          responseData = await helpers_1.stripeApiRequest.call(this, 'POST', '/charges', body, {});
                      }
                      else if (operation === 'get') {
                          const chargeId = this.getNodeParameter('chargeId', i);
                          responseData = await helpers_1.stripeApiRequest.call(this, 'GET', `/charges/${chargeId}`, {}, {});
                      }
                      else if (operation === 'getAll') {
                          responseData = await helpers_1.handleListing.call(this, resource, i);
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if ((0, isEmpty_1.default)(updateFields)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i });
                          }
                          Object.assign(body, (0, helpers_1.adjustChargeFields)(updateFields));
                          const chargeId = this.getNodeParameter('chargeId', i);
                          responseData = await helpers_1.stripeApiRequest.call(this, 'POST', `/charges/${chargeId}`, body, {});
                      }
                  }
                  else if (resource === 'coupon') {
                      if (operation === 'create') {
                          const body = {
                              duration: this.getNodeParameter('duration', i),
                          };
                          const type = this.getNodeParameter('type', i);
                          if (type === 'fixedAmount') {
                              body.amount_off = this.getNodeParameter('amountOff', i);
                              body.currency = this.getNodeParameter('currency', i);
                          }
                          else {
                              body.percent_off = this.getNodeParameter('percentOff', i);
                          }
                          responseData = await helpers_1.stripeApiRequest.call(this, 'POST', '/coupons', body, {});
                      }
                      else if (operation === 'getAll') {
                          responseData = await helpers_1.handleListing.call(this, resource, i);
                      }
                  }
                  else if (resource === 'customer') {
                      if (operation === 'create') {
                          const body = {
                              name: this.getNodeParameter('name', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (!(0, isEmpty_1.default)(additionalFields)) {
                              Object.assign(body, (0, helpers_1.adjustCustomerFields)(additionalFields));
                          }
                          responseData = await helpers_1.stripeApiRequest.call(this, 'POST', '/customers', body, {});
                      }
                      else if (operation === 'delete') {
                          const customerId = this.getNodeParameter('customerId', i);
                          responseData = await helpers_1.stripeApiRequest.call(this, 'DELETE', `/customers/${customerId}`, {}, {});
                      }
                      else if (operation === 'get') {
                          const customerId = this.getNodeParameter('customerId', i);
                          responseData = await helpers_1.stripeApiRequest.call(this, 'GET', `/customers/${customerId}`, {}, {});
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          if (!(0, isEmpty_1.default)(filters)) {
                              qs.email = filters.email;
                          }
                          responseData = await helpers_1.handleListing.call(this, resource, i, qs);
                      }
                      else if (operation === 'update') {
                          const body = {};
                          const updateFields = this.getNodeParameter('updateFields', i);
                          if ((0, isEmpty_1.default)(updateFields)) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Please enter at least one field to update for the ${resource}.`, { itemIndex: i });
                          }
                          Object.assign(body, (0, helpers_1.adjustCustomerFields)(updateFields));
                          const customerId = this.getNodeParameter('customerId', i);
                          responseData = await helpers_1.stripeApiRequest.call(this, 'POST', `/customers/${customerId}`, body, {});
                      }
                  }
                  else if (resource === 'source') {
                      if (operation === 'create') {
                          const customerId = this.getNodeParameter('customerId', i);
                          const body = {
                              type: this.getNodeParameter('type', i),
                              amount: this.getNodeParameter('amount', i),
                              currency: this.getNodeParameter('currency', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (!(0, isEmpty_1.default)(additionalFields)) {
                              Object.assign(body, (0, helpers_1.adjustMetadata)(additionalFields));
                          }
                          responseData = await helpers_1.stripeApiRequest.call(this, 'POST', '/sources', body, {});
                          const endpoint = `/customers/${customerId}/sources`;
                          await helpers_1.stripeApiRequest.call(this, 'POST', endpoint, { source: responseData.id }, {});
                      }
                      else if (operation === 'delete') {
                          const sourceId = this.getNodeParameter('sourceId', i);
                          const customerId = this.getNodeParameter('customerId', i);
                          const endpoint = `/customers/${customerId}/sources/${sourceId}`;
                          responseData = await helpers_1.stripeApiRequest.call(this, 'DELETE', endpoint, {}, {});
                      }
                      else if (operation === 'get') {
                          const sourceId = this.getNodeParameter('sourceId', i);
                          responseData = await helpers_1.stripeApiRequest.call(this, 'GET', `/sources/${sourceId}`, {}, {});
                      }
                  }
                  else if (resource === 'token') {
                      if (operation === 'create') {
                          const type = this.getNodeParameter('type', i);
                          const body = {};
                          if (type !== 'cardToken') {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Only card token creation implemented.', { itemIndex: i });
                          }
                          body.card = {
                              number: this.getNodeParameter('number', i),
                              exp_month: this.getNodeParameter('expirationMonth', i),
                              exp_year: this.getNodeParameter('expirationYear', i),
                              cvc: this.getNodeParameter('cvc', i),
                          };
                          responseData = await helpers_1.stripeApiRequest.call(this, 'POST', '/tokens', body, {});
                      }
                  }
              }
              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.Stripe = Stripe;
  //# sourceMappingURL=Stripe.node.js.map

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

  # Stripe Trigger node

  [Stripe](https://stripe.com/){:target=_blank .external-link} is a suite of payment APIs that powers commerce for online businesses.

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

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"473c1cb9-ae9e-46c5-a28c-61e08269f41a","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"fffd635a8f29092cfd5592ce75b25cc2a0baced5f2bc19e6dc962fd21bc3a1c1"}}


node_type: n8n-nodes-base.Supabase
name: Supabase
display_name: Supabase
description: Add, get, delete and update data in a table
category: input
icon: file:supabase.svg
code_hash: 6690085b257b8dfeb9738fd6b9f1ff9c39e50ee8432805b445f1c3c7f934bf41
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:31
updated_at: 2025-06-08 09:18:31
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Supabase = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const RowDescription_1 = require("./RowDescription");
  class Supabase {
      constructor() {
          this.description = {
              displayName: 'Supabase',
              name: 'supabase',
              icon: 'file:supabase.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Add, get, delete and update data in a table',
              defaults: {
                  name: 'Supabase',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'supabaseApi',
                      required: true,
                      testedBy: 'supabaseApiCredentialTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Row',
                              value: 'row',
                          },
                      ],
                      default: 'row',
                  },
                  ...RowDescription_1.rowOperations,
                  ...RowDescription_1.rowFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getTables() {
                      const returnData = [];
                      const { paths } = await GenericFunctions_1.supabaseApiRequest.call(this, 'GET', '/');
                      for (const path of Object.keys(paths)) {
                          if (path === '/')
                              continue;
                          returnData.push({
                              name: path.replace('/', ''),
                              value: path.replace('/', ''),
                          });
                      }
                      return returnData;
                  },
                  async getTableColumns() {
                      const returnData = [];
                      const tableName = this.getCurrentNodeParameter('tableId');
                      const { definitions } = await GenericFunctions_1.supabaseApiRequest.call(this, 'GET', '/');
                      for (const column of Object.keys(definitions[tableName].properties)) {
                          returnData.push({
                              name: `${column} - (${definitions[tableName].properties[column].type})`,
                              value: column,
                          });
                      }
                      return returnData;
                  },
              },
              credentialTest: {
                  async supabaseApiCredentialTest(credential) {
                      try {
                          await GenericFunctions_1.validateCredentials.call(this, credential.data);
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: 'The Service Key is invalid',
                          };
                      }
                      return {
                          status: 'OK',
                          message: 'Connection successful!',
                      };
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const qs = {};
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          if (resource === 'row') {
              if (operation === 'create') {
                  const records = [];
                  const tableId = this.getNodeParameter('tableId', 0);
                  for (let i = 0; i < length; i++) {
                      const record = {};
                      const dataToSend = this.getNodeParameter('dataToSend', 0);
                      if (dataToSend === 'autoMapInputData') {
                          const incomingKeys = Object.keys(items[i].json);
                          const rawInputsToIgnore = this.getNodeParameter('inputsToIgnore', i);
                          const inputDataToIgnore = rawInputsToIgnore.split(',').map((c) => c.trim());
                          for (const key of incomingKeys) {
                              if (inputDataToIgnore.includes(key))
                                  continue;
                              record[key] = items[i].json[key];
                          }
                      }
                      else {
                          const fields = this.getNodeParameter('fieldsUi.fieldValues', i, []);
                          for (const field of fields) {
                              record[`${field.fieldId}`] = field.fieldValue;
                          }
                      }
                      records.push(record);
                  }
                  const endpoint = `/${tableId}`;
                  try {
                      const createdRows = await GenericFunctions_1.supabaseApiRequest.call(this, 'POST', endpoint, records);
                      createdRows.forEach((row, i) => {
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(row), { itemData: { item: i } });
                          returnData.push(...executionData);
                      });
                  }
                  catch (error) {
                      if (this.continueOnFail()) {
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.description }), { itemData: (0, GenericFunctions_1.mapPairedItemsFrom)(records) });
                          returnData.push(...executionData);
                      }
                      else {
                          throw error;
                      }
                  }
              }
              if (operation === 'delete') {
                  const tableId = this.getNodeParameter('tableId', 0);
                  const filterType = this.getNodeParameter('filterType', 0);
                  let endpoint = `/${tableId}`;
                  for (let i = 0; i < length; i++) {
                      if (filterType === 'manual') {
                          const matchType = this.getNodeParameter('matchType', 0);
                          const keys = this.getNodeParameter('filters.conditions', i, []);
                          if (!keys.length) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'At least one select condition must be defined', { itemIndex: i });
                          }
                          if (matchType === 'allFilters') {
                              const data = keys.reduce((obj, value) => (0, GenericFunctions_1.buildQuery)(obj, value), {});
                              Object.assign(qs, data);
                          }
                          if (matchType === 'anyFilter') {
                              const data = keys.map((key) => (0, GenericFunctions_1.buildOrQuery)(key));
                              Object.assign(qs, { or: `(${data.join(',')})` });
                          }
                      }
                      if (filterType === 'string') {
                          const filterString = this.getNodeParameter('filterString', i);
                          endpoint = `${endpoint}?${encodeURI(filterString)}`;
                      }
                      let rows;
                      try {
                          rows = await GenericFunctions_1.supabaseApiRequest.call(this, 'DELETE', endpoint, {}, qs);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.description }), { itemData: { item: i } });
                              returnData.push(...executionData);
                              continue;
                          }
                          throw error;
                      }
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(rows), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'get') {
                  const tableId = this.getNodeParameter('tableId', 0);
                  const endpoint = `/${tableId}`;
                  for (let i = 0; i < length; i++) {
                      const keys = this.getNodeParameter('filters.conditions', i, []);
                      const data = keys.reduce((obj, value) => (0, GenericFunctions_1.buildGetQuery)(obj, value), {});
                      Object.assign(qs, data);
                      let rows;
                      if (!keys.length) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'At least one select condition must be defined', { itemIndex: i });
                      }
                      try {
                          rows = await GenericFunctions_1.supabaseApiRequest.call(this, 'GET', endpoint, {}, qs);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                              returnData.push(...executionData);
                              continue;
                          }
                          throw error;
                      }
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(rows), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'getAll') {
                  const tableId = this.getNodeParameter('tableId', 0);
                  const returnAll = this.getNodeParameter('returnAll', 0);
                  const filterType = this.getNodeParameter('filterType', 0);
                  let endpoint = `/${tableId}`;
                  for (let i = 0; i < length; i++) {
                      if (filterType === 'manual') {
                          const matchType = this.getNodeParameter('matchType', 0);
                          const keys = this.getNodeParameter('filters.conditions', i, []);
                          if (keys.length !== 0) {
                              if (matchType === 'allFilters') {
                                  const data = keys.reduce((obj, value) => (0, GenericFunctions_1.buildQuery)(obj, value), {});
                                  Object.assign(qs, data);
                              }
                              if (matchType === 'anyFilter') {
                                  const data = keys.map((key) => (0, GenericFunctions_1.buildOrQuery)(key));
                                  Object.assign(qs, { or: `(${data.join(',')})` });
                              }
                          }
                      }
                      if (filterType === 'string') {
                          const filterString = this.getNodeParameter('filterString', i);
                          endpoint = `${endpoint}?${encodeURI(filterString)}`;
                      }
                      if (!returnAll) {
                          qs.limit = this.getNodeParameter('limit', 0);
                      }
                      let rows;
                      try {
                          rows = await GenericFunctions_1.supabaseApiRequest.call(this, 'GET', endpoint, {}, qs);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(rows), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.description }), { itemData: { item: i } });
                              returnData.push(...executionData);
                              continue;
                          }
                          throw error;
                      }
                  }
              }
              if (operation === 'update') {
                  const tableId = this.getNodeParameter('tableId', 0);
                  const filterType = this.getNodeParameter('filterType', 0);
                  let endpoint = `/${tableId}`;
                  for (let i = 0; i < length; i++) {
                      if (filterType === 'manual') {
                          const matchType = this.getNodeParameter('matchType', 0);
                          const keys = this.getNodeParameter('filters.conditions', i, []);
                          if (!keys.length) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'At least one select condition must be defined', { itemIndex: i });
                          }
                          if (matchType === 'allFilters') {
                              const data = keys.reduce((obj, value) => (0, GenericFunctions_1.buildQuery)(obj, value), {});
                              Object.assign(qs, data);
                          }
                          if (matchType === 'anyFilter') {
                              const data = keys.map((key) => (0, GenericFunctions_1.buildOrQuery)(key));
                              Object.assign(qs, { or: `(${data.join(',')})` });
                          }
                      }
                      if (filterType === 'string') {
                          const filterString = this.getNodeParameter('filterString', i);
                          endpoint = `${endpoint}?${encodeURI(filterString)}`;
                      }
                      const record = {};
                      const dataToSend = this.getNodeParameter('dataToSend', 0);
                      if (dataToSend === 'autoMapInputData') {
                          const incomingKeys = Object.keys(items[i].json);
                          const rawInputsToIgnore = this.getNodeParameter('inputsToIgnore', i);
                          const inputDataToIgnore = rawInputsToIgnore.split(',').map((c) => c.trim());
                          for (const key of incomingKeys) {
                              if (inputDataToIgnore.includes(key))
                                  continue;
                              record[key] = items[i].json[key];
                          }
                      }
                      else {
                          const fields = this.getNodeParameter('fieldsUi.fieldValues', i, []);
                          for (const field of fields) {
                              record[`${field.fieldId}`] = field.fieldValue;
                          }
                      }
                      let updatedRow;
                      try {
                          updatedRow = await GenericFunctions_1.supabaseApiRequest.call(this, 'PATCH', endpoint, record, qs);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(updatedRow), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      catch (error) {
                          if (this.continueOnFail()) {
                              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.description }), { itemData: { item: i } });
                              returnData.push(...executionData);
                              continue;
                          }
                          throw error;
                      }
                  }
              }
          }
          return [returnData];
      }
  }
  exports.Supabase = Supabase;
  //# sourceMappingURL=Supabase.node.js.map

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

  # Supabase Vector Store node

  Use the Supabase Vector Store to interact with your Supabase database as [vector store](/glossary.md#ai-vector-store). You can insert documents into a vector database, get documents from a vector database, retrieve documents to provide them to a retriever connected to a [chain](/glossary.md#ai-chain), or connect it directly to an [agent](/glossary.md#ai-agent) to use as a [tool](/glossary.md#ai-tool).

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

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

  --8<-- "_snippets/integrations/builtin/cluster-nodes/sub-node-expression-resolution.md"
  	
  Supabase provides a [quickstart for setting up your vector store](https://supabase.com/docs/guides/ai/langchain?database-method=sql){:target=_blank .external-link}. If you use settings other than the defaults in the quickstart, this may affect parameter settings in n8n. Make sure you understand what you're doing.

  ## Node usage patterns

  You can use the Supabase Vector Store node in the following patterns.

  ### Use as a regular node to insert, update, and retrieve documents

  You can use the Supabase Vector Store as a regular node to insert, update, or get documents. This pattern places the Supabase Vector Store in the regular connection flow without using an agent.

  You can see an example of this in scenario 1 of [this template](https://n8n.io/workflows/2621-ai-agent-to-chat-with-files-in-supabase-storage/).

  ### Connect directly to an AI agent as a tool

  You can connect the Supabase Vector Store node directly to the tool connector of an [AI agent](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/index.md) to use a vector store as a resource when answering queries.

  Here, the connection would be: AI agent (tools connector) -> Supabase Vector Store node.

  ### Use a retriever to fetch documents

  You can use the [Vector Store Retriever](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.retrievervectorstore.md) node with the Supabase Vector Store node to fetch documents from the Supabase Vector Store node. This is often used with the [Question and Answer Chain](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainretrievalqa/index.md) node to fetch documents from the vector store that match the given chat input.

  An [example of the connection flow](https://n8n.io/workflows/1960-ask-questions-about-a-pdf-using-ai/) (the example uses Pinecone, but the pattern in the same) would be: Question and Answer Chain (Retriever connector) -> Vector Store Retriever (Vector Store connector) -> Supabase Vector Store.

  ### Use the Vector Store Question Answer Tool to answer questions

  Another pattern uses the [Vector Store Question Answer Tool](/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolvectorstore.md) to summarize results and answer questions from the Supabase Vector Store node. Rather than connecting the Supabase Vector Store directly as a tool, this pattern uses a tool specifically designed to summarizes data in the vector store.

  The [connections flow](https://n8n.io/workflows/2621-ai-agent-to-chat-with-files-in-supabase-storage/) in this case would look like this: AI agent (tools connector) -> Vector Store Question Answer Tool (Vector Store connector) -> Supabase Vector store.

  ## Node parameters

  --8<-- "_snippets/integrations/builtin/cluster-nodes/vector-store-mode-with-update.md"

  <!-- vale from-write-good.Weasel = NO -->
  ### Get Many parameters
  <!-- vale from-write-good.Weasel = YES -->

  * **Table Name**: Enter the Supabase table to use.
  * **Prompt**: Enter the search query.
  * **Limit**: Enter how many results to retrieve from the vector store. For example, set this to `10` to get the ten best results.

  ### Insert Documents parameters

  * **Table Name**: Enter the Supabase table to use.

  ### Retrieve Documents (As Vector Store for Chain/Tool) parameters

  * **Table Name**: Enter the Supabase table to use.

  ### Retrieve Documents (As Tool for AI Agent) parameters

  * **Name**: The name of the vector store.
  * **Description**: Explain to the LLM what this tool does. A good, specific description allows LLMs to produce expected results more often.
  * **Table Name**: Enter the Supabase table to use.
  * **Limit**: Enter how many results to retrieve from the vector store. For example, set this to `10` to get the ten best results.

  ### Update Documents

  * **Table Name**: Enter the Supabase table to use.
  * **ID**: The ID of an embedding entry.

  ## Node options

  ### Query Name

  The name of the matching function you set up in Supabase. If you follow the [Supabase quickstart](https://supabase.com/docs/guides/ai/langchain?database-method=sql){:target=_blank .external-link}, this will be `match_documents`.

  ### Metadata Filter

  --8<-- "_snippets/integrations/builtin/cluster-nodes/langchain-root-nodes/vector-store-metadata-filter.md"

  ## Templates and examples

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

  ## Related resources

  Refer to [LangChain's Supabase documentation](https://js.langchain.com/docs/integrations/vectorstores/supabase/){:target=_blank .external-link} for more information about the service.

  --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/root-nodes/n8n-nodes-langchain.vectorstoresupabase

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"ab169175-1575-4fbd-8d02-2b1be5f18932","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"82097c648d809db1325f4991c8962b7801b423de576890de5e2f0619d5e9b68a"}}


node_type: n8n-nodes-base.Switch
name: Switch
display_name: Switch
description: Route items depending on defined expression or rules
category: transform
icon: fa:map-signs
code_hash: c1b9c3794375e6db2acbdf04c54a05bfeec3053a08c530f04f57e173953e77c9
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.switch
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 09:18:31
updated_at: 2025-06-08 09:18:31
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Switch = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const SwitchV1_node_1 = require("./V1/SwitchV1.node");
  const SwitchV2_node_1 = require("./V2/SwitchV2.node");
  class Switch extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'Switch',
              name: 'switch',
              icon: 'fa:map-signs',
              group: ['transform'],
              description: 'Route items depending on defined expression or rules',
              defaultVersion: 2,
          };
          const nodeVersions = {
              1: new SwitchV1_node_1.SwitchV1(baseDescription),
              2: new SwitchV2_node_1.SwitchV2(baseDescription),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.Switch = Switch;
  //# sourceMappingURL=Switch.node.js.map

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

  # Switch

  Use the Switch node to route a workflow conditionally based on comparison operations. It's similar to the [IF](/integrations/builtin/core-nodes/n8n-nodes-base.if.md) node, but supports multiple output routes.

  ## Node parameters

  Select the **Mode** the node should use:

  * **Rules**: Select this mode to build a matching rule for each output.
  * **Expression**: Select this mode to write an expression to return the output index programmatically.

  Node configuration depends on the **Mode** you select.

  ### Rules

  To configure the node with this operation, use these parameters:

  * Create **Routing Rules** to define comparison conditions.
      * Use the data type dropdown to select the data type and comparison operation type for your condition. For example, to create a rules 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.
  * **Rename Output**: Turn this control on to rename the output field to put matching data into. Enter your desired **Output Name**.

  Select **Add Routing Rule** to add more rules.

  #### Rule options

  You can further configure the node with this operation using these **Options**:

  - **Fallback Output**: Choose how to route the workflow when an item doesn't match any of the rules or conditions.
      - **None**: Ignore the item. This is the default behavior.
      - **Extra Output**: Send items to an extra, separate output.
      - **Output 0**: Send items to the same output as those matching the first rule.
  - **Ignore Case**: Set whether to ignore letter case when evaluating conditions (turned on) or enforce letter case (turned off).
  - **Less Strict Type Validation**: Set whether you want n8n to attempt to convert value types based on the operator you choose (turned on) or not (turned off).
  - **Send data to all matching outputs**: Set whether to send data to all outputs meeting conditions (turned on) or whether to send the data to the first output matching the conditions (turned off).

  ### Expression

  To configure the node with this operation, use these parameters:

  - **Number of Outputs**: Set how many outputs the node should have.
  - **Output Index**: Create an expression to calculate which input item should be routed to which output. The expression must return a number.

  ## Templates and examples

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

  ## Related resources

  Refer to [Splitting with conditionals](/flow-logic/splitting.md) for more information on using conditionals to create complex logic in n8n.

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"87241984-1c0e-469c-83c8-9ee8da64fdf9","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"91343a4cc62ee9b7165268bfb502bd239e08d3837e179c02883a5d8cb37864af"}}


node_type: n8n-nodes-base.Telegram
name: Telegram
display_name: Telegram
description: Sends data to Telegram
category: output
icon: file:telegram.svg
code_hash: f3c5a39bf643219deb3a2978b9bea87fc66b9bd893b076fa8339233a39fd38c7
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 09:18:33
updated_at: 2025-06-08 09:18:33
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Telegram = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  class Telegram {
      constructor() {
          this.description = {
              displayName: 'Telegram',
              name: 'telegram',
              icon: 'file:telegram.svg',
              group: ['output'],
              version: [1, 1.1],
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Sends data to Telegram',
              defaults: {
                  name: 'Telegram',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'telegramApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Chat',
                              value: 'chat',
                          },
                          {
                              name: 'Callback',
                              value: 'callback',
                          },
                          {
                              name: 'File',
                              value: 'file',
                          },
                          {
                              name: 'Message',
                              value: 'message',
                          },
                      ],
                      default: 'message',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['chat'],
                          },
                      },
                      options: [
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get up to date information about a chat',
                              action: 'Get a chat',
                          },
                          {
                              name: 'Get Administrators',
                              value: 'administrators',
                              description: 'Get the Administrators of a chat',
                              action: 'Get all administrators in a chat',
                          },
                          {
                              name: 'Get Member',
                              value: 'member',
                              description: 'Get the member of a chat',
                              action: 'Get a member in a chat',
                          },
                          {
                              name: 'Leave',
                              value: 'leave',
                              description: 'Leave a group, supergroup or channel',
                              action: 'Leave a chat',
                          },
                          {
                              name: 'Set Description',
                              value: 'setDescription',
                              description: 'Set the description of a chat',
                              action: 'Set description on a chat',
                          },
                          {
                              name: 'Set Title',
                              value: 'setTitle',
                              description: 'Set the title of a chat',
                              action: 'Set a title on a chat',
                          },
                      ],
                      default: 'get',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['callback'],
                          },
                      },
                      options: [
                          {
                              name: 'Answer Query',
                              value: 'answerQuery',
                              description: 'Send answer to callback query sent from inline keyboard',
                              action: 'Answer Query a callback',
                          },
                          {
                              name: 'Answer Inline Query',
                              value: 'answerInlineQuery',
                              description: 'Send answer to callback query sent from inline bot',
                              action: 'Answer an inline query callback',
                          },
                      ],
                      default: 'answerQuery',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['file'],
                          },
                      },
                      options: [
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a file',
                              action: 'Get a file',
                          },
                      ],
                      default: 'get',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      displayOptions: {
                          show: {
                              resource: ['message'],
                          },
                      },
                      options: [
                          {
                              name: 'Delete Chat Message',
                              value: 'deleteMessage',
                              description: 'Delete a chat message',
                              action: 'Delete a chat message',
                          },
                          {
                              name: 'Edit Message Text',
                              value: 'editMessageText',
                              description: 'Edit a text message',
                              action: 'Edit a test message',
                          },
                          {
                              name: 'Pin Chat Message',
                              value: 'pinChatMessage',
                              description: 'Pin a chat message',
                              action: 'Pin a chat message',
                          },
                          {
                              name: 'Send Animation',
                              value: 'sendAnimation',
                              description: 'Send an animated file',
                              action: 'Send an animated file',
                          },
                          {
                              name: 'Send Audio',
                              value: 'sendAudio',
                              description: 'Send a audio file',
                              action: 'Send an audio file',
                          },
                          {
                              name: 'Send Chat Action',
                              value: 'sendChatAction',
                              description: 'Send a chat action',
                              action: 'Send a chat action',
                          },
                          {
                              name: 'Send Document',
                              value: 'sendDocument',
                              description: 'Send a document',
                              action: 'Send a document',
                          },
                          {
                              name: 'Send Location',
                              value: 'sendLocation',
                              description: 'Send a location',
                              action: 'Send a location',
                          },
                          {
                              name: 'Send Media Group',
                              value: 'sendMediaGroup',
                              description: 'Send group of photos or videos to album',
                              action: 'Send a media group message',
                          },
                          {
                              name: 'Send Message',
                              value: 'sendMessage',
                              description: 'Send a text message',
                              action: 'Send a text message',
                          },
                          {
                              name: 'Send Photo',
                              value: 'sendPhoto',
                              description: 'Send a photo',
                              action: 'Send a photo message',
                          },
                          {
                              name: 'Send Sticker',
                              value: 'sendSticker',
                              description: 'Send a sticker',
                              action: 'Send a sticker',
                          },
                          {
                              name: 'Send Video',
                              value: 'sendVideo',
                              description: 'Send a video',
                              action: 'Send a video',
                          },
                          {
                              name: 'Unpin Chat Message',
                              value: 'unpinChatMessage',
                              description: 'Unpin a chat message',
                              action: 'Unpin a chat message',
                          },
                      ],
                      default: 'sendMessage',
                  },
                  {
                      displayName: 'Chat ID',
                      name: 'chatId',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: [
                                  'administrators',
                                  'deleteMessage',
                                  'get',
                                  'leave',
                                  'member',
                                  'pinChatMessage',
                                  'setDescription',
                                  'setTitle',
                                  'sendAnimation',
                                  'sendAudio',
                                  'sendChatAction',
                                  'sendDocument',
                                  'sendLocation',
                                  'sendMessage',
                                  'sendMediaGroup',
                                  'sendPhoto',
                                  'sendSticker',
                                  'sendVideo',
                                  'unpinChatMessage',
                              ],
                              resource: ['chat', 'message'],
                          },
                      },
                      required: true,
                      description: 'Unique identifier for the target chat or username of the target channel (in the format @channelusername)',
                  },
                  {
                      displayName: 'Message ID',
                      name: 'messageId',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['deleteMessage'],
                              resource: ['message'],
                          },
                      },
                      required: true,
                      description: 'Unique identifier of the message to delete',
                  },
                  {
                      displayName: 'Message ID',
                      name: 'messageId',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['pinChatMessage', 'unpinChatMessage'],
                              resource: ['message'],
                          },
                      },
                      required: true,
                      description: 'Unique identifier of the message to pin or unpin',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      displayOptions: {
                          show: {
                              operation: ['pinChatMessage'],
                              resource: ['message'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Disable Notification',
                              name: 'disable_notification',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to send a notification to all chat members about the new pinned message',
                          },
                      ],
                  },
                  {
                      displayName: 'User ID',
                      name: 'userId',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['member'],
                              resource: ['chat'],
                          },
                      },
                      required: true,
                      description: 'Unique identifier of the target user',
                  },
                  {
                      displayName: 'Description',
                      name: 'description',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['setDescription'],
                              resource: ['chat'],
                          },
                      },
                      required: true,
                      description: 'New chat description, 0-255 characters',
                  },
                  {
                      displayName: 'Title',
                      name: 'title',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['setTitle'],
                              resource: ['chat'],
                          },
                      },
                      required: true,
                      description: 'New chat title, 1-255 characters',
                  },
                  {
                      displayName: 'Query ID',
                      name: 'queryId',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['answerQuery'],
                              resource: ['callback'],
                          },
                      },
                      required: true,
                      description: 'Unique identifier for the query to be answered',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      displayOptions: {
                          show: {
                              operation: ['answerQuery'],
                              resource: ['callback'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Cache Time',
                              name: 'cache_time',
                              type: 'number',
                              typeOptions: {
                                  minValue: 0,
                              },
                              default: 0,
                              description: 'The maximum amount of time in seconds that the result of the callback query may be cached client-side',
                          },
                          {
                              displayName: 'Show Alert',
                              name: 'show_alert',
                              type: 'boolean',
                              default: false,
                              description: 'Whether an alert will be shown by the client instead of a notification at the top of the chat screen',
                          },
                          {
                              displayName: 'Text',
                              name: 'text',
                              type: 'string',
                              default: '',
                              description: 'Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters.',
                          },
                          {
                              displayName: 'URL',
                              name: 'url',
                              type: 'string',
                              default: '',
                              description: "URL that will be opened by the user's client",
                          },
                      ],
                  },
                  {
                      displayName: 'Query ID',
                      name: 'queryId',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['answerInlineQuery'],
                              resource: ['callback'],
                          },
                      },
                      required: true,
                      description: 'Unique identifier for the answered query',
                  },
                  {
                      displayName: 'Results',
                      name: 'results',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['answerInlineQuery'],
                              resource: ['callback'],
                          },
                      },
                      required: true,
                      description: 'A JSON-serialized array of results for the inline query',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      displayOptions: {
                          show: {
                              operation: ['answerInlineQuery'],
                              resource: ['callback'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Cache Time',
                              name: 'cache_time',
                              type: 'number',
                              typeOptions: {
                                  minValue: 0,
                              },
                              default: 0,
                              description: 'The maximum amount of time in seconds that the result of the callback query may be cached client-side',
                          },
                          {
                              displayName: 'Show Alert',
                              name: 'show_alert',
                              type: 'boolean',
                              default: false,
                              description: 'Whether an alert will be shown by the client instead of a notification at the top of the chat screen',
                          },
                          {
                              displayName: 'Text',
                              name: 'text',
                              type: 'string',
                              default: '',
                              description: 'Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters.',
                          },
                          {
                              displayName: 'URL',
                              name: 'url',
                              type: 'string',
                              default: '',
                              description: "URL that will be opened by the user's client",
                          },
                      ],
                  },
                  {
                      displayName: 'File ID',
                      name: 'fileId',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['get'],
                              resource: ['file'],
                          },
                      },
                      required: true,
                      description: 'The ID of the file',
                  },
                  {
                      displayName: 'Download',
                      name: 'download',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['get'],
                              resource: ['file'],
                          },
                      },
                      default: true,
                      description: 'Whether to download the file',
                  },
                  {
                      displayName: 'Message Type',
                      name: 'messageType',
                      type: 'options',
                      displayOptions: {
                          show: {
                              operation: ['editMessageText'],
                              resource: ['message'],
                          },
                      },
                      options: [
                          {
                              name: 'Inline Message',
                              value: 'inlineMessage',
                          },
                          {
                              name: 'Message',
                              value: 'message',
                          },
                      ],
                      default: 'message',
                      description: 'The type of the message to edit',
                  },
                  {
                      displayName: 'Chat ID',
                      name: 'chatId',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              messageType: ['message'],
                              operation: ['editMessageText'],
                              resource: ['message'],
                          },
                      },
                      required: true,
                      description: 'Unique identifier for the target chat or username of the target channel (in the format @channelusername). To find your chat ID ask @get_id_bot.',
                  },
                  {
                      displayName: 'Binary Data',
                      name: 'binaryData',
                      type: 'boolean',
                      default: false,
                      required: true,
                      displayOptions: {
                          show: {
                              operation: [
                                  'sendAnimation',
                                  'sendAudio',
                                  'sendDocument',
                                  'sendPhoto',
                                  'sendVideo',
                                  'sendSticker',
                              ],
                              resource: ['message'],
                          },
                      },
                      description: 'Whether the data to upload should be taken from binary field',
                  },
                  {
                      displayName: 'Binary Property',
                      name: 'binaryPropertyName',
                      type: 'string',
                      default: 'data',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: [
                                  'sendAnimation',
                                  'sendAudio',
                                  'sendDocument',
                                  'sendPhoto',
                                  'sendVideo',
                                  'sendSticker',
                              ],
                              resource: ['message'],
                              binaryData: [true],
                          },
                      },
                      placeholder: '',
                      description: 'Name of the binary property that contains the data to upload',
                  },
                  {
                      displayName: 'Message ID',
                      name: 'messageId',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              messageType: ['message'],
                              operation: ['editMessageText'],
                              resource: ['message'],
                          },
                      },
                      required: true,
                      description: 'Unique identifier of the message to edit',
                  },
                  {
                      displayName: 'Inline Message ID',
                      name: 'inlineMessageId',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              messageType: ['inlineMessage'],
                              operation: ['editMessageText'],
                              resource: ['message'],
                          },
                      },
                      required: true,
                      description: 'Unique identifier of the inline message to edit',
                  },
                  {
                      displayName: 'Reply Markup',
                      name: 'replyMarkup',
                      displayOptions: {
                          show: {
                              operation: ['editMessageText'],
                              resource: ['message'],
                          },
                      },
                      type: 'options',
                      options: [
                          {
                              name: 'None',
                              value: 'none',
                          },
                          {
                              name: 'Inline Keyboard',
                              value: 'inlineKeyboard',
                          },
                      ],
                      default: 'none',
                      description: 'Additional interface options',
                  },
                  {
                      displayName: 'Animation',
                      name: 'file',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['sendAnimation'],
                              resource: ['message'],
                              binaryData: [false],
                          },
                      },
                      description: 'Animation to send. Pass a file_id to send an animation that exists on the Telegram servers (recommended), an HTTP URL for Telegram to get an animation from the Internet.',
                  },
                  {
                      displayName: 'Audio',
                      name: 'file',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['sendAudio'],
                              resource: ['message'],
                              binaryData: [false],
                          },
                      },
                      description: 'Audio file to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), an HTTP URL for Telegram to get a file from the Internet.',
                  },
                  {
                      displayName: 'Action',
                      name: 'action',
                      type: 'options',
                      displayOptions: {
                          show: {
                              operation: ['sendChatAction'],
                              resource: ['message'],
                          },
                      },
                      options: [
                          {
                              name: 'Find Location',
                              value: 'find_location',
                              action: 'Find location',
                          },
                          {
                              name: 'Record Audio',
                              value: 'record_audio',
                              action: 'Record audio',
                          },
                          {
                              name: 'Record Video',
                              value: 'record_video',
                              action: 'Record video',
                          },
                          {
                              name: 'Record Video Note',
                              value: 'record_video_note',
                              action: 'Record video note',
                          },
                          {
                              name: 'Typing',
                              value: 'typing',
                              action: 'Typing a message',
                          },
                          {
                              name: 'Upload Audio',
                              value: 'upload_audio',
                              action: 'Upload audio',
                          },
                          {
                              name: 'Upload Document',
                              value: 'upload_document',
                              action: 'Upload document',
                          },
                          {
                              name: 'Upload Photo',
                              value: 'upload_photo',
                              action: 'Upload photo',
                          },
                          {
                              name: 'Upload Video',
                              value: 'upload_video',
                              action: 'Upload video',
                          },
                          {
                              name: 'Upload Video Note',
                              value: 'upload_video_note',
                              action: 'Upload video note',
                          },
                      ],
                      default: 'typing',
                      description: 'Type of action to broadcast. Choose one, depending on what the user is about to receive. The status is set for 5 seconds or less (when a message arrives from your bot).',
                  },
                  {
                      displayName: 'Document',
                      name: 'file',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['sendDocument'],
                              resource: ['message'],
                              binaryData: [false],
                          },
                      },
                      description: 'Document to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), an HTTP URL for Telegram to get a file from the Internet.',
                  },
                  {
                      displayName: 'Latitude',
                      name: 'latitude',
                      type: 'number',
                      default: 0.0,
                      typeOptions: {
                          numberPrecision: 10,
                          minValue: -90,
                          maxValue: 90,
                      },
                      displayOptions: {
                          show: {
                              operation: ['sendLocation'],
                              resource: ['message'],
                          },
                      },
                      description: 'Location latitude',
                  },
                  {
                      displayName: 'Longitude',
                      name: 'longitude',
                      type: 'number',
                      typeOptions: {
                          numberPrecision: 10,
                          minValue: -180,
                          maxValue: 180,
                      },
                      default: 0.0,
                      displayOptions: {
                          show: {
                              operation: ['sendLocation'],
                              resource: ['message'],
                          },
                      },
                      description: 'Location longitude',
                  },
                  {
                      displayName: 'Media',
                      name: 'media',
                      type: 'fixedCollection',
                      displayOptions: {
                          show: {
                              operation: ['sendMediaGroup'],
                              resource: ['message'],
                          },
                      },
                      description: 'The media to add',
                      placeholder: 'Add Media',
                      typeOptions: {
                          multipleValues: true,
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Media',
                              name: 'media',
                              values: [
                                  {
                                      displayName: 'Type',
                                      name: 'type',
                                      type: 'options',
                                      options: [
                                          {
                                              name: 'Photo',
                                              value: 'photo',
                                          },
                                          {
                                              name: 'Video',
                                              value: 'video',
                                          },
                                      ],
                                      default: 'photo',
                                      description: 'The type of the media to add',
                                  },
                                  {
                                      displayName: 'Media File',
                                      name: 'media',
                                      type: 'string',
                                      default: '',
                                      description: 'Media to send. Pass a file_id to send a file that exists on the Telegram servers (recommended) or pass an HTTP URL for Telegram to get a file from the Internet.',
                                  },
                                  {
                                      displayName: 'Additional Fields',
                                      name: 'additionalFields',
                                      type: 'collection',
                                      placeholder: 'Add Field',
                                      default: {},
                                      options: [
                                          {
                                              displayName: 'Caption',
                                              name: 'caption',
                                              type: 'string',
                                              default: '',
                                              description: 'Caption text to set, 0-1024 characters',
                                          },
                                          {
                                              displayName: 'Parse Mode',
                                              name: 'parse_mode',
                                              type: 'options',
                                              options: [
                                                  {
                                                      name: 'Markdown',
                                                      value: 'Markdown',
                                                  },
                                                  {
                                                      name: 'HTML',
                                                      value: 'HTML',
                                                  },
                                              ],
                                              default: 'HTML',
                                              description: 'How to parse the text',
                                          },
                                      ],
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Text',
                      name: 'text',
                      type: 'string',
                      required: true,
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['editMessageText', 'sendMessage'],
                              resource: ['message'],
                          },
                      },
                      description: 'Text of the message to be sent',
                  },
                  {
                      displayName: 'Photo',
                      name: 'file',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['sendPhoto'],
                              resource: ['message'],
                              binaryData: [false],
                          },
                      },
                      description: 'Photo to send. Pass a file_id to send a photo that exists on the Telegram servers (recommended), an HTTP URL for Telegram to get a photo from the Internet.',
                  },
                  {
                      displayName: 'Sticker',
                      name: 'file',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['sendSticker'],
                              resource: ['message'],
                              binaryData: [false],
                          },
                      },
                      description: 'Sticker to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), an HTTP URL for Telegram to get a .webp file from the Internet.',
                  },
                  {
                      displayName: 'Video',
                      name: 'file',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['sendVideo'],
                              resource: ['message'],
                              binaryData: [false],
                          },
                      },
                      description: 'Video file to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), an HTTP URL for Telegram to get a file from the Internet.',
                  },
                  {
                      displayName: 'Reply Markup',
                      name: 'replyMarkup',
                      displayOptions: {
                          show: {
                              operation: [
                                  'sendAnimation',
                                  'sendDocument',
                                  'sendMessage',
                                  'sendPhoto',
                                  'sendSticker',
                                  'sendVideo',
                                  'sendAudio',
                                  'sendLocation',
                              ],
                              resource: ['message'],
                          },
                      },
                      type: 'options',
                      options: [
                          {
                              name: 'Force Reply',
                              value: 'forceReply',
                          },
                          {
                              name: 'Inline Keyboard',
                              value: 'inlineKeyboard',
                          },
                          {
                              name: 'None',
                              value: 'none',
                          },
                          {
                              name: 'Reply Keyboard',
                              value: 'replyKeyboard',
                          },
                          {
                              name: 'Reply Keyboard Remove',
                              value: 'replyKeyboardRemove',
                          },
                      ],
                      default: 'none',
                      description: 'Additional interface options',
                  },
                  {
                      displayName: 'Force Reply',
                      name: 'forceReply',
                      type: 'collection',
                      placeholder: 'Add Field',
                      displayOptions: {
                          show: {
                              replyMarkup: ['forceReply'],
                              resource: ['message'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Force Reply',
                              name: 'force_reply',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to show reply interface to the user, as if they manually selected the bot‘s message and tapped ’Reply',
                          },
                          {
                              displayName: 'Selective',
                              name: 'selective',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to force reply from specific users only',
                          },
                      ],
                  },
                  {
                      displayName: 'Inline Keyboard',
                      name: 'inlineKeyboard',
                      placeholder: 'Add Keyboard Row',
                      description: 'Adds an inline keyboard that appears right next to the message it belongs to',
                      type: 'fixedCollection',
                      typeOptions: {
                          multipleValues: true,
                      },
                      displayOptions: {
                          show: {
                              replyMarkup: ['inlineKeyboard'],
                              resource: ['message'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Rows',
                              name: 'rows',
                              values: [
                                  {
                                      displayName: 'Row',
                                      name: 'row',
                                      type: 'fixedCollection',
                                      description: 'The value to set',
                                      placeholder: 'Add Button',
                                      typeOptions: {
                                          multipleValues: true,
                                      },
                                      default: {},
                                      options: [
                                          {
                                              displayName: 'Buttons',
                                              name: 'buttons',
                                              values: [
                                                  {
                                                      displayName: 'Text',
                                                      name: 'text',
                                                      type: 'string',
                                                      default: '',
                                                      description: 'Label text on the button',
                                                  },
                                                  {
                                                      displayName: 'Additional Fields',
                                                      name: 'additionalFields',
                                                      type: 'collection',
                                                      placeholder: 'Add Field',
                                                      default: {},
                                                      options: [
                                                          {
                                                              displayName: 'Callback Data',
                                                              name: 'callback_data',
                                                              type: 'string',
                                                              default: '',
                                                              description: 'Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes',
                                                          },
                                                          {
                                                              displayName: 'Pay',
                                                              name: 'pay',
                                                              type: 'boolean',
                                                              default: false,
                                                              description: 'Whether to send a Pay button',
                                                          },
                                                          {
                                                              displayName: 'Switch Inline Query Current Chat',
                                                              name: 'switch_inline_query_current_chat',
                                                              type: 'string',
                                                              default: '',
                                                              description: "If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat's input field.Can be empty, in which case only the bot’s username will be inserted",
                                                          },
                                                          {
                                                              displayName: 'Switch Inline Query',
                                                              name: 'switch_inline_query',
                                                              type: 'string',
                                                              default: '',
                                                              description: 'If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot‘s username and the specified inline query in the input field. Can be empty, in which case just the bot’s username will be inserted.',
                                                          },
                                                          {
                                                              displayName: 'URL',
                                                              name: 'url',
                                                              type: 'string',
                                                              default: '',
                                                              description: 'HTTP or tg:// URL to be opened when button is pressed',
                                                          },
                                                      ],
                                                  },
                                              ],
                                          },
                                      ],
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Reply Keyboard',
                      name: 'replyKeyboard',
                      placeholder: 'Add Reply Keyboard Row',
                      description: 'Adds a custom keyboard with reply options',
                      type: 'fixedCollection',
                      typeOptions: {
                          multipleValues: true,
                      },
                      displayOptions: {
                          show: {
                              replyMarkup: ['replyKeyboard'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Rows',
                              name: 'rows',
                              values: [
                                  {
                                      displayName: 'Row',
                                      name: 'row',
                                      type: 'fixedCollection',
                                      description: 'The value to set',
                                      placeholder: 'Add Button',
                                      typeOptions: {
                                          multipleValues: true,
                                      },
                                      default: {},
                                      options: [
                                          {
                                              displayName: 'Buttons',
                                              name: 'buttons',
                                              values: [
                                                  {
                                                      displayName: 'Text',
                                                      name: 'text',
                                                      type: 'string',
                                                      default: '',
                                                      description: 'Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed.',
                                                  },
                                                  {
                                                      displayName: 'Additional Fields',
                                                      name: 'additionalFields',
                                                      type: 'collection',
                                                      placeholder: 'Add Field',
                                                      default: {},
                                                      options: [
                                                          {
                                                              displayName: 'Request Contact',
                                                              name: 'request_contact',
                                                              type: 'boolean',
                                                              default: false,
                                                              description: "Whether the user's phone number will be sent as a contact when the button is pressed.Available in private chats only",
                                                          },
                                                          {
                                                              displayName: 'Request Location',
                                                              name: 'request_location',
                                                              type: 'boolean',
                                                              default: false,
                                                              description: "Whether the user's request_location",
                                                          },
                                                      ],
                                                  },
                                              ],
                                          },
                                      ],
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Reply Keyboard Options',
                      name: 'replyKeyboardOptions',
                      type: 'collection',
                      placeholder: 'Add Option',
                      displayOptions: {
                          show: {
                              replyMarkup: ['replyKeyboard'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Resize Keyboard',
                              name: 'resize_keyboard',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to request clients to resize the keyboard vertically for optimal fit',
                          },
                          {
                              displayName: 'One Time Keyboard',
                              name: 'one_time_keyboard',
                              type: 'boolean',
                              default: false,
                              description: "Whether to request clients to hide the keyboard as soon as it's been used",
                          },
                          {
                              displayName: 'Selective',
                              name: 'selective',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to show the keyboard to specific users only',
                          },
                      ],
                  },
                  {
                      displayName: 'Reply Keyboard Remove',
                      name: 'replyKeyboardRemove',
                      type: 'collection',
                      placeholder: 'Add Field',
                      displayOptions: {
                          show: {
                              replyMarkup: ['replyKeyboardRemove'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Remove Keyboard',
                              name: 'remove_keyboard',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to request clients to remove the custom keyboard',
                          },
                          {
                              displayName: 'Selective',
                              name: 'selective',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to force reply from specific users only',
                          },
                      ],
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      displayOptions: {
                          show: {
                              operation: [
                                  'editMessageText',
                                  'sendAnimation',
                                  'sendAudio',
                                  'sendDocument',
                                  'sendLocation',
                                  'sendMessage',
                                  'sendMediaGroup',
                                  'sendPhoto',
                                  'sendSticker',
                                  'sendVideo',
                              ],
                              resource: ['message'],
                          },
                      },
                      default: {},
                      options: [
                          {
                              displayName: 'Append n8n Attribution',
                              name: 'appendAttribution',
                              type: 'boolean',
                              default: true,
                              description: 'Whether to include the phrase “This message was sent automatically with n8n” to the end of the message',
                              displayOptions: {
                                  show: {
                                      '/operation': ['sendMessage'],
                                  },
                              },
                          },
                          {
                              displayName: 'Caption',
                              name: 'caption',
                              type: 'string',
                              displayOptions: {
                                  show: {
                                      '/operation': [
                                          'sendAnimation',
                                          'sendAudio',
                                          'sendDocument',
                                          'sendPhoto',
                                          'sendVideo',
                                      ],
                                  },
                              },
                              default: '',
                              description: 'Caption text to set, 0-1024 characters',
                          },
                          {
                              displayName: 'Disable Notification',
                              name: 'disable_notification',
                              type: 'boolean',
                              default: false,
                              displayOptions: {
                                  hide: {
                                      '/operation': ['editMessageText'],
                                  },
                              },
                              description: 'Whether to send the message silently. Users will receive a notification with no sound.',
                          },
                          {
                              displayName: 'Disable WebPage Preview',
                              name: 'disable_web_page_preview',
                              type: 'boolean',
                              displayOptions: {
                                  show: {
                                      '/operation': ['editMessageText', 'sendMessage'],
                                  },
                              },
                              default: false,
                              description: 'Whether to disable link previews for links in this message',
                          },
                          {
                              displayName: 'Duration',
                              name: 'duration',
                              type: 'number',
                              typeOptions: {
                                  minValue: 0,
                              },
                              displayOptions: {
                                  show: {
                                      '/operation': ['sendAnimation', 'sendAudio', 'sendVideo'],
                                  },
                              },
                              default: 0,
                              description: 'Duration of clip in seconds',
                          },
                          {
                              displayName: 'File Name',
                              name: 'fileName',
                              type: 'string',
                              default: '',
                              displayOptions: {
                                  show: {
                                      '/operation': [
                                          'sendAnimation',
                                          'sendAudio',
                                          'sendDocument',
                                          'sendPhoto',
                                          'sendVideo',
                                          'sendSticker',
                                      ],
                                      '/resource': ['message'],
                                      '/binaryData': [true],
                                  },
                              },
                              placeholder: 'image.jpeg',
                          },
                          {
                              displayName: 'Height',
                              name: 'height',
                              type: 'number',
                              typeOptions: {
                                  minValue: 0,
                              },
                              displayOptions: {
                                  show: {
                                      '/operation': ['sendAnimation', 'sendVideo'],
                                  },
                              },
                              default: 0,
                              description: 'Height of the video',
                          },
                          {
                              displayName: 'Parse Mode',
                              name: 'parse_mode',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Markdown',
                                      value: 'Markdown',
                                  },
                                  {
                                      name: 'HTML',
                                      value: 'HTML',
                                  },
                              ],
                              displayOptions: {
                                  show: {
                                      '/operation': [
                                          'editMessageText',
                                          'sendAnimation',
                                          'sendAudio',
                                          'sendMessage',
                                          'sendPhoto',
                                          'sendVideo',
                                          'sendDocument',
                                      ],
                                  },
                              },
                              default: 'HTML',
                              description: 'How to parse the text',
                          },
                          {
                              displayName: 'Performer',
                              name: 'performer',
                              type: 'string',
                              displayOptions: {
                                  show: {
                                      '/operation': ['sendAudio'],
                                  },
                              },
                              default: '',
                              description: 'Name of the performer',
                          },
                          {
                              displayName: 'Reply To Message ID',
                              name: 'reply_to_message_id',
                              type: 'number',
                              displayOptions: {
                                  hide: {
                                      '/operation': ['editMessageText'],
                                  },
                              },
                              default: 0,
                              description: 'If the message is a reply, ID of the original message',
                          },
                          {
                              displayName: 'Message Thread ID',
                              name: 'message_thread_id',
                              type: 'number',
                              displayOptions: {
                                  show: {
                                      '/operation': [
                                          'sendAnimation',
                                          'sendAudio',
                                          'sendChatAction',
                                          'sendDocument',
                                          'sendLocation',
                                          'sendMediaGroup',
                                          'sendMessage',
                                          'sendPhoto',
                                          'sendSticker',
                                          'sendVideo',
                                      ],
                                  },
                              },
                              default: 0,
                              description: 'The unique identifier of the forum topic',
                          },
                          {
                              displayName: 'Title',
                              name: 'title',
                              type: 'string',
                              displayOptions: {
                                  show: {
                                      '/operation': ['sendAudio'],
                                  },
                              },
                              default: '',
                              description: 'Title of the track',
                          },
                          {
                              displayName: 'Thumbnail',
                              name: 'thumb',
                              type: 'string',
                              displayOptions: {
                                  show: {
                                      '/operation': ['sendAnimation', 'sendAudio', 'sendDocument', 'sendVideo'],
                                  },
                              },
                              default: '',
                              description: 'Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 320.',
                          },
                          {
                              displayName: 'Width',
                              name: 'width',
                              type: 'number',
                              typeOptions: {
                                  minValue: 0,
                              },
                              displayOptions: {
                                  show: {
                                      '/operation': ['sendAnimation', 'sendVideo'],
                                  },
                              },
                              default: 0,
                              description: 'Width of the video',
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          var _a, _b;
          const items = this.getInputData();
          const returnData = [];
          let body;
          let qs;
          let requestMethod;
          let endpoint;
          const operation = this.getNodeParameter('operation', 0);
          const resource = this.getNodeParameter('resource', 0);
          const binaryData = this.getNodeParameter('binaryData', 0, false);
          const nodeVersion = this.getNode().typeVersion;
          const instanceId = this.getInstanceId();
          for (let i = 0; i < items.length; i++) {
              try {
                  requestMethod = 'POST';
                  endpoint = '';
                  body = {};
                  qs = {};
                  if (resource === 'callback') {
                      if (operation === 'answerQuery') {
                          endpoint = 'answerCallbackQuery';
                          body.callback_query_id = this.getNodeParameter('queryId', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          Object.assign(body, additionalFields);
                      }
                      else if (operation === 'answerInlineQuery') {
                          endpoint = 'answerInlineQuery';
                          body.inline_query_id = this.getNodeParameter('queryId', i);
                          body.results = this.getNodeParameter('results', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          Object.assign(body, additionalFields);
                      }
                  }
                  else if (resource === 'chat') {
                      if (operation === 'get') {
                          endpoint = 'getChat';
                          body.chat_id = this.getNodeParameter('chatId', i);
                      }
                      else if (operation === 'administrators') {
                          endpoint = 'getChatAdministrators';
                          body.chat_id = this.getNodeParameter('chatId', i);
                      }
                      else if (operation === 'leave') {
                          endpoint = 'leaveChat';
                          body.chat_id = this.getNodeParameter('chatId', i);
                      }
                      else if (operation === 'member') {
                          endpoint = 'getChatMember';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          body.user_id = this.getNodeParameter('userId', i);
                      }
                      else if (operation === 'setDescription') {
                          endpoint = 'setChatDescription';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          body.description = this.getNodeParameter('description', i);
                      }
                      else if (operation === 'setTitle') {
                          endpoint = 'setChatTitle';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          body.title = this.getNodeParameter('title', i);
                      }
                  }
                  else if (resource === 'file') {
                      if (operation === 'get') {
                          endpoint = 'getFile';
                          body.file_id = this.getNodeParameter('fileId', i);
                      }
                  }
                  else if (resource === 'message') {
                      if (operation === 'editMessageText') {
                          endpoint = 'editMessageText';
                          const messageType = this.getNodeParameter('messageType', i);
                          if (messageType === 'inlineMessage') {
                              body.inline_message_id = this.getNodeParameter('inlineMessageId', i);
                          }
                          else {
                              body.chat_id = this.getNodeParameter('chatId', i);
                              body.message_id = this.getNodeParameter('messageId', i);
                          }
                          body.text = this.getNodeParameter('text', i);
                          GenericFunctions_1.addAdditionalFields.call(this, body, i);
                      }
                      else if (operation === 'deleteMessage') {
                          endpoint = 'deleteMessage';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          body.message_id = this.getNodeParameter('messageId', i);
                      }
                      else if (operation === 'pinChatMessage') {
                          endpoint = 'pinChatMessage';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          body.message_id = this.getNodeParameter('messageId', i);
                          const { disable_notification } = this.getNodeParameter('additionalFields', i);
                          if (disable_notification) {
                              body.disable_notification = true;
                          }
                      }
                      else if (operation === 'unpinChatMessage') {
                          endpoint = 'unpinChatMessage';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          body.message_id = this.getNodeParameter('messageId', i);
                      }
                      else if (operation === 'sendAnimation') {
                          endpoint = 'sendAnimation';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          body.animation = this.getNodeParameter('file', i, '');
                          GenericFunctions_1.addAdditionalFields.call(this, body, i);
                      }
                      else if (operation === 'sendAudio') {
                          endpoint = 'sendAudio';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          body.audio = this.getNodeParameter('file', i, '');
                          GenericFunctions_1.addAdditionalFields.call(this, body, i);
                      }
                      else if (operation === 'sendChatAction') {
                          endpoint = 'sendChatAction';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          body.action = this.getNodeParameter('action', i);
                      }
                      else if (operation === 'sendDocument') {
                          endpoint = 'sendDocument';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          body.document = this.getNodeParameter('file', i, '');
                          GenericFunctions_1.addAdditionalFields.call(this, body, i);
                      }
                      else if (operation === 'sendLocation') {
                          endpoint = 'sendLocation';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          body.latitude = this.getNodeParameter('latitude', i);
                          body.longitude = this.getNodeParameter('longitude', i);
                          GenericFunctions_1.addAdditionalFields.call(this, body, i);
                      }
                      else if (operation === 'sendMessage') {
                          endpoint = 'sendMessage';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          body.text = this.getNodeParameter('text', i);
                          GenericFunctions_1.addAdditionalFields.call(this, body, i, nodeVersion, instanceId);
                      }
                      else if (operation === 'sendMediaGroup') {
                          endpoint = 'sendMediaGroup';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          Object.assign(body, additionalFields);
                          const mediaItems = this.getNodeParameter('media', i);
                          body.media = [];
                          for (const mediaItem of mediaItems.media) {
                              if (mediaItem.additionalFields !== undefined) {
                                  Object.assign(mediaItem, mediaItem.additionalFields);
                                  delete mediaItem.additionalFields;
                              }
                              body.media.push(mediaItem);
                          }
                      }
                      else if (operation === 'sendPhoto') {
                          endpoint = 'sendPhoto';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          body.photo = this.getNodeParameter('file', i, '');
                          GenericFunctions_1.addAdditionalFields.call(this, body, i);
                      }
                      else if (operation === 'sendSticker') {
                          endpoint = 'sendSticker';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          body.sticker = this.getNodeParameter('file', i, '');
                          GenericFunctions_1.addAdditionalFields.call(this, body, i);
                      }
                      else if (operation === 'sendVideo') {
                          endpoint = 'sendVideo';
                          body.chat_id = this.getNodeParameter('chatId', i);
                          body.video = this.getNodeParameter('file', i, '');
                          GenericFunctions_1.addAdditionalFields.call(this, body, i);
                      }
                  }
                  else {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not known!`, {
                          itemIndex: i,
                      });
                  }
                  let responseData;
                  if (binaryData) {
                      const binaryPropertyName = this.getNodeParameter('binaryPropertyName', 0);
                      const itemBinaryData = items[i].binary[binaryPropertyName];
                      const propertyName = (0, GenericFunctions_1.getPropertyName)(operation);
                      const fileName = this.getNodeParameter('additionalFields.fileName', 0, '');
                      const filename = fileName || ((_a = itemBinaryData.fileName) === null || _a === void 0 ? void 0 : _a.toString());
                      if (!fileName && !itemBinaryData.fileName) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), `File name is needed to ${operation}. Make sure the property that holds the binary data
  						has the file name property set or set it manually in the node using the File Name parameter under
  						Additional Fields.`);
                      }
                      body.disable_notification = ((_b = body.disable_notification) === null || _b === void 0 ? void 0 : _b.toString()) || 'false';
                      let uploadData;
                      if (itemBinaryData.id) {
                          uploadData = await this.helpers.getBinaryStream(itemBinaryData.id);
                      }
                      else {
                          uploadData = Buffer.from(itemBinaryData.data, n8n_workflow_1.BINARY_ENCODING);
                      }
                      const formData = {
                          ...body,
                          [propertyName]: {
                              value: uploadData,
                              options: {
                                  filename,
                                  contentType: itemBinaryData.mimeType,
                              },
                          },
                      };
                      responseData = await GenericFunctions_1.apiRequest.call(this, requestMethod, endpoint, {}, qs, { formData });
                  }
                  else {
                      responseData = await GenericFunctions_1.apiRequest.call(this, requestMethod, endpoint, body, qs);
                  }
                  if (resource === 'file' && operation === 'get') {
                      if (this.getNodeParameter('download', i, false)) {
                          const filePath = responseData.result.file_path;
                          const credentials = await this.getCredentials('telegramApi');
                          const file = await GenericFunctions_1.apiRequest.call(this, 'GET', '', {}, {}, {
                              json: false,
                              encoding: null,
                              uri: `https://api.telegram.org/file/bot${credentials.accessToken}/${filePath}`,
                              resolveWithFullResponse: true,
                              useStream: true,
                          });
                          const fileName = filePath.split('/').pop();
                          const data = await this.helpers.prepareBinaryData(file.body, fileName);
                          returnData.push({
                              json: responseData,
                              binary: { data },
                              pairedItem: { item: i },
                          });
                          continue;
                      }
                  }
                  else if (resource === 'chat' && operation === 'administrators') {
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData.result), { itemData: { item: i } });
                      returnData.push(...executionData);
                      continue;
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                  returnData.push(...executionData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ json: {}, error: error.message });
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.Telegram = Telegram;
  //# sourceMappingURL=Telegram.node.js.map

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"aa7772e7-ca71-427b-9784-90cba1fe0571","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"d739176d01a125d43f6e09251a9ed67698bb3cf013a740be9cd1f03a58bcda7e"}}


node_type: n8n-nodes-base.Taiga
name: Taiga
display_name: Taiga
description: Consume Taiga API
category: transform
icon: file:taiga.svg
code_hash: b5515948bd59b70034e4508dd755ebad7d28139a4db63a8d93f64faf53aaa923
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.taigatrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:33
updated_at: 2025-06-08 09:18:33
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Taiga = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const descriptions_1 = require("./descriptions");
  class Taiga {
      constructor() {
          this.description = {
              displayName: 'Taiga',
              name: 'taiga',
              icon: 'file:taiga.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Taiga API',
              defaults: {
                  name: 'Taiga',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'taigaApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Epic',
                              value: 'epic',
                          },
                          {
                              name: 'Issue',
                              value: 'issue',
                          },
                          {
                              name: 'Task',
                              value: 'task',
                          },
                          {
                              name: 'User Story',
                              value: 'userStory',
                          },
                      ],
                      default: 'issue',
                  },
                  ...descriptions_1.epicOperations,
                  ...descriptions_1.epicFields,
                  ...descriptions_1.issueOperations,
                  ...descriptions_1.issueFields,
                  ...descriptions_1.taskOperations,
                  ...descriptions_1.taskFields,
                  ...descriptions_1.userStoryOperations,
                  ...descriptions_1.userStoryFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getEpics() {
                      const project = this.getCurrentNodeParameter('projectId');
                      const epics = (await GenericFunctions_1.taigaApiRequest.call(this, 'GET', '/epics', {}, { project }));
                      return epics.map(({ subject, id }) => ({ name: subject, value: id }));
                  },
                  async getMilestones() {
                      const project = this.getCurrentNodeParameter('projectId');
                      const milestones = (await GenericFunctions_1.taigaApiRequest.call(this, 'GET', '/milestones', {}, { project }));
                      return (0, GenericFunctions_1.toOptions)(milestones);
                  },
                  async getPriorities() {
                      const project = this.getCurrentNodeParameter('projectId');
                      const priorities = (await GenericFunctions_1.taigaApiRequest.call(this, 'GET', '/priorities', {}, { project }));
                      return (0, GenericFunctions_1.toOptions)(priorities);
                  },
                  async getProjects() {
                      const { id } = (await GenericFunctions_1.taigaApiRequest.call(this, 'GET', '/users/me'));
                      const projects = (await GenericFunctions_1.taigaApiRequest.call(this, 'GET', '/projects', {}, { member: id }));
                      return (0, GenericFunctions_1.toOptions)(projects);
                  },
                  async getRoles() {
                      const project = this.getCurrentNodeParameter('projectId');
                      const roles = (await GenericFunctions_1.taigaApiRequest.call(this, 'GET', '/roles', {}, { project }));
                      return (0, GenericFunctions_1.toOptions)(roles);
                  },
                  async getSeverities() {
                      const project = this.getCurrentNodeParameter('projectId');
                      const severities = (await GenericFunctions_1.taigaApiRequest.call(this, 'GET', '/severities', {}, { project }));
                      return (0, GenericFunctions_1.toOptions)(severities);
                  },
                  async getTags() {
                      const project = this.getCurrentNodeParameter('projectId');
                      const tags = (await GenericFunctions_1.taigaApiRequest.call(this, 'GET', `/projects/${project}/tags_colors`));
                      return Object.keys(tags).map((tag) => ({ name: tag, value: tag }));
                  },
                  async getTypes() {
                      const project = this.getCurrentNodeParameter('projectId');
                      const types = (await GenericFunctions_1.taigaApiRequest.call(this, 'GET', '/issue-types', {}, { project }));
                      return (0, GenericFunctions_1.toOptions)(types);
                  },
                  async getUsers() {
                      const project = this.getCurrentNodeParameter('projectId');
                      const users = (await GenericFunctions_1.taigaApiRequest.call(this, 'GET', '/users', {}, { project }));
                      return users.map(({ full_name_display, id }) => ({ name: full_name_display, value: id }));
                  },
                  async getUserStories() {
                      const project = this.getCurrentNodeParameter('projectId');
                      const userStories = (await GenericFunctions_1.taigaApiRequest.call(this, 'GET', '/userstories', {}, { project }));
                      return userStories.map(({ subject, id }) => ({ name: subject, value: id }));
                  },
                  async getIssueStatuses() {
                      const project = this.getCurrentNodeParameter('projectId');
                      const statuses = (await GenericFunctions_1.taigaApiRequest.call(this, 'GET', '/issue-statuses', {}, { project }));
                      return (0, GenericFunctions_1.toOptions)(statuses);
                  },
                  async getTaskStatuses() {
                      const project = this.getCurrentNodeParameter('projectId');
                      const statuses = (await GenericFunctions_1.taigaApiRequest.call(this, 'GET', '/task-statuses', {}, { project }));
                      return (0, GenericFunctions_1.toOptions)(statuses);
                  },
                  async getUserStoryStatuses() {
                      const project = this.getCurrentNodeParameter('projectId');
                      const statuses = (await GenericFunctions_1.taigaApiRequest.call(this, 'GET', '/userstory-statuses', {}, { project }));
                      return (0, GenericFunctions_1.toOptions)(statuses);
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          let responseData;
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'epic') {
                      if (operation === 'create') {
                          const body = {
                              project: this.getNodeParameter('projectId', i),
                              subject: this.getNodeParameter('subject', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'POST', '/epics', body);
                      }
                      else if (operation === 'delete') {
                          const epicId = this.getNodeParameter('epicId', i);
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'DELETE', `/epics/${epicId}`);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const epicId = this.getNodeParameter('epicId', i);
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'GET', `/epics/${epicId}`);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          if (Object.keys(filters).length) {
                              Object.assign(qs, filters);
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/epics', {}, qs, i);
                      }
                      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 epicId = this.getNodeParameter('epicId', i);
                          body.version = await GenericFunctions_1.getVersionForUpdate.call(this, `/epics/${epicId}`);
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'PATCH', `/epics/${epicId}`, body);
                      }
                  }
                  else if (resource === 'issue') {
                      if (operation === 'create') {
                          const body = {
                              project: this.getNodeParameter('projectId', i),
                              subject: this.getNodeParameter('subject', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'POST', '/issues', body);
                      }
                      else if (operation === 'delete') {
                          const issueId = this.getNodeParameter('issueId', i);
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'DELETE', `/issues/${issueId}`);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const issueId = this.getNodeParameter('issueId', i);
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'GET', `/issues/${issueId}`);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          if (Object.keys(filters).length) {
                              Object.assign(qs, filters);
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/issues', {}, qs, i);
                      }
                      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 issueId = this.getNodeParameter('issueId', i);
                          body.version = await GenericFunctions_1.getVersionForUpdate.call(this, `/issues/${issueId}`);
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'PATCH', `/issues/${issueId}`, body);
                      }
                  }
                  else if (resource === 'task') {
                      if (operation === 'create') {
                          const body = {
                              project: this.getNodeParameter('projectId', i),
                              subject: this.getNodeParameter('subject', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'POST', '/tasks', body);
                      }
                      else if (operation === 'delete') {
                          const taskId = this.getNodeParameter('taskId', i);
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'DELETE', `/tasks/${taskId}`);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const taskId = this.getNodeParameter('taskId', i);
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'GET', `/tasks/${taskId}`);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          if (Object.keys(filters).length) {
                              Object.assign(qs, filters);
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/tasks', {}, qs, i);
                      }
                      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 taskId = this.getNodeParameter('taskId', i);
                          body.version = await GenericFunctions_1.getVersionForUpdate.call(this, `/tasks/${taskId}`);
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'PATCH', `/tasks/${taskId}`, body);
                      }
                  }
                  else if (resource === 'userStory') {
                      if (operation === 'create') {
                          const body = {
                              project: this.getNodeParameter('projectId', i),
                              subject: this.getNodeParameter('subject', i),
                          };
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (Object.keys(additionalFields).length) {
                              Object.assign(body, additionalFields);
                          }
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'POST', '/userstories', body);
                      }
                      else if (operation === 'delete') {
                          const userStoryId = this.getNodeParameter('userStoryId', i);
                          const endpoint = `/userstories/${userStoryId}`;
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'DELETE', endpoint);
                          responseData = { success: true };
                      }
                      else if (operation === 'get') {
                          const userStoryId = this.getNodeParameter('userStoryId', i);
                          const endpoint = `/userstories/${userStoryId}`;
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'GET', endpoint);
                      }
                      else if (operation === 'getAll') {
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          if (Object.keys(filters).length) {
                              Object.assign(qs, filters);
                          }
                          responseData = await GenericFunctions_1.handleListing.call(this, 'GET', '/userstories', {}, qs, i);
                      }
                      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 userStoryId = this.getNodeParameter('userStoryId', i);
                          body.version = await GenericFunctions_1.getVersionForUpdate.call(this, `/userstories/${userStoryId}`);
                          responseData = await GenericFunctions_1.taigaApiRequest.call(this, 'PATCH', `/userstories/${userStoryId}`, body);
                      }
                  }
              }
              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.Taiga = Taiga;
  //# sourceMappingURL=Taiga.node.js.map

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

  # Taiga Trigger node

  [Taiga](https://www.taiga.io/){:target=_blank .external-link} is a free and open-source project management platform for startups, agile developers, and designers.

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

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"58b32cbd-b80e-4364-bc21-5e326d990281","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"a215c650bb777c5a3899a3c0dc08f760bf2c4f495bc5e2ed0b7dbf9a44e21f38"}}


node_type: n8n-nodes-base.TheHive
name: TheHive
display_name: TheHive
description: Consume TheHive API
category: transform
icon: file:thehive.svg
code_hash: 4693e13130108cbcdb7b8541cea40e18dff162d3e1cdd41ddc11bb95d829a947
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.thehivetrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:33
updated_at: 2025-06-08 09:18:33
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.TheHive = void 0;
  const AlertDescription_1 = require("./descriptions/AlertDescription");
  const ObservableDescription_1 = require("./descriptions/ObservableDescription");
  const CaseDescription_1 = require("./descriptions/CaseDescription");
  const TaskDescription_1 = require("./descriptions/TaskDescription");
  const LogDescription_1 = require("./descriptions/LogDescription");
  const QueryFunctions_1 = require("./QueryFunctions");
  const GenericFunctions_1 = require("./GenericFunctions");
  const set_1 = __importDefault(require("lodash/set"));
  class TheHive {
      constructor() {
          this.description = {
              displayName: 'TheHive',
              name: 'theHive',
              icon: 'file:thehive.svg',
              group: ['transform'],
              subtitle: '={{$parameter["operation"]}} : {{$parameter["resource"]}}',
              version: 1,
              description: 'Consume TheHive API',
              defaults: {
                  name: 'TheHive',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'theHiveApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      required: true,
                      options: [
                          {
                              name: 'Alert',
                              value: 'alert',
                          },
                          {
                              name: 'Case',
                              value: 'case',
                          },
                          {
                              name: 'Log',
                              value: 'log',
                          },
                          {
                              name: 'Observable',
                              value: 'observable',
                          },
                          {
                              name: 'Task',
                              value: 'task',
                          },
                      ],
                      default: 'alert',
                  },
                  ...AlertDescription_1.alertOperations,
                  ...AlertDescription_1.alertFields,
                  ...ObservableDescription_1.observableOperations,
                  ...ObservableDescription_1.observableFields,
                  ...CaseDescription_1.caseOperations,
                  ...CaseDescription_1.caseFields,
                  ...TaskDescription_1.taskOperations,
                  ...TaskDescription_1.taskFields,
                  ...LogDescription_1.logOperations,
                  ...LogDescription_1.logFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async loadResponders() {
                      const resource = (0, GenericFunctions_1.mapResource)(this.getNodeParameter('resource'));
                      const resourceId = this.getNodeParameter('id');
                      const endpoint = `/connector/cortex/responder/${resource}/${resourceId}`;
                      const responders = await GenericFunctions_1.theHiveApiRequest.call(this, 'GET', endpoint);
                      const returnData = [];
                      for (const responder of responders) {
                          returnData.push({
                              name: responder.name,
                              value: responder.id,
                              description: responder.description,
                          });
                      }
                      return returnData;
                  },
                  async loadAnalyzers() {
                      const dataType = this.getNodeParameter('dataType');
                      const endpoint = `/connector/cortex/analyzer/type/${dataType}`;
                      const requestResult = await GenericFunctions_1.theHiveApiRequest.call(this, 'GET', endpoint);
                      const returnData = [];
                      for (const analyzer of requestResult) {
                          for (const cortexId of analyzer.cortexIds) {
                              returnData.push({
                                  name: `[${cortexId}] ${analyzer.name}`,
                                  value: `${analyzer.id}::${cortexId}`,
                                  description: analyzer.description,
                              });
                          }
                      }
                      return returnData;
                  },
                  async loadCustomFields() {
                      const credentials = await this.getCredentials('theHiveApi');
                      const version = credentials.apiVersion;
                      const endpoint = version === 'v1' ? '/customField' : '/list/custom_fields';
                      const requestResult = await GenericFunctions_1.theHiveApiRequest.call(this, 'GET', endpoint);
                      const returnData = [];
                      const customFields = version === 'v1'
                          ? requestResult
                          : Object.keys(requestResult).map((key) => requestResult[key]);
                      for (const field of customFields) {
                          returnData.push({
                              name: `${field.name}: ${field.reference}`,
                              value: field.reference,
                              description: `${field.type}: ${field.description}`,
                          });
                      }
                      return returnData;
                  },
                  async loadObservableOptions() {
                      const version = (await this.getCredentials('theHiveApi')).apiVersion;
                      const options = [
                          ...(version === 'v1'
                              ? [{ name: 'Count', value: 'count', description: 'Count observables' }]
                              : []),
                          { name: 'Create', value: 'create', description: 'Create observable' },
                          {
                              name: 'Execute Analyzer',
                              value: 'executeAnalyzer',
                              description: 'Execute an responder on selected observable',
                          },
                          {
                              name: 'Execute Responder',
                              value: 'executeResponder',
                              description: 'Execute a responder on selected observable',
                          },
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'Get all observables of a specific case',
                          },
                          { name: 'Get', value: 'get', description: 'Get a single observable' },
                          { name: 'Search', value: 'search', description: 'Search observables' },
                          { name: 'Update', value: 'update', description: 'Update observable' },
                      ];
                      return options;
                  },
                  async loadObservableTypes() {
                      const version = (await this.getCredentials('theHiveApi')).apiVersion;
                      const endpoint = version === 'v1' ? '/observable/type?range=all' : '/list/list_artifactDataType';
                      const dataTypes = await GenericFunctions_1.theHiveApiRequest.call(this, 'GET', endpoint);
                      let returnData = [];
                      if (version === 'v1') {
                          returnData = dataTypes.map((dataType) => {
                              return {
                                  name: dataType.name,
                                  value: dataType.name,
                              };
                          });
                      }
                      else {
                          returnData = Object.keys(dataTypes).map((key) => {
                              const dataType = dataTypes[key];
                              return {
                                  name: dataType,
                                  value: dataType,
                              };
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return returnData;
                  },
                  async loadTaskOptions() {
                      const credentials = await this.getCredentials('theHiveApi');
                      const version = credentials.apiVersion;
                      const options = [
                          ...(version === 'v1'
                              ? [{ name: 'Count', value: 'count', description: 'Count tasks' }]
                              : []),
                          { name: 'Create', value: 'create', description: 'Create a task' },
                          {
                              name: 'Execute Responder',
                              value: 'executeResponder',
                              description: 'Execute a responder on the specified task',
                          },
                          { name: 'Get Many', value: 'getAll', description: 'Get all asks of a specific case' },
                          { name: 'Get', value: 'get', description: 'Get a single task' },
                          { name: 'Search', value: 'search', description: 'Search tasks' },
                          { name: 'Update', value: 'update', description: 'Update a task' },
                      ];
                      return options;
                  },
                  async loadAlertOptions() {
                      const credentials = await this.getCredentials('theHiveApi');
                      const version = credentials.apiVersion;
                      const options = [
                          ...(version === 'v1'
                              ? [{ name: 'Count', value: 'count', description: 'Count alerts' }]
                              : []),
                          { name: 'Create', value: 'create', description: 'Create alert' },
                          {
                              name: 'Execute Responder',
                              value: 'executeResponder',
                              description: 'Execute a responder on the specified alert',
                          },
                          { name: 'Get', value: 'get', description: 'Get an alert' },
                          { name: 'Get Many', value: 'getAll', description: 'Get all alerts' },
                          { name: 'Mark as Read', value: 'markAsRead', description: 'Mark the alert as read' },
                          {
                              name: 'Mark as Unread',
                              value: 'markAsUnread',
                              description: 'Mark the alert as unread',
                          },
                          { name: 'Merge', value: 'merge', description: 'Merge alert into an existing case' },
                          { name: 'Promote', value: 'promote', description: 'Promote an alert into a case' },
                          { name: 'Update', value: 'update', description: 'Update alert' },
                      ];
                      return options;
                  },
                  async loadCaseOptions() {
                      const credentials = await this.getCredentials('theHiveApi');
                      const version = credentials.apiVersion;
                      const options = [
                          ...(version === 'v1'
                              ? [{ name: 'Count', value: 'count', description: 'Count a case' }]
                              : []),
                          { name: 'Create', value: 'create', description: 'Create a case' },
                          {
                              name: 'Execute Responder',
                              value: 'executeResponder',
                              description: 'Execute a responder on the specified case',
                          },
                          { name: 'Get Many', value: 'getAll', description: 'Get all cases' },
                          { name: 'Get', value: 'get', description: 'Get a single case' },
                          { name: 'Update', value: 'update', description: 'Update a case' },
                      ];
                      return options;
                  },
              },
          };
      }
      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 === 'alert') {
                      if (operation === 'count') {
                          const filters = this.getNodeParameter('filters', i, {});
                          const countQueryAttributs = (0, GenericFunctions_1.prepareOptional)(filters);
                          const _countSearchQuery = (0, QueryFunctions_1.And)();
                          if ('customFieldsUi' in filters) {
                              const customFields = (await GenericFunctions_1.prepareCustomFields.call(this, filters));
                              const searchQueries = (0, GenericFunctions_1.buildCustomFieldSearch)(customFields);
                              _countSearchQuery['_and'].push(...searchQueries);
                          }
                          for (const key of Object.keys(countQueryAttributs)) {
                              if (key === 'tags') {
                                  _countSearchQuery['_and'].push((0, QueryFunctions_1.In)(key, countQueryAttributs[key]));
                              }
                              else if (key === 'description' || key === 'title') {
                                  _countSearchQuery['_and'].push((0, QueryFunctions_1.ContainsString)(key, countQueryAttributs[key]));
                              }
                              else {
                                  _countSearchQuery['_and'].push((0, QueryFunctions_1.Eq)(key, countQueryAttributs[key]));
                              }
                          }
                          const body = {
                              query: [
                                  {
                                      _name: 'listAlert',
                                  },
                                  {
                                      _name: 'filter',
                                      _and: _countSearchQuery['_and'],
                                  },
                              ],
                          };
                          body['query'].push({
                              _name: 'count',
                          });
                          qs.name = 'count-Alert';
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/v1/query', body, qs);
                          responseData = { count: responseData };
                      }
                      if (operation === 'create') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const jsonParameters = this.getNodeParameter('jsonParameters', i);
                          const customFields = await GenericFunctions_1.prepareCustomFields.call(this, additionalFields, jsonParameters);
                          const body = {
                              title: this.getNodeParameter('title', i),
                              description: this.getNodeParameter('description', i),
                              severity: this.getNodeParameter('severity', i),
                              date: Date.parse(this.getNodeParameter('date', i)),
                              tags: (0, GenericFunctions_1.splitTags)(this.getNodeParameter('tags', i)),
                              tlp: this.getNodeParameter('tlp', i),
                              status: this.getNodeParameter('status', i),
                              type: this.getNodeParameter('type', i),
                              source: this.getNodeParameter('source', i),
                              sourceRef: this.getNodeParameter('sourceRef', i),
                              follow: this.getNodeParameter('follow', i, true),
                              ...(0, GenericFunctions_1.prepareOptional)(additionalFields),
                          };
                          if (customFields) {
                              Object.keys(customFields).forEach((key) => {
                                  (0, set_1.default)(body, key, customFields[key]);
                              });
                          }
                          const artifactUi = this.getNodeParameter('artifactUi', i);
                          if (artifactUi) {
                              const artifactValues = artifactUi.artifactValues;
                              if (artifactValues) {
                                  const artifactData = [];
                                  for (const artifactvalue of artifactValues) {
                                      const element = {};
                                      element.message = artifactvalue.message;
                                      element.tags = artifactvalue.tags.split(',');
                                      element.dataType = artifactvalue.dataType;
                                      element.data = artifactvalue.data;
                                      if (artifactvalue.dataType === 'file') {
                                          const binaryPropertyName = artifactvalue.binaryProperty;
                                          const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                                          element.data = `${binaryData.fileName};${binaryData.mimeType};${binaryData.data}`;
                                      }
                                      artifactData.push(element);
                                  }
                                  body.artifacts = artifactData;
                              }
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/alert', body);
                      }
                      if (operation === 'executeResponder') {
                          const alertId = this.getNodeParameter('id', i);
                          const responderId = this.getNodeParameter('responder', i);
                          let body;
                          let response;
                          responseData = [];
                          body = {
                              responderId,
                              objectId: alertId,
                              objectType: 'alert',
                          };
                          response = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/connector/cortex/action', body);
                          body = {
                              query: [
                                  {
                                      _name: 'listAction',
                                  },
                                  {
                                      _name: 'filter',
                                      _and: [
                                          {
                                              _field: 'cortexId',
                                              _value: response.cortexId,
                                          },
                                          {
                                              _field: 'objectId',
                                              _value: response.objectId,
                                          },
                                          {
                                              _field: 'startDate',
                                              _value: response.startDate,
                                          },
                                      ],
                                  },
                              ],
                          };
                          qs.name = 'log-actions';
                          do {
                              response = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/v1/query', body, qs);
                          } while (response.status === 'Waiting' || response.status === 'InProgress');
                          responseData = response;
                      }
                      if (operation === 'get') {
                          const alertId = this.getNodeParameter('id', i);
                          const includeSimilar = this.getNodeParameter('options.includeSimilar', i, false);
                          if (includeSimilar) {
                              qs.similarity = true;
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'GET', `/alert/${alertId}`, {}, qs);
                      }
                      if (operation === 'getAll') {
                          const credentials = await this.getCredentials('theHiveApi');
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const version = credentials.apiVersion;
                          const filters = this.getNodeParameter('filters', i, {});
                          const queryAttributs = (0, GenericFunctions_1.prepareOptional)(filters);
                          const options = this.getNodeParameter('options', i);
                          const _searchQuery = (0, QueryFunctions_1.And)();
                          if ('customFieldsUi' in filters) {
                              const customFields = (await GenericFunctions_1.prepareCustomFields.call(this, filters));
                              const searchQueries = (0, GenericFunctions_1.buildCustomFieldSearch)(customFields);
                              _searchQuery['_and'].push(...searchQueries);
                          }
                          for (const key of Object.keys(queryAttributs)) {
                              if (key === 'tags') {
                                  _searchQuery['_and'].push((0, QueryFunctions_1.In)(key, queryAttributs[key]));
                              }
                              else if (key === 'description' || key === 'title') {
                                  _searchQuery['_and'].push((0, QueryFunctions_1.ContainsString)(key, queryAttributs[key]));
                              }
                              else {
                                  _searchQuery['_and'].push((0, QueryFunctions_1.Eq)(key, queryAttributs[key]));
                              }
                          }
                          let endpoint;
                          let method;
                          let body = {};
                          let limit = undefined;
                          if (!returnAll) {
                              limit = this.getNodeParameter('limit', i);
                          }
                          if (version === 'v1') {
                              endpoint = '/v1/query';
                              method = 'POST';
                              body = {
                                  query: [
                                      {
                                          _name: 'listAlert',
                                      },
                                      {
                                          _name: 'filter',
                                          _and: _searchQuery['_and'],
                                      },
                                  ],
                              };
                              (0, GenericFunctions_1.prepareSortQuery)(options.sort, body);
                              if (limit !== undefined) {
                                  (0, GenericFunctions_1.prepareRangeQuery)(`0-${limit}`, body);
                              }
                              qs.name = 'alerts';
                          }
                          else {
                              method = 'POST';
                              endpoint = '/alert/_search';
                              if (limit !== undefined) {
                                  qs.range = `0-${limit}`;
                              }
                              body.query = _searchQuery;
                              Object.assign(qs, (0, GenericFunctions_1.prepareOptional)(options));
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, method, endpoint, body, qs);
                      }
                      if (operation === 'markAsRead') {
                          const alertId = this.getNodeParameter('id', i);
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', `/alert/${alertId}/markAsRead`);
                      }
                      if (operation === 'markAsUnread') {
                          const alertId = this.getNodeParameter('id', i);
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', `/alert/${alertId}/markAsUnread`);
                      }
                      if (operation === 'merge') {
                          const alertId = this.getNodeParameter('id', i);
                          const caseId = this.getNodeParameter('caseId', i);
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', `/alert/${alertId}/merge/${caseId}`, {});
                      }
                      if (operation === 'promote') {
                          const alertId = this.getNodeParameter('id', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {};
                          Object.assign(body, additionalFields);
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', `/alert/${alertId}/createCase`, body);
                      }
                      if (operation === 'update') {
                          const alertId = this.getNodeParameter('id', i);
                          const jsonParameters = this.getNodeParameter('jsonParameters', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const customFields = await GenericFunctions_1.prepareCustomFields.call(this, updateFields, jsonParameters);
                          const artifactUi = updateFields.artifactUi;
                          delete updateFields.artifactUi;
                          const body = {
                              ...customFields,
                          };
                          Object.assign(body, updateFields);
                          if (artifactUi) {
                              const artifactValues = artifactUi.artifactValues;
                              if (artifactValues) {
                                  const artifactData = [];
                                  for (const artifactvalue of artifactValues) {
                                      const element = {};
                                      element.message = artifactvalue.message;
                                      element.tags = artifactvalue.tags.split(',');
                                      element.dataType = artifactvalue.dataType;
                                      element.data = artifactvalue.data;
                                      if (artifactvalue.dataType === 'file') {
                                          const binaryPropertyName = artifactvalue.binaryProperty;
                                          const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                                          element.data = `${binaryData.fileName};${binaryData.mimeType};${binaryData.data}`;
                                      }
                                      artifactData.push(element);
                                  }
                                  body.artifacts = artifactData;
                              }
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'PATCH', `/alert/${alertId}`, body);
                      }
                  }
                  if (resource === 'observable') {
                      if (operation === 'count') {
                          const countQueryAttributs = (0, GenericFunctions_1.prepareOptional)(this.getNodeParameter('filters', i, {}));
                          const _countSearchQuery = (0, QueryFunctions_1.And)();
                          for (const key of Object.keys(countQueryAttributs)) {
                              if (key === 'dataType' || key === 'tags') {
                                  _countSearchQuery['_and'].push((0, QueryFunctions_1.In)(key, countQueryAttributs[key]));
                              }
                              else if (key === 'description' || key === 'keywork' || key === 'message') {
                                  _countSearchQuery['_and'].push((0, QueryFunctions_1.ContainsString)(key, countQueryAttributs[key]));
                              }
                              else if (key === 'range') {
                                  _countSearchQuery['_and'].push((0, QueryFunctions_1.Between)('startDate', countQueryAttributs['range']['dateRange']['fromDate'], countQueryAttributs['range']['dateRange']['toDate']));
                              }
                              else {
                                  _countSearchQuery['_and'].push((0, QueryFunctions_1.Eq)(key, countQueryAttributs[key]));
                              }
                          }
                          const body = {
                              query: [
                                  {
                                      _name: 'listObservable',
                                  },
                                  {
                                      _name: 'filter',
                                      _and: _countSearchQuery['_and'],
                                  },
                              ],
                          };
                          body['query'].push({
                              _name: 'count',
                          });
                          qs.name = 'count-observables';
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/v1/query', body, qs);
                          responseData = { count: responseData };
                      }
                      if (operation === 'executeAnalyzer') {
                          const observableId = this.getNodeParameter('id', i);
                          const analyzers = this.getNodeParameter('analyzers', i).map((analyzer) => {
                              const parts = analyzer.split('::');
                              return {
                                  analyzerId: parts[0],
                                  cortexId: parts[1],
                              };
                          });
                          let response;
                          let body;
                          responseData = [];
                          for (const analyzer of analyzers) {
                              body = {
                                  ...analyzer,
                                  artifactId: observableId,
                              };
                              response = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/connector/cortex/job', body, qs);
                              const jobId = response.id;
                              qs.name = 'observable-jobs';
                              do {
                                  responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'GET', `/connector/cortex/job/${jobId}`, body, qs);
                              } while (responseData.status === 'Waiting' || responseData.status === 'InProgress');
                          }
                      }
                      if (operation === 'executeResponder') {
                          const observableId = this.getNodeParameter('id', i);
                          const responderId = this.getNodeParameter('responder', i);
                          let body;
                          let response;
                          responseData = [];
                          body = {
                              responderId,
                              objectId: observableId,
                              objectType: 'case_artifact',
                          };
                          response = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/connector/cortex/action', body);
                          body = {
                              query: [
                                  {
                                      _name: 'listAction',
                                  },
                                  {
                                      _name: 'filter',
                                      _and: [
                                          {
                                              _field: 'cortexId',
                                              _value: response.cortexId,
                                          },
                                          {
                                              _field: 'objectId',
                                              _value: response.objectId,
                                          },
                                          {
                                              _field: 'startDate',
                                              _value: response.startDate,
                                          },
                                      ],
                                  },
                              ],
                          };
                          qs.name = 'log-actions';
                          do {
                              response = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/v1/query', body, qs);
                          } while (response.status === 'Waiting' || response.status === 'InProgress');
                          responseData = response;
                      }
                      if (operation === 'create') {
                          const caseId = this.getNodeParameter('caseId', i);
                          let body = {
                              dataType: this.getNodeParameter('dataType', i),
                              message: this.getNodeParameter('message', i),
                              startDate: Date.parse(this.getNodeParameter('startDate', i)),
                              tlp: this.getNodeParameter('tlp', i),
                              ioc: this.getNodeParameter('ioc', i),
                              sighted: this.getNodeParameter('sighted', i),
                              status: this.getNodeParameter('status', i),
                              ...(0, GenericFunctions_1.prepareOptional)(this.getNodeParameter('options', i, {})),
                          };
                          let options = {};
                          if (body.dataType === 'file') {
                              const binaryPropertyName = this.getNodeParameter('binaryProperty', i);
                              const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                              const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
                              options = {
                                  formData: {
                                      attachment: {
                                          value: dataBuffer,
                                          options: {
                                              contentType: binaryData.mimeType,
                                              filename: binaryData.fileName,
                                          },
                                      },
                                      _json: JSON.stringify(body),
                                  },
                              };
                              body = {};
                          }
                          else {
                              body.data = this.getNodeParameter('data', i);
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', `/case/${caseId}/artifact`, body, qs, '', options);
                      }
                      if (operation === 'get') {
                          const observableId = this.getNodeParameter('id', i);
                          const credentials = await this.getCredentials('theHiveApi');
                          const version = credentials.apiVersion;
                          let endpoint;
                          let method;
                          let body = {};
                          if (version === 'v1') {
                              endpoint = '/v1/query';
                              method = 'POST';
                              body = {
                                  query: [
                                      {
                                          _name: 'getObservable',
                                          idOrName: observableId,
                                      },
                                  ],
                              };
                              qs.name = `get-observable-${observableId}`;
                          }
                          else {
                              method = 'GET';
                              endpoint = `/case/artifact/${observableId}`;
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, method, endpoint, body, qs);
                      }
                      if (operation === 'getAll') {
                          const credentials = await this.getCredentials('theHiveApi');
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const version = credentials.apiVersion;
                          const options = this.getNodeParameter('options', i);
                          const caseId = this.getNodeParameter('caseId', i);
                          let endpoint;
                          let method;
                          let body = {};
                          let limit = undefined;
                          if (!returnAll) {
                              limit = this.getNodeParameter('limit', i);
                          }
                          if (version === 'v1') {
                              endpoint = '/v1/query';
                              method = 'POST';
                              body = {
                                  query: [
                                      {
                                          _name: 'getCase',
                                          idOrName: caseId,
                                      },
                                      {
                                          _name: 'observables',
                                      },
                                  ],
                              };
                              (0, GenericFunctions_1.prepareSortQuery)(options.sort, body);
                              if (limit !== undefined) {
                                  (0, GenericFunctions_1.prepareRangeQuery)(`0-${limit}`, body);
                              }
                              qs.name = 'observables';
                          }
                          else {
                              method = 'POST';
                              endpoint = '/case/artifact/_search';
                              if (limit !== undefined) {
                                  qs.range = `0-${limit}`;
                              }
                              body.query = (0, QueryFunctions_1.Parent)('case', (0, QueryFunctions_1.Id)(caseId));
                              Object.assign(qs, (0, GenericFunctions_1.prepareOptional)(options));
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, method, endpoint, body, qs);
                      }
                      if (operation === 'search') {
                          const credentials = await this.getCredentials('theHiveApi');
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const version = credentials.apiVersion;
                          const queryAttributs = (0, GenericFunctions_1.prepareOptional)(this.getNodeParameter('filters', i, {}));
                          const _searchQuery = (0, QueryFunctions_1.And)();
                          const options = this.getNodeParameter('options', i);
                          for (const key of Object.keys(queryAttributs)) {
                              if (key === 'dataType' || key === 'tags') {
                                  _searchQuery['_and'].push((0, QueryFunctions_1.In)(key, queryAttributs[key]));
                              }
                              else if (key === 'description' || key === 'keywork' || key === 'message') {
                                  _searchQuery['_and'].push((0, QueryFunctions_1.ContainsString)(key, queryAttributs[key]));
                              }
                              else if (key === 'range') {
                                  _searchQuery['_and'].push((0, QueryFunctions_1.Between)('startDate', queryAttributs['range']['dateRange']['fromDate'], queryAttributs['range']['dateRange']['toDate']));
                              }
                              else {
                                  _searchQuery['_and'].push((0, QueryFunctions_1.Eq)(key, queryAttributs[key]));
                              }
                          }
                          let endpoint;
                          let method;
                          let body = {};
                          let limit = undefined;
                          if (!returnAll) {
                              limit = this.getNodeParameter('limit', i);
                          }
                          if (version === 'v1') {
                              endpoint = '/v1/query';
                              method = 'POST';
                              body = {
                                  query: [
                                      {
                                          _name: 'listObservable',
                                      },
                                      {
                                          _name: 'filter',
                                          _and: _searchQuery['_and'],
                                      },
                                  ],
                              };
                              (0, GenericFunctions_1.prepareSortQuery)(options.sort, body);
                              if (limit !== undefined) {
                                  (0, GenericFunctions_1.prepareRangeQuery)(`0-${limit}`, body);
                              }
                              qs.name = 'observables';
                          }
                          else {
                              method = 'POST';
                              endpoint = '/case/artifact/_search';
                              if (limit !== undefined) {
                                  qs.range = `0-${limit}`;
                              }
                              body.query = _searchQuery;
                              Object.assign(qs, (0, GenericFunctions_1.prepareOptional)(options));
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, method, endpoint, body, qs);
                      }
                      if (operation === 'update') {
                          const id = this.getNodeParameter('id', i);
                          const body = {
                              ...(0, GenericFunctions_1.prepareOptional)(this.getNodeParameter('updateFields', i, {})),
                          };
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'PATCH', `/case/artifact/${id}`, body, qs);
                          responseData = { success: true };
                      }
                  }
                  if (resource === 'case') {
                      if (operation === 'count') {
                          const filters = this.getNodeParameter('filters', i, {});
                          const countQueryAttributs = (0, GenericFunctions_1.prepareOptional)(filters);
                          const _countSearchQuery = (0, QueryFunctions_1.And)();
                          if ('customFieldsUi' in filters) {
                              const customFields = (await GenericFunctions_1.prepareCustomFields.call(this, filters));
                              const searchQueries = (0, GenericFunctions_1.buildCustomFieldSearch)(customFields);
                              _countSearchQuery['_and'].push(...searchQueries);
                          }
                          for (const key of Object.keys(countQueryAttributs)) {
                              if (key === 'tags') {
                                  _countSearchQuery['_and'].push((0, QueryFunctions_1.In)(key, countQueryAttributs[key]));
                              }
                              else if (key === 'description' || key === 'summary' || key === 'title') {
                                  _countSearchQuery['_and'].push((0, QueryFunctions_1.ContainsString)(key, countQueryAttributs[key]));
                              }
                              else {
                                  _countSearchQuery['_and'].push((0, QueryFunctions_1.Eq)(key, countQueryAttributs[key]));
                              }
                          }
                          const body = {
                              query: [
                                  {
                                      _name: 'listCase',
                                  },
                                  {
                                      _name: 'filter',
                                      _and: _countSearchQuery['_and'],
                                  },
                              ],
                          };
                          body['query'].push({
                              _name: 'count',
                          });
                          qs.name = 'count-cases';
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/v1/query', body, qs);
                          responseData = { count: responseData };
                      }
                      if (operation === 'executeResponder') {
                          const caseId = this.getNodeParameter('id', i);
                          const responderId = this.getNodeParameter('responder', i);
                          let body;
                          let response;
                          responseData = [];
                          body = {
                              responderId,
                              objectId: caseId,
                              objectType: 'case',
                          };
                          response = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/connector/cortex/action', body);
                          body = {
                              query: [
                                  {
                                      _name: 'listAction',
                                  },
                                  {
                                      _name: 'filter',
                                      _and: [
                                          {
                                              _field: 'cortexId',
                                              _value: response.cortexId,
                                          },
                                          {
                                              _field: 'objectId',
                                              _value: response.objectId,
                                          },
                                          {
                                              _field: 'startDate',
                                              _value: response.startDate,
                                          },
                                      ],
                                  },
                              ],
                          };
                          qs.name = 'log-actions';
                          do {
                              response = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/v1/query', body, qs);
                          } while (response.status === 'Waiting' || response.status === 'InProgress');
                          responseData = response;
                      }
                      if (operation === 'create') {
                          const options = this.getNodeParameter('options', i, {});
                          const jsonParameters = this.getNodeParameter('jsonParameters', i);
                          const customFields = await GenericFunctions_1.prepareCustomFields.call(this, options, jsonParameters);
                          const body = {
                              title: this.getNodeParameter('title', i),
                              description: this.getNodeParameter('description', i),
                              severity: this.getNodeParameter('severity', i),
                              startDate: Date.parse(this.getNodeParameter('startDate', i)),
                              owner: this.getNodeParameter('owner', i),
                              flag: this.getNodeParameter('flag', i),
                              tlp: this.getNodeParameter('tlp', i),
                              tags: (0, GenericFunctions_1.splitTags)(this.getNodeParameter('tags', i)),
                              ...(0, GenericFunctions_1.prepareOptional)(options),
                          };
                          if (customFields) {
                              Object.keys(customFields).forEach((key) => {
                                  (0, set_1.default)(body, key, customFields[key]);
                              });
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/case', body);
                      }
                      if (operation === 'get') {
                          const caseId = this.getNodeParameter('id', i);
                          const credentials = await this.getCredentials('theHiveApi');
                          const version = credentials.apiVersion;
                          let endpoint;
                          let method;
                          let body = {};
                          if (version === 'v1') {
                              endpoint = '/v1/query';
                              method = 'POST';
                              body = {
                                  query: [
                                      {
                                          _name: 'getCase',
                                          idOrName: caseId,
                                      },
                                  ],
                              };
                              qs.name = `get-case-${caseId}`;
                          }
                          else {
                              method = 'GET';
                              endpoint = `/case/${caseId}`;
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, method, endpoint, body, qs);
                      }
                      if (operation === 'getAll') {
                          const credentials = await this.getCredentials('theHiveApi');
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const version = credentials.apiVersion;
                          const filters = this.getNodeParameter('filters', i, {});
                          const queryAttributs = (0, GenericFunctions_1.prepareOptional)(filters);
                          const _searchQuery = (0, QueryFunctions_1.And)();
                          const options = this.getNodeParameter('options', i);
                          if ('customFieldsUi' in filters) {
                              const customFields = (await GenericFunctions_1.prepareCustomFields.call(this, filters));
                              const searchQueries = (0, GenericFunctions_1.buildCustomFieldSearch)(customFields);
                              _searchQuery['_and'].push(...searchQueries);
                          }
                          for (const key of Object.keys(queryAttributs)) {
                              if (key === 'tags') {
                                  _searchQuery['_and'].push((0, QueryFunctions_1.In)(key, queryAttributs[key]));
                              }
                              else if (key === 'description' || key === 'summary' || key === 'title') {
                                  _searchQuery['_and'].push((0, QueryFunctions_1.ContainsString)(key, queryAttributs[key]));
                              }
                              else {
                                  _searchQuery['_and'].push((0, QueryFunctions_1.Eq)(key, queryAttributs[key]));
                              }
                          }
                          let endpoint;
                          let method;
                          let body = {};
                          let limit = undefined;
                          if (!returnAll) {
                              limit = this.getNodeParameter('limit', i);
                          }
                          if (version === 'v1') {
                              endpoint = '/v1/query';
                              method = 'POST';
                              body = {
                                  query: [
                                      {
                                          _name: 'listCase',
                                      },
                                      {
                                          _name: 'filter',
                                          _and: _searchQuery['_and'],
                                      },
                                  ],
                              };
                              (0, GenericFunctions_1.prepareSortQuery)(options.sort, body);
                              if (limit !== undefined) {
                                  (0, GenericFunctions_1.prepareRangeQuery)(`0-${limit}`, body);
                              }
                              qs.name = 'cases';
                          }
                          else {
                              method = 'POST';
                              endpoint = '/case/_search';
                              if (limit !== undefined) {
                                  qs.range = `0-${limit}`;
                              }
                              body.query = _searchQuery;
                              Object.assign(qs, (0, GenericFunctions_1.prepareOptional)(options));
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, method, endpoint, body, qs);
                      }
                      if (operation === 'update') {
                          const id = this.getNodeParameter('id', i);
                          const updateFields = this.getNodeParameter('updateFields', i, {});
                          const jsonParameters = this.getNodeParameter('jsonParameters', i);
                          const customFields = await GenericFunctions_1.prepareCustomFields.call(this, updateFields, jsonParameters);
                          const body = {
                              ...customFields,
                              ...(0, GenericFunctions_1.prepareOptional)(updateFields),
                          };
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'PATCH', `/case/${id}`, body);
                      }
                  }
                  if (resource === 'task') {
                      if (operation === 'count') {
                          const countQueryAttributs = (0, GenericFunctions_1.prepareOptional)(this.getNodeParameter('filters', i, {}));
                          const _countSearchQuery = (0, QueryFunctions_1.And)();
                          for (const key of Object.keys(countQueryAttributs)) {
                              if (key === 'title' || key === 'description') {
                                  _countSearchQuery['_and'].push((0, QueryFunctions_1.ContainsString)(key, countQueryAttributs[key]));
                              }
                              else {
                                  _countSearchQuery['_and'].push((0, QueryFunctions_1.Eq)(key, countQueryAttributs[key]));
                              }
                          }
                          const body = {
                              query: [
                                  {
                                      _name: 'listTask',
                                  },
                                  {
                                      _name: 'filter',
                                      _and: _countSearchQuery['_and'],
                                  },
                              ],
                          };
                          body['query'].push({
                              _name: 'count',
                          });
                          qs.name = 'count-tasks';
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/v1/query', body, qs);
                          responseData = { count: responseData };
                      }
                      if (operation === 'create') {
                          const caseId = this.getNodeParameter('caseId', i);
                          const body = {
                              title: this.getNodeParameter('title', i),
                              status: this.getNodeParameter('status', i),
                              flag: this.getNodeParameter('flag', i),
                              ...(0, GenericFunctions_1.prepareOptional)(this.getNodeParameter('options', i, {})),
                          };
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', `/case/${caseId}/task`, body);
                      }
                      if (operation === 'executeResponder') {
                          const taskId = this.getNodeParameter('id', i);
                          const responderId = this.getNodeParameter('responder', i);
                          let body;
                          let response;
                          responseData = [];
                          body = {
                              responderId,
                              objectId: taskId,
                              objectType: 'case_task',
                          };
                          response = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/connector/cortex/action', body);
                          body = {
                              query: [
                                  {
                                      _name: 'listAction',
                                  },
                                  {
                                      _name: 'filter',
                                      _and: [
                                          {
                                              _field: 'cortexId',
                                              _value: response.cortexId,
                                          },
                                          {
                                              _field: 'objectId',
                                              _value: response.objectId,
                                          },
                                          {
                                              _field: 'startDate',
                                              _value: response.startDate,
                                          },
                                      ],
                                  },
                              ],
                          };
                          qs.name = 'task-actions';
                          do {
                              response = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/v1/query', body, qs);
                          } while (response.status === 'Waiting' || response.status === 'InProgress');
                          responseData = response;
                      }
                      if (operation === 'get') {
                          const taskId = this.getNodeParameter('id', i);
                          const credentials = await this.getCredentials('theHiveApi');
                          const version = credentials.apiVersion;
                          let endpoint;
                          let method;
                          let body = {};
                          if (version === 'v1') {
                              endpoint = '/v1/query';
                              method = 'POST';
                              body = {
                                  query: [
                                      {
                                          _name: 'getTask',
                                          idOrName: taskId,
                                      },
                                  ],
                              };
                              qs.name = `get-task-${taskId}`;
                          }
                          else {
                              method = 'GET';
                              endpoint = `/case/task/${taskId}`;
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, method, endpoint, body, qs);
                      }
                      if (operation === 'getAll') {
                          const credentials = await this.getCredentials('theHiveApi');
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const version = credentials.apiVersion;
                          const caseId = this.getNodeParameter('caseId', i);
                          const options = this.getNodeParameter('options', i);
                          let endpoint;
                          let method;
                          let body = {};
                          let limit = undefined;
                          if (!returnAll) {
                              limit = this.getNodeParameter('limit', i);
                          }
                          if (version === 'v1') {
                              endpoint = '/v1/query';
                              method = 'POST';
                              body = {
                                  query: [
                                      {
                                          _name: 'getCase',
                                          idOrName: caseId,
                                      },
                                      {
                                          _name: 'tasks',
                                      },
                                  ],
                              };
                              (0, GenericFunctions_1.prepareSortQuery)(options.sort, body);
                              if (limit !== undefined) {
                                  (0, GenericFunctions_1.prepareRangeQuery)(`0-${limit}`, body);
                              }
                              qs.name = 'case-tasks';
                          }
                          else {
                              method = 'POST';
                              endpoint = '/case/task/_search';
                              if (limit !== undefined) {
                                  qs.range = `0-${limit}`;
                              }
                              body.query = (0, QueryFunctions_1.And)((0, QueryFunctions_1.Parent)('case', (0, QueryFunctions_1.Id)(caseId)));
                              Object.assign(qs, (0, GenericFunctions_1.prepareOptional)(options));
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, method, endpoint, body, qs);
                      }
                      if (operation === 'search') {
                          const credentials = await this.getCredentials('theHiveApi');
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const version = credentials.apiVersion;
                          const queryAttributs = (0, GenericFunctions_1.prepareOptional)(this.getNodeParameter('filters', i, {}));
                          const _searchQuery = (0, QueryFunctions_1.And)();
                          const options = this.getNodeParameter('options', i);
                          for (const key of Object.keys(queryAttributs)) {
                              if (key === 'title' || key === 'description') {
                                  _searchQuery['_and'].push((0, QueryFunctions_1.ContainsString)(key, queryAttributs[key]));
                              }
                              else {
                                  _searchQuery['_and'].push((0, QueryFunctions_1.Eq)(key, queryAttributs[key]));
                              }
                          }
                          let endpoint;
                          let method;
                          let body = {};
                          let limit = undefined;
                          if (!returnAll) {
                              limit = this.getNodeParameter('limit', i);
                          }
                          if (version === 'v1') {
                              endpoint = '/v1/query';
                              method = 'POST';
                              body = {
                                  query: [
                                      {
                                          _name: 'listTask',
                                      },
                                      {
                                          _name: 'filter',
                                          _and: _searchQuery['_and'],
                                      },
                                  ],
                              };
                              (0, GenericFunctions_1.prepareSortQuery)(options.sort, body);
                              if (limit !== undefined) {
                                  (0, GenericFunctions_1.prepareRangeQuery)(`0-${limit}`, body);
                              }
                              qs.name = 'tasks';
                          }
                          else {
                              method = 'POST';
                              endpoint = '/case/task/_search';
                              if (limit !== undefined) {
                                  qs.range = `0-${limit}`;
                              }
                              body.query = _searchQuery;
                              Object.assign(qs, (0, GenericFunctions_1.prepareOptional)(options));
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, method, endpoint, body, qs);
                      }
                      if (operation === 'update') {
                          const id = this.getNodeParameter('id', i);
                          const body = {
                              ...(0, GenericFunctions_1.prepareOptional)(this.getNodeParameter('updateFields', i, {})),
                          };
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'PATCH', `/case/task/${id}`, body);
                      }
                  }
                  if (resource === 'log') {
                      if (operation === 'create') {
                          const taskId = this.getNodeParameter('taskId', i);
                          let body = {
                              message: this.getNodeParameter('message', i),
                              startDate: Date.parse(this.getNodeParameter('startDate', i)),
                              status: this.getNodeParameter('status', i),
                          };
                          const optionals = this.getNodeParameter('options', i);
                          let options = {};
                          if (optionals.attachementUi) {
                              const attachmentValues = optionals.attachementUi
                                  .attachmentValues;
                              if (attachmentValues) {
                                  const binaryPropertyName = attachmentValues.binaryProperty;
                                  const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                                  const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
                                  options = {
                                      formData: {
                                          attachment: {
                                              value: dataBuffer,
                                              options: {
                                                  contentType: binaryData.mimeType,
                                                  filename: binaryData.fileName,
                                              },
                                          },
                                          _json: JSON.stringify(body),
                                      },
                                  };
                                  body = {};
                              }
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', `/case/task/${taskId}/log`, body, qs, '', options);
                      }
                      if (operation === 'executeResponder') {
                          const logId = this.getNodeParameter('id', i);
                          const responderId = this.getNodeParameter('responder', i);
                          let body;
                          let response;
                          responseData = [];
                          body = {
                              responderId,
                              objectId: logId,
                              objectType: 'case_task_log',
                          };
                          response = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/connector/cortex/action', body);
                          body = {
                              query: [
                                  {
                                      _name: 'listAction',
                                  },
                                  {
                                      _name: 'filter',
                                      _and: [
                                          {
                                              _field: 'cortexId',
                                              _value: response.cortexId,
                                          },
                                          {
                                              _field: 'objectId',
                                              _value: response.objectId,
                                          },
                                          {
                                              _field: 'startDate',
                                              _value: response.startDate,
                                          },
                                      ],
                                  },
                              ],
                          };
                          qs.name = 'log-actions';
                          do {
                              response = await GenericFunctions_1.theHiveApiRequest.call(this, 'POST', '/v1/query', body, qs);
                          } while (response.status === 'Waiting' || response.status === 'InProgress');
                          responseData = response;
                      }
                      if (operation === 'get') {
                          const logId = this.getNodeParameter('id', i);
                          const credentials = await this.getCredentials('theHiveApi');
                          const version = credentials.apiVersion;
                          let endpoint;
                          let method;
                          let body = {};
                          if (version === 'v1') {
                              endpoint = '/v1/query';
                              method = 'POST';
                              body = {
                                  query: [
                                      {
                                          _name: 'getLog',
                                          idOrName: logId,
                                      },
                                  ],
                              };
                              qs.name = `get-log-${logId}`;
                          }
                          else {
                              method = 'POST';
                              endpoint = '/case/task/log/_search';
                              body.query = { _id: logId };
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, method, endpoint, body, qs);
                      }
                      if (operation === 'getAll') {
                          const credentials = await this.getCredentials('theHiveApi');
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const version = credentials.apiVersion;
                          const taskId = this.getNodeParameter('taskId', i);
                          let endpoint;
                          let method;
                          let body = {};
                          let limit = undefined;
                          if (!returnAll) {
                              limit = this.getNodeParameter('limit', i);
                          }
                          if (version === 'v1') {
                              endpoint = '/v1/query';
                              method = 'POST';
                              body = {
                                  query: [
                                      {
                                          _name: 'getTask',
                                          idOrName: taskId,
                                      },
                                      {
                                          _name: 'logs',
                                      },
                                  ],
                              };
                              if (limit !== undefined) {
                                  (0, GenericFunctions_1.prepareRangeQuery)(`0-${limit}`, body);
                              }
                              qs.name = 'case-task-logs';
                          }
                          else {
                              method = 'POST';
                              endpoint = '/case/task/log/_search';
                              if (limit !== undefined) {
                                  qs.range = `0-${limit}`;
                              }
                              body.query = (0, QueryFunctions_1.And)((0, QueryFunctions_1.Parent)('task', (0, QueryFunctions_1.Id)(taskId)));
                          }
                          responseData = await GenericFunctions_1.theHiveApiRequest.call(this, method, endpoint, body, qs);
                      }
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                  returnData.push(...executionData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionData);
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.TheHive = TheHive;
  //# sourceMappingURL=TheHive.node.js.map

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

  # TheHive Trigger node

  On this page, you'll find a list of events the TheHive Trigger node can respond to and links to more resources.

  /// note | TheHive and TheHive 5
  n8n provides two nodes for TheHive. Use this node (TheHive Trigger) if you want to use TheHive's version 3 or 4 API. If you want to use version 5, use [TheHive 5 Trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.thehive5trigger.md).
  ///

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

  ## Events

  * Alert 
  	* Created
  	* Deleted
  	* Updated
  * Case
  	* Created
  	* Deleted
  	* Updated
  * Log
  	* Created
  	* Deleted
  	* Updated
  * Observable
  	* Created
  	* Deleted
  	* Updated
  * Task
  	* Created
  	* Deleted
  	* Updated

  ## Related resources

  n8n provides an app node for TheHive. You can find the node docs [here](/integrations/builtin/app-nodes/n8n-nodes-base.thehive.md).

  View [example workflows and related content](https://n8n.io/integrations/thehive-trigger/){:target=_blank .external-link} on n8n's website.

  Refer to TheHive's documentation for more information about the service:

  * [Version 3](https://docs.thehive-project.org/thehive/legacy/thehive3/api/){:target=_blank .external-link}
  * [Version 4](https://docs.thehive-project.org/cortex/api/api-guide/){:target=_blank .external-link}


  ## Configure a webhook in TheHive

  To configure the webhook for your TheHive instance:

  1. Copy the testing and production webhook URLs from TheHive Trigger node.
  2. Add the following lines to the `application.conf` file. This is TheHive configuration file:

  	```
  	notification.webhook.endpoints = [
  		{
  			name: TESTING_WEBHOOK_NAME
  			url: TESTING_WEBHOOK_URL
  			version: 0
  			wsConfig: {}
  			includedTheHiveOrganisations: ["ORGANIZATION_NAME"]
  			excludedTheHiveOrganisations: []
  		},
  		{
  			name: PRODUCTION_WEBHOOK_NAME
  			url: PRODUCTION_WEBHOOK_URL
  			version: 0
  			wsConfig: {}
  			includedTheHiveOrganisations: ["ORGANIZATION_NAME"]
  			excludedTheHiveOrganisations: []
  		}
  	]
  	```

  3. Replace `TESTING_WEBHOOK_URL` and `PRODUCTION_WEBHOOK_URL` with the URLs you copied in the previous step.
  4. Replace `TESTING_WEBHOOK_NAME` and `PRODUCTION_WEBHOOK_NAME` with your preferred endpoint names.
  5. Replace `ORGANIZATION_NAME` with your organization name.
  6. Execute the following cURL command to enable notifications:
  	```sh
  	curl -XPUT -uTHEHIVE_USERNAME:THEHIVE_PASSWORD -H 'Content-type: application/json' THEHIVE_URL/api/config/organisation/notification -d '
  	{
  		"value": [
  			{
  			"delegate": false,
  			"trigger": { "name": "AnyEvent"},
  			"notifier": { "name": "webhook", "endpoint": "TESTING_WEBHOOK_NAME" }
  			},
  			{
  			"delegate": false,
  			"trigger": { "name": "AnyEvent"},
  			"notifier": { "name": "webhook", "endpoint": "PRODUCTION_WEBHOOK_NAME" }
  			}
  		]
  	}'
  	```

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"840b133e-8fb2-4fa6-908f-4f92b45b5254","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"ecf184b49822fa1ad1d5a048ea41ea55775012d0e6192f5a8076f9daaef5f5d1"}}


