# nodes

node_type: n8n-nodes-base.HttpRequest
name: HttpRequest
display_name: HTTP Request
description: Makes an HTTP request and returns the response data
category: Other
code_hash: 5b5e2328474b7e85361c940dfe942e167b3f0057f38062f56d6b693f0a7ffe7e
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/index
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:23
updated_at: 2025-06-08 08:05:23
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.HttpRequest = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const HttpRequestV1_node_1 = require("./V1/HttpRequestV1.node");
  const HttpRequestV2_node_1 = require("./V2/HttpRequestV2.node");
  const HttpRequestV3_node_1 = require("./V3/HttpRequestV3.node");
  class HttpRequest extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'HTTP Request',
              name: 'httpRequest',
              icon: 'fa:at',
              group: ['output'],
              subtitle: '={{$parameter["requestMethod"] + ": " + $parameter["url"]}}',
              description: 'Makes an HTTP request and returns the response data',
              defaultVersion: 4.1,
          };
          const nodeVersions = {
              1: new HttpRequestV1_node_1.HttpRequestV1(baseDescription),
              2: new HttpRequestV2_node_1.HttpRequestV2(baseDescription),
              3: new HttpRequestV3_node_1.HttpRequestV3(baseDescription),
              4: new HttpRequestV3_node_1.HttpRequestV3(baseDescription),
              4.1: new HttpRequestV3_node_1.HttpRequestV3(baseDescription),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.HttpRequest = HttpRequest;
  //# sourceMappingURL=HttpRequest.node.js.map

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

  # HTTP Request node

  The HTTP Request node is one of the most versatile nodes in n8n. It allows you to make HTTP requests to query data from any app or service with a REST API. You can use the HTTP Request node a regular node or attached to an [AI agent](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/tools-agent.md) to use as a [tool](/advanced-ai/examples/understand-tools.md){ data-preview }.

  When using this node, you're creating a REST API call. You need some understanding of basic API terminology and concepts.

  There are two ways to create an HTTP request: configure the [node parameters](#node-parameters) or [import a curl command](#import-curl-command).

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

  ## Node parameters

  ### Method

  Select the method to use for the request:

  - DELETE
  - GET
  - HEAD
  - OPTIONS
  - PATCH
  - POST
  - PUT

  ### URL

  Enter the endpoint you want to use.

  ### Authentication

  n8n recommends using the **Predefined Credential Type** option when it's available. It offers an easier way to set up and manage credentials, compared to configuring generic credentials.

  #### Predefined credentials

  Credentials for integrations supported by n8n, including both built-in and community nodes. Use **Predefined Credential Type** for custom operations without extra setup. Refer to [Custom API operations](/integrations/custom-operations.md) for more information.

  #### Generic credentials

  Credentials for integrations not supported by n8n. You'll need to manually configure the authentication process, including specifying the required API endpoints, necessary parameters, and the authentication method. 

  You can select one of the following methods:

  * Basic auth
  * Custom auth
  * Digest auth
  * Header auth
  * OAuth1 API
  * OAuth2 API
  * Query auth

  Refer to [HTTP request credentials](/integrations/builtin/credentials/httprequest.md) for more information on setting up each credential type.

  ### Send Query Parameters

  Query parameters act as filters on HTTP requests. If the API you're interacting with supports them and the request you're making needs a filter, turn this option on.

  **Specify your query parameters** using one of the available options:

  * **Using Fields Below**: Enter **Name**/**Value** pairs of **Query Parameters**. To enter more query parameter name/value pairs, select **Add Parameter**. The name is the name of the field you're filtering on, and the value is the filter value.
  * **Using JSON**: Enter **JSON** to define your query parameters.

  Refer to your service's API documentation for detailed guidance.

  ### Send Headers

  Use this parameter to send headers with your request. Headers contain metadata or context about your request.

  **Specify Headers** using one of the available options:

  * **Using Fields Below**: Enter **Name**/**Value** pairs of **Header Parameters**. To enter more header parameter name/value pairs, select **Add Parameter**. The name is the header you wish to set, and the value is the value you want to pass for that header.
  * **Using JSON**: Enter **JSON** to define your header parameters.

  Refer to your service's API documentation for detailed guidance.

  ### Send Body

  If you need to send a body with your API request, turn this option on.

  Then select the **Body Content Type** that best matches the format for the body content you wish to send.

  <!-- vale Vale.Spelling = NO -->
  #### Form URLencoded
  <!-- vale Vale.Spelling = YES -->

  Use this option to send your body as `application/x-www-form-urlencoded`.

  **Specify Body** using one of the available options:

  * **Using Fields Below**: Enter **Name**/**Value** pairs of **Body Parameters**. To enter more body parameter name/value pairs, select **Add Parameter**. The name should be the form field name, and the value is what you wish to set that field to.
  * **Using Single Field**: Enter your name/value pairs in a single **Body** parameter with format `fieldname1=value1&fieldname2=value2`.

  Refer to your service's API documentation for detailed guidance.

  #### Form-Data

  Use this option to send your body as `multipart/form-data`.

  Configure your **Body Parameters** by selecting the **Parameter Type**:

  * Choose **Form Data** to enter **Name**/**Value** pairs.
  * Choose **n8n Binary File** to pull the body from a file the node has access to.
      * **Name**: Enter the ID of the field to set.
      * **Input Data Field Name**: Enter the name of the incoming field containing the binary file data you want to process.

  Select **Add Parameter** to enter more parameters.

  Refer to your service's API documentation for detailed guidance.

  #### JSON

  Use this option to send your body as JSON.

  **Specify Body** using one of the available options:

  * **Using Fields Below**: Enter **Name**/**Value** pairs of **Body Parameters**. To enter more body parameter name/value pairs, select **Add Parameter**.
  * **Using JSON**: Enter **JSON** to define your body.

  Refer to your service's API documentation for detailed guidance.

  #### n8n Binary File

  Use this option to send the contents of a file stored in n8n as the body.

  Enter the name of the incoming field that contains the file as the **Input Data Field Name**.

  Refer to your service's API documentation for detailed guidance on how to format the file.

  #### Raw

  Use this option to send raw data in the body.

  * **Content Type**: Enter the `Content-Type` header to use for the raw body content. Refer to the IANA [Media types](https://www.iana.org/assignments/media-types/media-types.xhtml){:target=_blank .external-link} documentation for a full list of MIME content types.
  * **Body**: Enter the raw body content to send.

  Refer to your service's API documentation for detailed guidance.

  ## Node options

  Select **Add Option** to view and select these options. Options are available to all parameters unless otherwise noted.

  ### Array Format in Query Parameters

  /// note | Option availability
  This option is only available when you turn on **Send Query Parameters**.
  ///

  Use this option to control the format for arrays included in query parameters. Choose from these options:

  * **No Brackets**: Arrays will format as the name=value for each item in the array, for example: `foo=bar&foo=qux`.
  * **Brackets Only**: The node adds square brackets after each array name, for example: `foo[]=bar&foo[]=qux`.
  * **Brackets with Indices**: The node adds square brackets with an index value after each array name, for example: `foo[0]=bar&foo[1]=qux`.

  Refer to your service's API documentation for guidance on which option to use.

  ### Batching

  Control how to batch large numbers of input items:

  * **Items per Batch**: Enter the number of input items to include in each batch.
  * **Batch Interval**: Enter the time to wait between each batch of requests in milliseconds. Enter 0 for no batch interval.

  ### Ignore SSL Issues

  By default, n8n only downloads the response if SSL certificate validation succeeds. If you'd like to download the response even if SSL certificate validation fails, turn this option on.

  ### Lowercase Headers

  Choose whether to lowercase header names (turned on, default) or not (turned off).

  ### Redirects

  Choose whether to follow redirects (turned on by default) or not (turned off). If turned on, enter the maximum number of redirects the request should follow in **Max Redirects**.

  ### Response

  Use this option to set some details about the expected API response, including:

  * **Include Response Headers and Status**: By default, the node returns only the body. Turn this option on to return the full response (headers and response status code) as well as the body.
  * **Never Error**: By default, the node returns success only when the response returns with a 2xx code. Turn this option on to return success regardless of the code returned.
  * **Response Format**: Select the format in which the data gets returned. Choose from:
      * **Autodetect** (default): The node detects and formats the response based on the data returned.
      * **File**: Select this option to put the response into a file. Enter the field name where you want the file returned in **Put Output in Field**.
      * **JSON**: Select this option to format the response as JSON.
      * **Text**: Select this option to format the response as plain text. Enter the field name where you want the file returned in **Put Output in Field**.

  ### Pagination

  Use this option to paginate results, useful for handling query results that are too big for the API to return in a single call.

  /// note | Inspect the API data first
  Some options for pagination require knowledge of the data returned by the API you're using. Before setting up pagination, either check the API documentation, or do an API call without pagination, to see the data it returns.
  ///
  ??? Details "Understand pagination"
      Pagination means splitting a large set of data into multiple pages. The amount of data on each page depends on the limit you set.
    
      For example, you make an API call to an endpoint called `/users`. The API wants to send back information on 300 users, but this is too much data for the API to send in one response. 
    
      If the API supports pagination, you can incrementally fetch the data. To do this, you call `/users` with a pagination limit, and a page number or URL to tell the API which page to send. In this example, say you use a limit of 10, and start from page 0. The API sends the first 10 users in its response. You then call the API again, increasing the page number by 1, to get the next 10 results.

  Configure the pagination settings:

  * **Pagination Mode**:
      * **Off**: Turn off pagination.
      * **Update a Parameter in Each Request**: Use this when you need to dynamically set parameters for each request.
      * **Response Contains Next URL**: Use this when the API response includes the URL of the next page. Use an expression to set **Next URL**.

  For example setups, refer to [HTTP Request node cookbook | Pagination](/code/cookbook/http-node/pagination.md).

  n8n provides built-in variables for working with HTTP node requests and responses when using pagination:

  --8<-- "_snippets/integrations/builtin/core-nodes/http/pagination-variables.md"

  --8<-- "_snippets/integrations/builtin/core-nodes/http/pagination-api-differences.md"

  ### Proxy

  Use this option if you need to specify an HTTP proxy.

  Enter the **Proxy** the request should use.

  ### Timeout

  Use this option to set how long the node should wait for the server to send response headers (and start the response body). The node aborts requests that exceed this value for the initial response.

  Enter the **Timeout** time to wait in milliseconds.

  ## Tool-only options

  The following options are only available when attached to an [AI agent](/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.agent/tools-agent.md) as a [tool](/advanced-ai/examples/understand-tools.md){ data-preview }.

  ### Optimize Response

  Whether to optimize the tool response to reduce the amount of data passed to the LLM. Optimizing the response can reduce costs and can help the LLM ignore unimportant details, often leading to better results.

  When optimizing responses, you select an expected response type, which determines other options you can configure. The supported response types are:

  #### JSON

  When expecting a **JSON** response, you can configure which parts of the JSON data to use as a response with the following choices:

  * **Field Containing Data**: This field identifies a specific part of the JSON object that contains your relevant data. You can leave this blank to use the entire response.
  * **Include Fields**: This is how you choose which fields you want in your response object. There are three choices:
  	* **All**: Include all fields in the response object.
  	* **Selected**: Include only the fields specified below.
  		* **Fields**: A comma-separated list of fields to include in the response. You can use dot notation to specify nested fields. You can drag fields from the Input panel to add them to the field list.
  	* **Exclude**: Include all fields *except* the fields specified below.
  		* **Fields**: A comma-separated list of fields to exclude from the response. You can use dot notation to specify nested fields. You can drag fields from the Input panel to add them to the field list.

  #### HTML

  When expecting **HTML**, you can identify the part of an HTML document relevant to the LLM and optimize the response with the following options:

  * **Selector (CSS)**: A specific element or element type to include in the response HTML. Uses the `body` element by default.
  * **Return Only Content**: Whether to strip HTML tags and attributes from the response, leaving only the actual content. This uses fewer tokens and may be easier for the model to understand.
  	* **Elements To Omit**: A comma-separated list of CSS selectors to exclude when extracting content.
  * **Truncate Response**: Whether to limit the response size to save tokens.
  	* **Max Response Characters**: The maximum number of characters to include in the HTML response. The default value is 1000.

  #### Text

  When expecting a generic **Text** response, you can optimize the results with the following options:

  * **Truncate Response**: Whether to limit the response size to save tokens.
  	* **Max Response Characters**: The maximum number of characters to include in the HTML response. The default value is 1000.

  ## Import curl command

  [curl](https://curl.se/){:target=_blank .external-link} is a command line tool and library for transferring data with URLs.

  You can use curl to call REST APIs. If the API documentation of the service you want to use provides curl examples, you can copy them out of the documentation and into n8n to configure the HTTP Request node.

  Import a curl command:

  1. From the HTTP Request node's **Parameters** tab, select **Import cURL**. The **Import cURL command** modal opens.
  2. Paste your curl command into the text box.
  3. Select **Import**. n8n loads the request configuration into the node fields. This overwrites any existing configuration.

  ## Templates and examples

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

  ## Common issues

  For common questions or issues and suggested solutions, refer to [Common Issues](/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/common-issues.md).

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"74dd8647-fc87-421d-9e54-eed9d4ab786e","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"acbc35295e830cb8bf027656a82a45f0cc9ebcb59fc0a6ba585411eb206896aa"}}


node_type: n8n-nodes-base.Hubspot
name: Hubspot
display_name: HubSpot
description: Consume HubSpot API
category: Other
code_hash: 548619ac567c0ab051e7b0e159df7fd6bc41234effe4ccb766c6ab62a9cbde8d
documentation_url: https://docs.n8n.io/integrations/builtin/credentials/hubspot
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:24
updated_at: 2025-06-08 08:05:24
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Hubspot = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const HubspotV1_node_1 = require("./V1/HubspotV1.node");
  const HubspotV2_node_1 = require("./V2/HubspotV2.node");
  class Hubspot extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'HubSpot',
              name: 'hubspot',
              icon: 'file:hubspot.svg',
              group: ['output'],
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume HubSpot API',
              defaultVersion: 2,
          };
          const nodeVersions = {
              1: new HubspotV1_node_1.HubspotV1(baseDescription),
              2: new HubspotV2_node_1.HubspotV2(baseDescription),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.Hubspot = Hubspot;
  //# sourceMappingURL=Hubspot.node.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: HubSpot credentials
  description: Documentation for HubSpot credentials. Use these credentials to authenticate HubSpot in n8n, a workflow automation platform.
  contentType: [integration, reference]
  priority: medium
  ---

  # HubSpot credentials

  You can use these credentials to authenticate the following nodes:

  - [HubSpot](/integrations/builtin/app-nodes/n8n-nodes-base.hubspot.md)
  - [HubSpot Trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.hubspottrigger.md)

  ## Supported authentication methods

  - App token: Use with the [HubSpot](/integrations/builtin/app-nodes/n8n-nodes-base.hubspot.md) node.
  - Developer API key: Use with the [HubSpot Trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.hubspottrigger.md) node.
  - OAuth2: Use with the [HubSpot](/integrations/builtin/app-nodes/n8n-nodes-base.hubspot.md) node.

  /// warning | API key deprecated
  HubSpot deprecated the regular **API Key** authentication method. The option still appears in n8n, but you should use the authentication methods listed above instead. If you have existing integrations using this API key method, refer to HubSpot's [Migrate an API key integration to a private app](https://developers.hubspot.com/docs/api/migrate-an-api-key-integration-to-a-private-app){:target=_blank .external-link} guide and set up an app token.
  ///

  ## Related resources

  Refer to [HubSpot's API documentation](https://developers.hubspot.com/docs/api/overview){:target=_blank .external-link} for more information about the service. The [HubSpot Trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.hubspottrigger.md) node uses the Webhooks API; refer to [HubSpot's Webhooks API documentation](https://developers.hubspot.com/docs/api/webhooks){:target=_blank .external-link} for more information about that service.

  ## Using App token

  To configure this credential, you'll need a [HubSpot](https://www.hubspot.com/){:target=_blank .external-link} account or [HubSpot developer](https://developers.hubspot.com/){:target=_blank .external-link} account and:

  - An **App Token**

  To generate an app token, create a private app in HubSpot:

  1. In your HubSpot account, select the **settings icon** in the main navigation bar.
  2. In the left sidebar menu, go to **Integrations > Private Apps**.
  3. Select **Create private app**.
  4. On the **Basic Info** tab, enter your app's **Name**.
  5. Hover over the **placeholder logo** and select the upload icon to upload a square image that will serve as the logo for your app.
  6. Enter a **Description** for your app.
  7. Open the **Scopes** tab and add the appropriate scopes. Refer to [Required scopes for HubSpot node](#required-scopes-for-hubspot-node) for a complete list of scopes you should add.
  8. Select **Create app** to finish the process.
  9. In the modal, review the info about your app's access token, then select **Continue creating**.
  10. Once your app's created, open the **Access token card** and select **Show token** to reveal the token.
  11. Copy this token and enter it in your n8n credential.

  Refer to the [HubSpot Private Apps documentation](https://developers.hubspot.com/docs/api/private-apps){:target=_blank .external-link} for more information.

  ## Using Developer API key

  To configure this credential, you'll need a [HubSpot developer](https://developers.hubspot.com/){:target=_blank .external-link} account and:

  - A **Client ID**: Generated once you create a public app. 
  - A **Client Secret**: Generated once you create a public app.
  - A **Developer API Key**: Generated from your Developer Apps dashboard.
  - An **App ID**: Generated once you create a public app.

  To create the public app and set up the credential:

  1. Log into your [HubSpot app developer account](https://developers.hubspot.com/){:target=_blank .external-link}.
  2. Select **Apps** from the main navigation bar.
  3. Select **Get HubSpot API key**. You may need to select the option to **Show key**.
  4. Copy the key and enter it in n8n as the **Developer API Key**.
  3. Still on the HubSpot **Apps** page, select **Create app**.
  4. On the **App Info** tab, add an **App name**, **Description**, **Logo**, and any support contact info you want to provide. Anyone encountering the app would see these.
  5. Open the **Auth** tab.
  6. Copy the **App ID** and enter it in n8n.
  6. Copy the **Client ID** and enter it in n8n.
  7. Copy the **Client Secret** and enter it in n8n.
  8. In the **Scopes** section, select **Add new scope**.
  9. Add all the scopes listed in [Required scopes for HubSpot Trigger node](#required-scopes-for-hubspot-trigger-node) to your app.
  10. Select **Update**.
  11. Copy the n8n **OAuth Redirect URL** and enter it as the **Redirect URL** in your HubSpot app.
  12. Select **Create app** to finish creating the HubSpot app.

   Refer to the [HubSpot Public Apps documentation](https://developers.hubspot.com/docs/api/creating-an-app){:target=_blank .external-link} for more detailed instructions.

  ### Required scopes for HubSpot Trigger node

  If you're creating an app for use with the [HubSpot Trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.hubspottrigger.md) node, n8n recommends starting with these scopes:

  | **Element** | **Object** | **Permission** | **Scope name** |
  | --- | --- | --- | --- |
  | n/a | n/a | n/a | `oauth` |
  | CRM | Companies | Read | `crm.objects.companies.read` |
  | CRM | Companies schemas | Read | `crm.schemas.companies.read` |
  | CRM | Contacts | Read | `crm.objects.contacts.read` |
  | CRM | Contacts schemas | Read | `crm.schemas.contacts.read` |
  | CRM | Deals | Read | `crm.objects.deals.read` |
  | CRM | Deals schemas| Read | `crm.schemas.deals.read` |

  /// warning | HubSpot old accounts
  Some HubSpot accounts don't have access to all the scopes. HubSpot is migrating accounts gradually. If you can't find all the scopes in your current HubSpot developer account, try creating a fresh developer account.
  ///

  ## Using OAuth2

  --8<-- "_snippets/integrations/builtin/credentials/cloud-oauth-button.md"

  If you're [self-hosting](/hosting/index.md) n8n, you'll need to configure OAuth2 from scratch by creating a new public app:

  1. Log into your [HubSpot app developer account](https://developers.hubspot.com/){:target=_blank .external-link}.
  2. Select **Apps** from the main navigation bar.
  3. Select **Create app**.
  4. On the **App Info** tab, add an **App name**, **Description**, **Logo**, and any support contact info you want to provide. Anyone encountering the app would see these.
  5. Open the **Auth** tab.
  6. Copy the **App ID** and enter it in n8n.
  6. Copy the **Client ID** and enter it in n8n.
  7. Copy the **Client Secret** and enter it in n8n.
  8. In the **Scopes** section, select **Add new scope**.
  9. Add all the scopes listed in [Required scopes for HubSpot node](#required-scopes-for-hubspot-node) to your app.
  10. Select **Update**.
  11. Copy the n8n **OAuth Redirect URL** and enter it as the **Redirect URL** in your HubSpot app.
  12. Select **Create app** to finish creating the HubSpot app.

  Refer to the [HubSpot Public Apps documentation](https://developers.hubspot.com/docs/api/creating-an-app){:target=_blank .external-link} for more detailed instructions. If you need more detail on what's happening in the OAuth web flow, refer to the [HubSpot Working with OAuth documentation](https://developers.hubspot.com/docs/api/working-with-oauth){:target=_blank .external-link}.

  ## Required scopes for HubSpot node

  If you're creating an app for use with the [HubSpot](/integrations/builtin/app-nodes/n8n-nodes-base.hubspot.md) node, n8n recommends starting with these scopes:

  | **Element** | **Object** | **Permission** | **Scope name(s)** |
  | --- | --- | --- | --- |
  | n/a | n/a | n/a |  `oauth` |
  | n/a | n/a | n/a |  `forms` |
  | n/a | n/a | n/a |  `tickets` |
  | CRM | Companies | Read <br> Write | `crm.objects.companies.read` <br> `crm.objects.companies.write`|
  | CRM | Companies schemas | Read | `crm.schemas.companies.read` |
  | CRM | Contacts schemas | Read | `crm.schemas.contacts.read` |
  | CRM | Contacts | Read <br> Write | `crm.objects.contacts.read` <br> `crm.objects.contacts.write`|
  | CRM | Deals | Read <br> Write | `crm.objects.deals.read` <br> `crm.objects.deals.write`|
  | CRM | Deals schemas | Read | `crm.schemas.deals.read` |
  | CRM | Owners | Read | `crm.objects.owners.read` |
  | CRM | Lists | Write | `crm.lists.write` |

  /// warning | HubSpot old accounts
  Some HubSpot accounts don't have access to all the scopes. HubSpot is migrating accounts gradually. If you can't find all the scopes in your current HubSpot developer account, try creating a fresh developer account.
  ///

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"b1cb11ca-89ca-4d1d-b506-863b79e86cf7","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"46e85d4e06f68e4e1e5665e055b89eaaec3bb0b5c76ca75668c53f4e5be6c2d2"}}


node_type: n8n-nodes-base.ICalendar
name: ICalendar
display_name: iCalendar
description: Create iCalendar file
category: Other
code_hash: df6fb1c5955472887fe485c224bc5a433d19ff2a1938eeb576e0b133ef647720
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:24
updated_at: 2025-06-08 08:05:24
source_code:
  "use strict";
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
      if (k2 === undefined) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() { return m[k]; } };
      }
      Object.defineProperty(o, k2, desc);
  }) : (function(o, m, k, k2) {
      if (k2 === undefined) k2 = k;
      o[k2] = m[k];
  }));
  var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
  }) : function(o, v) {
      o["default"] = v;
  });
  var __importStar = (this && this.__importStar) || function (mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
      __setModuleDefault(result, mod);
      return result;
  };
  var __importDefault = (this && this.__importDefault) || function (mod) {
      return (mod && mod.__esModule) ? mod : { "default": mod };
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ICalendar = void 0;
  const util_1 = require("util");
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
  const ics = __importStar(require("ics"));
  const createEvent = (0, util_1.promisify)(ics.createEvent);
  class ICalendar {
      constructor() {
          this.description = {
              displayName: 'iCalendar',
              name: 'iCal',
              icon: 'fa:calendar',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"]}}',
              description: 'Create iCalendar file',
              defaults: {
                  name: 'iCalendar',
                  color: '#408000',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Create Event File',
                              value: 'createEventFile',
                          },
                      ],
                      default: 'createEventFile',
                  },
                  {
                      displayName: 'Event Title',
                      name: 'title',
                      type: 'string',
                      default: '',
                  },
                  {
                      displayName: 'Start',
                      name: 'start',
                      type: 'dateTime',
                      default: '',
                      required: true,
                      description: 'Date and time at which the event begins. (For all-day events, the time will be ignored.).',
                  },
                  {
                      displayName: 'End',
                      name: 'end',
                      type: 'dateTime',
                      default: '',
                      required: true,
                      description: 'Date and time at which the event ends. (For all-day events, the time will be ignored.).',
                  },
                  {
                      displayName: 'All Day',
                      name: 'allDay',
                      type: 'boolean',
                      default: false,
                      description: 'Whether the event lasts all day or not',
                  },
                  {
                      displayName: 'Binary Property',
                      name: 'binaryPropertyName',
                      type: 'string',
                      default: 'data',
                      required: true,
                      description: 'The field that your iCalendar file will be available under in the output',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'additionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['createEventFile'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Attendees',
                              name: 'attendeesUi',
                              type: 'fixedCollection',
                              typeOptions: {
                                  multipleValues: true,
                              },
                              placeholder: 'Add Attendee',
                              default: {},
                              options: [
                                  {
                                      displayName: 'Attendees',
                                      name: 'attendeeValues',
                                      values: [
                                          {
                                              displayName: 'Name',
                                              name: 'name',
                                              type: 'string',
                                              required: true,
                                              default: '',
                                          },
                                          {
                                              displayName: 'Email',
                                              name: 'email',
                                              type: 'string',
                                              placeholder: 'name@email.com',
                                              required: true,
                                              default: '',
                                          },
                                          {
                                              displayName: 'RSVP',
                                              name: 'rsvp',
                                              type: 'boolean',
                                              default: false,
                                              description: 'Whether the attendee has to confirm attendance or not',
                                          },
                                      ],
                                  },
                              ],
                          },
                          {
                              displayName: 'Busy Status',
                              name: 'busyStatus',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Busy',
                                      value: 'BUSY',
                                  },
                                  {
                                      name: 'Tentative',
                                      value: 'TENTATIVE',
                                  },
                              ],
                              default: '',
                              description: 'Used to specify busy status for Microsoft applications, like Outlook',
                          },
                          {
                              displayName: 'Calendar Name',
                              name: 'calName',
                              type: 'string',
                              default: '',
                              description: 'Specifies the calendar (not event) name. Used by Apple iCal and Microsoft Outlook (<a href="https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/1da58449-b97e-46bd-b018-a1ce576f3e6d">spec</a>).',
                          },
                          {
                              displayName: 'Description',
                              name: 'description',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'File Name',
                              name: 'fileName',
                              type: 'string',
                              default: '',
                              description: 'The name of the file to be generated. Default value is event.ics.',
                          },
                          {
                              displayName: 'Geolocation',
                              name: 'geolocationUi',
                              type: 'fixedCollection',
                              typeOptions: {
                                  multipleValues: false,
                              },
                              placeholder: 'Add Geolocation',
                              default: {},
                              options: [
                                  {
                                      displayName: 'Geolocation',
                                      name: 'geolocationValues',
                                      values: [
                                          {
                                              displayName: 'Latitude',
                                              name: 'lat',
                                              type: 'string',
                                              default: '',
                                          },
                                          {
                                              displayName: 'Longitude',
                                              name: 'lon',
                                              type: 'string',
                                              default: '',
                                          },
                                      ],
                                  },
                              ],
                          },
                          {
                              displayName: 'Location',
                              name: 'location',
                              type: 'string',
                              default: '',
                              description: 'The intended venue',
                          },
                          {
                              displayName: 'Recurrence Rule',
                              name: 'recurrenceRule',
                              type: 'string',
                              default: '',
                              description: 'A rule to define the repeat pattern of the event (RRULE). (<a href="https://icalendar.org/rrule-tool.html">Rule generator</a>).',
                          },
                          {
                              displayName: 'Organizer',
                              name: 'organizerUi',
                              type: 'fixedCollection',
                              typeOptions: {
                                  multipleValues: false,
                              },
                              placeholder: 'Add Organizer',
                              default: {},
                              options: [
                                  {
                                      displayName: 'Organizer',
                                      name: 'organizerValues',
                                      values: [
                                          {
                                              displayName: 'Name',
                                              name: 'name',
                                              type: 'string',
                                              default: '',
                                              required: true,
                                          },
                                          {
                                              displayName: 'Email',
                                              name: 'email',
                                              type: 'string',
                                              placeholder: 'name@email.com',
                                              default: '',
                                              required: true,
                                          },
                                      ],
                                  },
                              ],
                          },
                          {
                              displayName: 'Sequence',
                              name: 'sequence',
                              type: 'number',
                              default: 0,
                              description: 'When sending an update for an event (with the same uid), defines the revision sequence number',
                          },
                          {
                              displayName: 'Status',
                              name: 'status',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Confirmed',
                                      value: 'CONFIRMED',
                                  },
                                  {
                                      name: 'Cancelled',
                                      value: 'CANCELLED',
                                  },
                                  {
                                      name: 'Tentative',
                                      value: 'TENTATIVE',
                                  },
                              ],
                              default: 'CONFIRMED',
                          },
                          {
                              displayName: 'UID',
                              name: 'uid',
                              type: 'string',
                              default: '',
                              description: 'Universally unique ID for the event (will be auto-generated if not specified here). Should be globally unique.',
                          },
                          {
                              displayName: 'URL',
                              name: 'url',
                              type: 'string',
                              default: '',
                              description: 'URL associated with event',
                          },
                      ],
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const length = items.length;
          const returnData = [];
          const operation = this.getNodeParameter('operation', 0);
          if (operation === 'createEventFile') {
              for (let i = 0; i < length; i++) {
                  const title = this.getNodeParameter('title', i);
                  const allDay = this.getNodeParameter('allDay', i);
                  const start = this.getNodeParameter('start', i);
                  let end = this.getNodeParameter('end', i);
                  end = allDay ? (0, moment_timezone_1.default)(end).utc().add(1, 'day').format() : end;
                  const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                  const additionalFields = this.getNodeParameter('additionalFields', i);
                  let fileName = 'event.ics';
                  const eventStart = (0, moment_timezone_1.default)(start)
                      .toArray()
                      .splice(0, allDay ? 3 : 6);
                  eventStart[1]++;
                  const eventEnd = (0, moment_timezone_1.default)(end)
                      .toArray()
                      .splice(0, allDay ? 3 : 6);
                  eventEnd[1]++;
                  if (additionalFields.fileName) {
                      fileName = additionalFields.fileName;
                  }
                  const data = {
                      title,
                      start: eventStart,
                      end: eventEnd,
                      startInputType: 'utc',
                      endInputType: 'utc',
                  };
                  if (additionalFields.geolocationUi) {
                      data.geo = additionalFields.geolocationUi
                          .geolocationValues;
                      delete additionalFields.geolocationUi;
                  }
                  if (additionalFields.organizerUi) {
                      data.organizer = additionalFields.organizerUi
                          .organizerValues;
                      delete additionalFields.organizerUi;
                  }
                  if (additionalFields.attendeesUi) {
                      data.attendees = additionalFields.attendeesUi
                          .attendeeValues;
                      delete additionalFields.attendeesUi;
                  }
                  Object.assign(data, additionalFields);
                  const buffer = Buffer.from((await createEvent(data)));
                  const binaryData = await this.helpers.prepareBinaryData(buffer, fileName, 'text/calendar');
                  returnData.push({
                      json: {},
                      binary: {
                          [binaryPropertyName]: binaryData,
                      },
                      pairedItem: {
                          item: i,
                      },
                  });
              }
          }
          return [returnData];
      }
  }
  exports.ICalendar = ICalendar;
  //# sourceMappingURL=ICalendar.node.js.map

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"a942e9cf-d6b8-476d-bfe9-fa2056dbc7e9","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"90b2d432d8414906929f8c03b3effc93d8b3eb0e1fdea1723fc42d724b8db0ec"}}


node_type: n8n-nodes-base.Interval
name: Interval
display_name: Interval
description: Triggers the workflow in a given interval
category: Other
code_hash: 395078df09873d83a3b69b11f17d73622c51e2d85584a0ce995738a764a1fe3c
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:24
updated_at: 2025-06-08 08:05:24
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Interval = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  class Interval {
      constructor() {
          this.description = {
              displayName: 'Interval',
              name: 'interval',
              icon: 'fa:hourglass',
              group: ['trigger', 'schedule'],
              version: 1,
              hidden: true,
              description: 'Triggers the workflow in a given interval',
              eventTriggerDescription: '',
              activationMessage: 'Your interval trigger will now trigger executions on the schedule you have defined.',
              defaults: {
                  name: 'Interval',
                  color: '#00FF00',
              },
              inputs: [],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'This workflow will run on the schedule you define here once you <a data-key="activate">activate</a> it.<br><br>For testing, you can also trigger it manually: by going back to the canvas and clicking ‘execute workflow’',
                      name: 'notice',
                      type: 'notice',
                      default: '',
                  },
                  {
                      displayName: 'Interval',
                      name: 'interval',
                      type: 'number',
                      typeOptions: {
                          minValue: 1,
                      },
                      default: 1,
                      description: 'Interval value',
                  },
                  {
                      displayName: 'Unit',
                      name: 'unit',
                      type: 'options',
                      options: [
                          {
                              name: 'Seconds',
                              value: 'seconds',
                          },
                          {
                              name: 'Minutes',
                              value: 'minutes',
                          },
                          {
                              name: 'Hours',
                              value: 'hours',
                          },
                      ],
                      default: 'seconds',
                      description: 'Unit of the interval value',
                  },
              ],
          };
      }
      async trigger() {
          const interval = this.getNodeParameter('interval');
          const unit = this.getNodeParameter('unit');
          if (interval <= 0) {
              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The interval has to be set to at least 1 or higher!');
          }
          let intervalValue = interval;
          if (unit === 'minutes') {
              intervalValue *= 60;
          }
          if (unit === 'hours') {
              intervalValue *= 60 * 60;
          }
          const executeTrigger = () => {
              this.emit([this.helpers.returnJsonArray([{}])]);
          };
          intervalValue *= 1000;
          if (intervalValue > 2147483647) {
              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The interval value is too large.');
          }
          const intervalObj = setInterval(executeTrigger, intervalValue);
          async function closeFunction() {
              clearInterval(intervalObj);
          }
          async function manualTriggerFunction() {
              executeTrigger();
          }
          return {
              closeFunction,
              manualTriggerFunction,
          };
      }
  }
  exports.Interval = Interval;
  //# sourceMappingURL=Interval.node.js.map

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"05845462-1dd9-4afb-94f0-743219ed17c1","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"f3041f293fe2273b5e10483d95b2024f6dd7d75b844211eb984187743d9b3fe8"}}


node_type: n8n-nodes-base.ItemLists
name: ItemLists
display_name: Item Lists
description: Helper for working with lists of items and transforming arrays
category: Other
code_hash: e750bcc12fe1f8b89195a70c6bb909c54066a02e91dbb0a0618e250b5dc9ec74
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:24
updated_at: 2025-06-08 08:05:24
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.ItemLists = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const ItemListsV1_node_1 = require("./V1/ItemListsV1.node");
  const ItemListsV2_node_1 = require("./V2/ItemListsV2.node");
  const ItemListsV3_node_1 = require("./V3/ItemListsV3.node");
  class ItemLists extends n8n_workflow_1.VersionedNodeType {
      constructor() {
          const baseDescription = {
              displayName: 'Item Lists',
              name: 'itemLists',
              icon: 'file:itemLists.svg',
              group: ['input'],
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Helper for working with lists of items and transforming arrays',
              defaultVersion: 3,
          };
          const nodeVersions = {
              1: new ItemListsV1_node_1.ItemListsV1(baseDescription),
              2: new ItemListsV2_node_1.ItemListsV2(baseDescription),
              2.1: new ItemListsV2_node_1.ItemListsV2(baseDescription),
              2.2: new ItemListsV2_node_1.ItemListsV2(baseDescription),
              3: new ItemListsV3_node_1.ItemListsV3(baseDescription),
          };
          super(nodeVersions, baseDescription);
      }
  }
  exports.ItemLists = ItemLists;
  //# sourceMappingURL=ItemLists.node.js.map

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"716b6336-f05f-4f93-985e-33876d10b7ca","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"22b87c7edfb5a6c363a192853a22694e1b76a814f062bc73c60f641669cb8334"}}


node_type: n8n-nodes-base.Hunter
name: Hunter
display_name: Hunter
description: Consume Hunter API
category: Other
code_hash: 51c8bda9ec8694acf0c9362ae3c4ede9dc8e3fcf9b20e8b4d42731ce83b2c983
documentation_url: https://docs.n8n.io/integrations/builtin/credentials/hunter
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:24
updated_at: 2025-06-08 08:05:24
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Hunter = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  class Hunter {
      constructor() {
          this.description = {
              displayName: 'Hunter',
              name: 'hunter',
              icon: 'file:hunter.png',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"]}}',
              description: 'Consume Hunter API',
              defaults: {
                  name: 'Hunter',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'hunterApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Domain Search',
                              value: 'domainSearch',
                              description: 'Get every email address found on the internet using a given domain name, with sources',
                              action: 'Get every email address found on the internet using a given domain name, with sources',
                          },
                          {
                              name: 'Email Finder',
                              value: 'emailFinder',
                              description: 'Generate or retrieve the most likely email address from a domain name, a first name and a last name',
                              action: 'Generate or retrieve the most likely email address from a domain name, a first name and a last name',
                          },
                          {
                              name: 'Email Verifier',
                              value: 'emailVerifier',
                              description: 'Verify the deliverability of an email address',
                              action: 'Verify the deliverability of an email address',
                          },
                      ],
                      default: 'domainSearch',
                      description: 'Operation to consume',
                  },
                  {
                      displayName: 'Domain',
                      name: 'domain',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['domainSearch'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'Domain name from which you want to find the email addresses. For example, "stripe.com".',
                  },
                  {
                      displayName: 'Only Emails',
                      name: 'onlyEmails',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['domainSearch'],
                          },
                      },
                      default: true,
                      description: 'Whether to return only the the found emails',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              operation: ['domainSearch'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              operation: ['domainSearch'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 100,
                      },
                      default: 100,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Filters',
                      name: 'filters',
                      type: 'collection',
                      placeholder: 'Add Filter',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['domainSearch'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Type',
                              name: 'type',
                              type: 'options',
                              default: '',
                              options: [
                                  {
                                      name: 'Personal',
                                      value: 'personal',
                                  },
                                  {
                                      name: 'Generic',
                                      value: 'generic',
                                  },
                              ],
                          },
                          {
                              displayName: 'Seniority',
                              name: 'seniority',
                              type: 'multiOptions',
                              default: [],
                              options: [
                                  {
                                      name: 'Junior',
                                      value: 'junior',
                                  },
                                  {
                                      name: 'Senior',
                                      value: 'senior',
                                  },
                                  {
                                      name: 'Executive',
                                      value: 'executive',
                                  },
                              ],
                          },
                          {
                              displayName: 'Department',
                              name: 'department',
                              type: 'multiOptions',
                              default: [],
                              options: [
                                  {
                                      name: 'Communication',
                                      value: 'communication',
                                  },
                                  {
                                      name: 'Executive',
                                      value: 'executive',
                                  },
                                  {
                                      name: 'Finance',
                                      value: 'finance',
                                  },
                                  {
                                      name: 'HR',
                                      value: 'hr',
                                  },
                                  {
                                      name: 'IT',
                                      value: 'it',
                                  },
                                  {
                                      name: 'Legal',
                                      value: 'legal',
                                  },
                                  {
                                      name: 'Management',
                                      value: 'management',
                                  },
                                  {
                                      name: 'Marketing',
                                      value: 'marketing',
                                  },
                                  {
                                      name: 'Sales',
                                      value: 'sales',
                                  },
                                  {
                                      name: 'Support',
                                      value: 'support',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Domain',
                      name: 'domain',
                      type: 'string',
                      default: '',
                      displayOptions: {
                          show: {
                              operation: ['emailFinder'],
                          },
                      },
                      required: true,
                      description: 'Domain name from which you want to find the email addresses. For example, "stripe.com".',
                  },
                  {
                      displayName: 'First Name',
                      name: 'firstname',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['emailFinder'],
                          },
                      },
                      default: '',
                      required: true,
                      description: "The person's first name. It doesn't need to be in lowercase.",
                  },
                  {
                      displayName: 'Last Name',
                      name: 'lastname',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['emailFinder'],
                          },
                      },
                      default: '',
                      required: true,
                      description: "The person's last name. It doesn't need to be in lowercase.",
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      displayOptions: {
                          show: {
                              operation: ['emailVerifier'],
                          },
                      },
                      default: '',
                      required: true,
                      description: 'The email address you want to verify',
                  },
              ],
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const qs = {};
          let responseData;
          for (let i = 0; i < length; i++) {
              try {
                  const operation = this.getNodeParameter('operation', 0);
                  if (operation === 'domainSearch') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const filters = this.getNodeParameter('filters', i);
                      const domain = this.getNodeParameter('domain', i);
                      const onlyEmails = this.getNodeParameter('onlyEmails', i, false);
                      qs.domain = domain;
                      if (filters.type) {
                          qs.type = filters.type;
                      }
                      if (filters.seniority) {
                          qs.seniority = filters.seniority.join(',');
                      }
                      if (filters.department) {
                          qs.department = filters.department.join(',');
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.hunterApiRequestAllItems.call(this, 'data', 'GET', '/domain-search', {}, qs);
                          if (!onlyEmails) {
                              let tempReturnData = {};
                              for (let index = 0; index < responseData.length; index++) {
                                  if (index === 0) {
                                      tempReturnData = responseData[index];
                                      continue;
                                  }
                                  tempReturnData.emails.push.apply(tempReturnData.emails, responseData[index].emails);
                              }
                              responseData = tempReturnData;
                          }
                      }
                      else {
                          const limit = this.getNodeParameter('limit', i);
                          qs.limit = limit;
                          responseData = await GenericFunctions_1.hunterApiRequest.call(this, 'GET', '/domain-search', {}, qs);
                          responseData = responseData.data;
                      }
                      if (onlyEmails) {
                          let tempReturnData = [];
                          if (Array.isArray(responseData)) {
                              for (const data of responseData) {
                                  tempReturnData.push.apply(tempReturnData, data.emails);
                              }
                          }
                          else {
                              tempReturnData = responseData.emails;
                          }
                          responseData = tempReturnData;
                      }
                  }
                  if (operation === 'emailFinder') {
                      const domain = this.getNodeParameter('domain', i);
                      const firstname = this.getNodeParameter('firstname', i);
                      const lastname = this.getNodeParameter('lastname', i);
                      qs.first_name = firstname;
                      qs.last_name = lastname;
                      qs.domain = domain;
                      responseData = await GenericFunctions_1.hunterApiRequest.call(this, 'GET', '/email-finder', {}, qs);
                      responseData = responseData.data;
                  }
                  if (operation === 'emailVerifier') {
                      const email = this.getNodeParameter('email', i);
                      qs.email = email;
                      responseData = await GenericFunctions_1.hunterApiRequest.call(this, 'GET', '/email-verifier', {}, qs);
                      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.Hunter = Hunter;
  //# sourceMappingURL=Hunter.node.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: Hunter credentials
  description: Documentation for Hunter credentials. Use these credentials to authenticate Hunter in n8n, a workflow automation platform.
  contentType: [integration, reference]
  ---

  # Hunter credentials

  You can use these credentials to authenticate the following nodes:

  - [Hunter](/integrations/builtin/app-nodes/n8n-nodes-base.hunter.md)

  ## Prerequisites

  Create a [Hunter](https://www.hunter.io/){:target=_blank .external-link} account.

  ## Supported authentication methods

  - API key

  ## Related resources

  Refer to [Hunter's API documentation](https://hunter.io/api-documentation/v2){:target=_blank .external-link} for more information about the service.

  ## Using API key

  To configure this credential, you'll need:

  - An **API Key**: Generate an API key from your profile in the [dashboard](https://hunter.io/api-keys){:target=_blank .external-link}. Refer to the [Hunter API Authentication documentation](https://hunter.io/api-documentation/v2#authentication){:target=_blank .external-link} for more information.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"05f43a0e-4317-4767-b82f-4839ea93cb79","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"5a3a527695dad1ba3bab5c2d604d84afd75e0150cabae8ea59d4f4aa402d4f18"}}


node_type: n8n-nodes-base.If
name: If
display_name: IF
description: Route items to different branches (true/false)
category: Other
code_hash: 7910ed9177a946b76f04ca847defb81226c37c698e4cdb63913f038c6c257ee1
documentation_url: https://docs.n8n.io/integrations/creating-nodes/build/reference/verification-guidelines
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:24
updated_at: 2025-06-08 08:05:24
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.If = void 0;
  const moment_1 = __importDefault(require("moment"));
  const n8n_workflow_1 = require("n8n-workflow");
  class If {
      constructor() {
          this.description = {
              displayName: 'IF',
              name: 'if',
              icon: 'fa:map-signs',
              group: ['transform'],
              version: 1,
              description: 'Route items to different branches (true/false)',
              defaults: {
                  name: 'IF',
                  color: '#408000',
              },
              inputs: ['main'],
              outputs: ['main', 'main'],
              outputNames: ['true', 'false'],
              properties: [
                  {
                      displayName: 'Conditions',
                      name: 'conditions',
                      placeholder: 'Add Condition',
                      type: 'fixedCollection',
                      typeOptions: {
                          multipleValues: true,
                          sortable: true,
                      },
                      description: 'The type of values to compare',
                      default: {},
                      options: [
                          {
                              name: 'boolean',
                              displayName: 'Boolean',
                              values: [
                                  {
                                      displayName: 'Value 1',
                                      name: 'value1',
                                      type: 'boolean',
                                      default: false,
                                      description: 'The value to compare with the second one',
                                  },
                                  {
                                      displayName: 'Operation',
                                      name: 'operation',
                                      type: 'options',
                                      options: [
                                          {
                                              name: 'Equal',
                                              value: 'equal',
                                          },
                                          {
                                              name: 'Not Equal',
                                              value: 'notEqual',
                                          },
                                      ],
                                      default: 'equal',
                                      description: 'Operation to decide where the the data should be mapped to',
                                  },
                                  {
                                      displayName: 'Value 2',
                                      name: 'value2',
                                      type: 'boolean',
                                      default: false,
                                      description: 'The value to compare with the first one',
                                  },
                              ],
                          },
                          {
                              name: 'dateTime',
                              displayName: 'Date & Time',
                              values: [
                                  {
                                      displayName: 'Value 1',
                                      name: 'value1',
                                      type: 'dateTime',
                                      default: '',
                                      description: 'The value to compare with the second one',
                                  },
                                  {
                                      displayName: 'Operation',
                                      name: 'operation',
                                      type: 'options',
                                      options: [
                                          {
                                              name: 'Occurred After',
                                              value: 'after',
                                          },
                                          {
                                              name: 'Occurred Before',
                                              value: 'before',
                                          },
                                      ],
                                      default: 'after',
                                      description: 'Operation to decide where the the data should be mapped to',
                                  },
                                  {
                                      displayName: 'Value 2',
                                      name: 'value2',
                                      type: 'dateTime',
                                      default: '',
                                      description: 'The value to compare with the first one',
                                  },
                              ],
                          },
                          {
                              name: 'number',
                              displayName: 'Number',
                              values: [
                                  {
                                      displayName: 'Value 1',
                                      name: 'value1',
                                      type: 'number',
                                      default: 0,
                                      description: 'The value to compare with the second one',
                                  },
                                  {
                                      displayName: 'Operation',
                                      name: 'operation',
                                      type: 'options',
                                      noDataExpression: true,
                                      options: [
                                          {
                                              name: 'Smaller',
                                              value: 'smaller',
                                          },
                                          {
                                              name: 'Smaller or Equal',
                                              value: 'smallerEqual',
                                          },
                                          {
                                              name: 'Equal',
                                              value: 'equal',
                                          },
                                          {
                                              name: 'Not Equal',
                                              value: 'notEqual',
                                          },
                                          {
                                              name: 'Larger',
                                              value: 'larger',
                                          },
                                          {
                                              name: 'Larger or Equal',
                                              value: 'largerEqual',
                                          },
                                          {
                                              name: 'Is Empty',
                                              value: 'isEmpty',
                                          },
                                          {
                                              name: 'Is Not Empty',
                                              value: 'isNotEmpty',
                                          },
                                      ],
                                      default: 'smaller',
                                      description: 'Operation to decide where the the data should be mapped to',
                                  },
                                  {
                                      displayName: 'Value 2',
                                      name: 'value2',
                                      type: 'number',
                                      displayOptions: {
                                          hide: {
                                              operation: ['isEmpty', 'isNotEmpty'],
                                          },
                                      },
                                      default: 0,
                                      description: 'The value to compare with the first one',
                                  },
                              ],
                          },
                          {
                              name: 'string',
                              displayName: 'String',
                              values: [
                                  {
                                      displayName: 'Value 1',
                                      name: 'value1',
                                      type: 'string',
                                      default: '',
                                      description: 'The value to compare with the second one',
                                  },
                                  {
                                      displayName: 'Operation',
                                      name: 'operation',
                                      type: 'options',
                                      noDataExpression: true,
                                      options: [
                                          {
                                              name: 'Contains',
                                              value: 'contains',
                                          },
                                          {
                                              name: 'Not Contains',
                                              value: 'notContains',
                                          },
                                          {
                                              name: 'Ends With',
                                              value: 'endsWith',
                                          },
                                          {
                                              name: 'Not Ends With',
                                              value: 'notEndsWith',
                                          },
                                          {
                                              name: 'Equal',
                                              value: 'equal',
                                          },
                                          {
                                              name: 'Not Equal',
                                              value: 'notEqual',
                                          },
                                          {
                                              name: 'Regex Match',
                                              value: 'regex',
                                          },
                                          {
                                              name: 'Regex Not Match',
                                              value: 'notRegex',
                                          },
                                          {
                                              name: 'Starts With',
                                              value: 'startsWith',
                                          },
                                          {
                                              name: 'Not Starts With',
                                              value: 'notStartsWith',
                                          },
                                          {
                                              name: 'Is Empty',
                                              value: 'isEmpty',
                                          },
                                          {
                                              name: 'Is Not Empty',
                                              value: 'isNotEmpty',
                                          },
                                      ],
                                      default: 'equal',
                                      description: 'Operation to decide where the the data should be mapped to',
                                  },
                                  {
                                      displayName: 'Value 2',
                                      name: 'value2',
                                      type: 'string',
                                      displayOptions: {
                                          hide: {
                                              operation: ['isEmpty', 'isNotEmpty', 'regex', 'notRegex'],
                                          },
                                      },
                                      default: '',
                                      description: 'The value to compare with the first one',
                                  },
                                  {
                                      displayName: 'Regex',
                                      name: 'value2',
                                      type: 'string',
                                      displayOptions: {
                                          show: {
                                              operation: ['regex', 'notRegex'],
                                          },
                                      },
                                      default: '',
                                      placeholder: '/text/i',
                                      description: 'The regex which has to match',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Combine',
                      name: 'combineOperation',
                      type: 'options',
                      options: [
                          {
                              name: 'ALL',
                              description: 'Only if all conditions are met it goes into "true" branch',
                              value: 'all',
                          },
                          {
                              name: 'ANY',
                              description: 'If any of the conditions is met it goes into "true" branch',
                              value: 'any',
                          },
                      ],
                      default: 'all',
                      description: 'If multiple rules got set this settings decides if it is true as soon as ANY condition matches or only if ALL get meet',
                  },
              ],
          };
      }
      async execute() {
          const returnDataTrue = [];
          const returnDataFalse = [];
          const items = this.getInputData();
          let item;
          let combineOperation;
          const isDateObject = (value) => Object.prototype.toString.call(value) === '[object Date]';
          const isDateInvalid = (value) => (value === null || value === void 0 ? void 0 : value.toString()) === 'Invalid Date';
          const compareOperationFunctions = {
              after: (value1, value2) => (value1 || 0) > (value2 || 0),
              before: (value1, value2) => (value1 || 0) < (value2 || 0),
              contains: (value1, value2) => (value1 || '').toString().includes((value2 || '').toString()),
              notContains: (value1, value2) => !(value1 || '').toString().includes((value2 || '').toString()),
              endsWith: (value1, value2) => value1.endsWith(value2),
              notEndsWith: (value1, value2) => !value1.endsWith(value2),
              equal: (value1, value2) => value1 === value2,
              notEqual: (value1, value2) => value1 !== value2,
              larger: (value1, value2) => (value1 || 0) > (value2 || 0),
              largerEqual: (value1, value2) => (value1 || 0) >= (value2 || 0),
              smaller: (value1, value2) => (value1 || 0) < (value2 || 0),
              smallerEqual: (value1, value2) => (value1 || 0) <= (value2 || 0),
              startsWith: (value1, value2) => value1.startsWith(value2),
              notStartsWith: (value1, value2) => !value1.startsWith(value2),
              isEmpty: (value1) => [undefined, null, '', NaN].includes(value1) ||
                  (typeof value1 === 'object' && value1 !== null && !isDateObject(value1)
                      ? Object.entries(value1).length === 0
                      : false) ||
                  (isDateObject(value1) && isDateInvalid(value1)),
              isNotEmpty: (value1) => !([undefined, null, '', NaN].includes(value1) ||
                  (typeof value1 === 'object' && value1 !== null && !isDateObject(value1)
                      ? Object.entries(value1).length === 0
                      : false) ||
                  (isDateObject(value1) && isDateInvalid(value1))),
              regex: (value1, value2) => {
                  const regexMatch = (value2 || '').toString().match(new RegExp('^/(.*?)/([gimusy]*)$'));
                  let regex;
                  if (!regexMatch) {
                      regex = new RegExp((value2 || '').toString());
                  }
                  else if (regexMatch.length === 1) {
                      regex = new RegExp(regexMatch[1]);
                  }
                  else {
                      regex = new RegExp(regexMatch[1], regexMatch[2]);
                  }
                  return !!(value1 || '').toString().match(regex);
              },
              notRegex: (value1, value2) => {
                  const regexMatch = (value2 || '').toString().match(new RegExp('^/(.*?)/([gimusy]*)$'));
                  let regex;
                  if (!regexMatch) {
                      regex = new RegExp((value2 || '').toString());
                  }
                  else if (regexMatch.length === 1) {
                      regex = new RegExp(regexMatch[1]);
                  }
                  else {
                      regex = new RegExp(regexMatch[1], regexMatch[2]);
                  }
                  return !(value1 || '').toString().match(regex);
              },
          };
          const convertDateTime = (value) => {
              let returnValue = undefined;
              if (typeof value === 'string') {
                  returnValue = new Date(value).getTime();
              }
              else if (typeof value === 'number') {
                  returnValue = value;
              }
              if (moment_1.default.isMoment(value)) {
                  returnValue = value.unix();
              }
              if (value instanceof Date) {
                  returnValue = value.getTime();
              }
              if (returnValue === undefined || isNaN(returnValue)) {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The value "${value}" is not a valid DateTime.`);
              }
              return returnValue;
          };
          const dataTypes = ['boolean', 'dateTime', 'number', 'string'];
          let dataType;
          let compareOperationResult;
          let value1, value2;
          itemLoop: for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
              item = items[itemIndex];
              let compareData;
              combineOperation = this.getNodeParameter('combineOperation', itemIndex);
              for (dataType of dataTypes) {
                  for (compareData of this.getNodeParameter(`conditions.${dataType}`, itemIndex, [])) {
                      value1 = compareData.value1;
                      value2 = compareData.value2;
                      if (dataType === 'dateTime') {
                          value1 = convertDateTime(value1);
                          value2 = convertDateTime(value2);
                      }
                      compareOperationResult = compareOperationFunctions[compareData.operation](value1, value2);
                      if (compareOperationResult && combineOperation === 'any') {
                          returnDataTrue.push(item);
                          continue itemLoop;
                      }
                      else if (!compareOperationResult && combineOperation === 'all') {
                          returnDataFalse.push(item);
                          continue itemLoop;
                      }
                  }
              }
              if (item.pairedItem === undefined) {
                  item.pairedItem = [{ item: itemIndex }];
              }
              if (combineOperation === 'all') {
                  returnDataTrue.push(item);
              }
              else {
                  returnDataFalse.push(item);
              }
          }
          return [returnDataTrue, returnDataFalse];
      }
  }
  exports.If = If;
  //# sourceMappingURL=If.node.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  contentType: reference
  ---

  # Community node verification guidelines

  /// note | Do you want n8n to verify your node?
  Consider following these guidelines while building your node if you want to submit it for verification by n8n. Any user with verified community nodes enabled can discover and install verified nodes from n8n's nodes panel.
  ///

  ## Package source verification

  * Verify that your npm package repository URL matches the expected GitHub (or other platform) repository.
  * Confirm that the package author / maintainer matches between npm and the repository.
  * Confirm that the git link in npm works and that the repository is public.
  * Make sure your package has proper documentation (README, usage examples, etc.).
  * Make sure your package license is MIT.

  ## No external dependencies

  * Ensure that your package does **not** include any external dependencies to keep it lightweight and easy to maintain.

  ## Proper documentation

  * Provide clear documentation, whether it’s a **README** on GitHub or links to relevant **API documentation**.
  * Include usage instructions, example workflows, and any necessary authentication details.

  ## No access to environment variables or file system

  * The code **must not** interact with environment variables or attempt to read/write files.
  * Pass all necessary data through node parameters.

  ## Follow n8n best practices

  * Maintain a clear and consistent coding style.
  * Use **TypeScript** and follow n8n's [**node development guidelines**](/integrations/creating-nodes/overview.md).
  * Ensure proper error handling and validation.
  * Make sure the linter passes (in other words, make sure running `npx @n8n/scan-community-package n8n-nodes-PACKAGE` passes).

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"8763a625-5751-410b-aa91-b55958908c68","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"07b054e4548a941675b11374b6fc7e143708e093621508d2e239e8229bc9dae1"}}


node_type: n8n-nodes-base.Intercom
name: Intercom
display_name: Intercom
description: Consume Intercom API
category: Other
code_hash: be4c08e687ac6d523ea522d1b9f22155077485762de518664618a8a40f427844
documentation_url: https://docs.n8n.io/integrations/builtin/credentials/intercom
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:24
updated_at: 2025-06-08 08:05:24
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Intercom = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const LeadDescription_1 = require("./LeadDescription");
  const GenericFunctions_1 = require("./GenericFunctions");
  const UserDescription_1 = require("./UserDescription");
  const CompanyDescription_1 = require("./CompanyDescription");
  class Intercom {
      constructor() {
          this.description = {
              displayName: 'Intercom',
              name: 'intercom',
              icon: 'file:intercom.png',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Intercom API',
              defaults: {
                  name: 'Intercom',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'intercomApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Company',
                              value: 'company',
                              description: 'Companies allow you to represent commercial organizations using your product',
                          },
                          {
                              name: 'Lead',
                              value: 'lead',
                              description: 'Leads are useful for representing logged-out users of your application',
                          },
                          {
                              name: 'User',
                              value: 'user',
                              description: 'The Users resource is the primary way of interacting with Intercom',
                          },
                      ],
                      default: 'user',
                  },
                  ...LeadDescription_1.leadOperations,
                  ...UserDescription_1.userOperations,
                  ...CompanyDescription_1.companyOperations,
                  ...UserDescription_1.userFields,
                  ...LeadDescription_1.leadFields,
                  ...CompanyDescription_1.companyFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getCompanies() {
                      const returnData = [];
                      let response;
                      try {
                          response = await GenericFunctions_1.intercomApiRequest.call(this, '/companies', 'GET');
                      }
                      catch (error) {
                          throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                      }
                      const companies = response.companies;
                      for (const company of companies) {
                          const companyName = company.name;
                          const companyId = company.company_id;
                          returnData.push({
                              name: companyName,
                              value: companyId,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let qs;
          let responseData;
          for (let i = 0; i < length; i++) {
              try {
                  qs = {};
                  const resource = this.getNodeParameter('resource', 0);
                  const operation = this.getNodeParameter('operation', 0);
                  if (resource === 'lead') {
                      if (operation === 'create' || operation === 'update') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const jsonActive = this.getNodeParameter('jsonParameters', i);
                          const body = {};
                          if (operation === 'create') {
                              body.email = this.getNodeParameter('email', i);
                          }
                          if (additionalFields.email) {
                              body.email = additionalFields.email;
                          }
                          if (additionalFields.phone) {
                              body.phone = additionalFields.phone;
                          }
                          if (additionalFields.name) {
                              body.name = additionalFields.name;
                          }
                          if (additionalFields.unsubscribedFromEmails) {
                              body.unsubscribed_from_emails = additionalFields.unsubscribedFromEmails;
                          }
                          if (additionalFields.updateLastRequestAt) {
                              body.update_last_request_at = additionalFields.updateLastRequestAt;
                          }
                          if (additionalFields.utmSource) {
                              body.utm_source = additionalFields.utmSource;
                          }
                          if (additionalFields.utmMedium) {
                              body.utm_medium = additionalFields.utmMedium;
                          }
                          if (additionalFields.utmCampaign) {
                              body.utm_campaign = additionalFields.utmCampaign;
                          }
                          if (additionalFields.utmTerm) {
                              body.utm_term = additionalFields.utmTerm;
                          }
                          if (additionalFields.utmContent) {
                              body.utm_content = additionalFields.utmContent;
                          }
                          if (additionalFields.avatar) {
                              const avatar = {
                                  type: 'avatar',
                                  image_url: additionalFields.avatar,
                              };
                              body.avatar = avatar;
                          }
                          if (additionalFields.companies) {
                              const companies = [];
                              additionalFields.companies.forEach((o) => {
                                  const company = {};
                                  company.company_id = o;
                                  companies.push(company);
                              });
                              body.companies = companies;
                          }
                          if (!jsonActive) {
                              const customAttributesValues = this.getNodeParameter('customAttributesUi', i).customAttributesValues;
                              if (customAttributesValues) {
                                  const customAttributes = {};
                                  for (let index = 0; index < customAttributesValues.length; index++) {
                                      customAttributes[customAttributesValues[index].name] =
                                          customAttributesValues[index].value;
                                  }
                                  body.custom_attributes = customAttributes;
                              }
                          }
                          else {
                              const customAttributesJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('customAttributesJson', i));
                              if (customAttributesJson) {
                                  body.custom_attributes = customAttributesJson;
                              }
                          }
                          if (operation === 'update') {
                              const updateBy = this.getNodeParameter('updateBy', 0);
                              const value = this.getNodeParameter('value', i);
                              if (updateBy === 'userId') {
                                  body.user_id = value;
                              }
                              if (updateBy === 'id') {
                                  body.id = value;
                              }
                          }
                          try {
                              responseData = await GenericFunctions_1.intercomApiRequest.call(this, '/contacts', 'POST', body);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'get') {
                          const selectBy = this.getNodeParameter('selectBy', 0);
                          const value = this.getNodeParameter('value', i);
                          if (selectBy === 'email') {
                              qs.email = value;
                          }
                          if (selectBy === 'userId') {
                              qs.user_id = value;
                          }
                          if (selectBy === 'phone') {
                              qs.phone = value;
                          }
                          try {
                              if (selectBy === 'id') {
                                  responseData = await GenericFunctions_1.intercomApiRequest.call(this, `/contacts/${value}`, 'GET');
                              }
                              else {
                                  responseData = await GenericFunctions_1.intercomApiRequest.call(this, '/contacts', 'GET', {}, qs);
                                  responseData = responseData.contacts;
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const filters = this.getNodeParameter('filters', i);
                          Object.assign(qs, filters);
                          try {
                              if (returnAll) {
                                  responseData = await GenericFunctions_1.intercomApiRequestAllItems.call(this, 'contacts', '/contacts', 'GET', {}, qs);
                              }
                              else {
                                  qs.per_page = this.getNodeParameter('limit', i);
                                  responseData = await GenericFunctions_1.intercomApiRequest.call(this, '/contacts', 'GET', {}, qs);
                                  responseData = responseData.contacts;
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const deleteBy = this.getNodeParameter('deleteBy', 0);
                          const value = this.getNodeParameter('value', i);
                          try {
                              if (deleteBy === 'id') {
                                  responseData = await GenericFunctions_1.intercomApiRequest.call(this, `/contacts/${value}`, 'DELETE');
                              }
                              else {
                                  qs.user_id = value;
                                  responseData = await GenericFunctions_1.intercomApiRequest.call(this, '/contacts', 'DELETE', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                  }
                  if (resource === 'user') {
                      if (operation === 'create' || operation === 'update') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const jsonActive = this.getNodeParameter('jsonParameters', i);
                          const body = {};
                          if (operation === 'create') {
                              const identifierType = this.getNodeParameter('identifierType', i);
                              if (identifierType === 'email') {
                                  body.email = this.getNodeParameter('idValue', i);
                              }
                              else if (identifierType === 'userId') {
                                  body.user_id = this.getNodeParameter('idValue', i);
                              }
                          }
                          if (additionalFields.email) {
                              body.email = additionalFields.email;
                          }
                          if (additionalFields.userId) {
                              body.user_id = additionalFields.userId;
                          }
                          if (additionalFields.phone) {
                              body.phone = additionalFields.phone;
                          }
                          if (additionalFields.name) {
                              body.name = additionalFields.name;
                          }
                          if (additionalFields.unsubscribedFromEmails) {
                              body.unsubscribed_from_emails = additionalFields.unsubscribedFromEmails;
                          }
                          if (additionalFields.updateLastRequestAt) {
                              body.update_last_request_at = additionalFields.updateLastRequestAt;
                          }
                          if (additionalFields.sessionCount) {
                              body.session_count = additionalFields.sessionCount;
                          }
                          if (additionalFields.avatar) {
                              const avatar = {
                                  type: 'avatar',
                                  image_url: additionalFields.avatar,
                              };
                              body.avatar = avatar;
                          }
                          if (additionalFields.utmSource) {
                              body.utm_source = additionalFields.utmSource;
                          }
                          if (additionalFields.utmMedium) {
                              body.utm_medium = additionalFields.utmMedium;
                          }
                          if (additionalFields.utmCampaign) {
                              body.utm_campaign = additionalFields.utmCampaign;
                          }
                          if (additionalFields.utmTerm) {
                              body.utm_term = additionalFields.utmTerm;
                          }
                          if (additionalFields.utmContent) {
                              body.utm_content = additionalFields.utmContent;
                          }
                          if (additionalFields.companies) {
                              const companies = [];
                              additionalFields.companies.forEach((o) => {
                                  const company = {};
                                  company.company_id = o;
                                  companies.push(company);
                              });
                              body.companies = companies;
                          }
                          if (additionalFields.sessionCount) {
                              body.session_count = additionalFields.sessionCount;
                          }
                          if (!jsonActive) {
                              const customAttributesValues = this.getNodeParameter('customAttributesUi', i).customAttributesValues;
                              if (customAttributesValues) {
                                  const customAttributes = {};
                                  for (let index = 0; index < customAttributesValues.length; index++) {
                                      customAttributes[customAttributesValues[index].name] =
                                          customAttributesValues[index].value;
                                  }
                                  body.custom_attributes = customAttributes;
                              }
                          }
                          else {
                              const customAttributesJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('customAttributesJson', i));
                              if (customAttributesJson) {
                                  body.custom_attributes = customAttributesJson;
                              }
                          }
                          if (operation === 'update') {
                              const updateBy = this.getNodeParameter('updateBy', 0);
                              const value = this.getNodeParameter('value', i);
                              if (updateBy === 'userId') {
                                  body.user_id = value;
                              }
                              if (updateBy === 'id') {
                                  body.id = value;
                              }
                              if (updateBy === 'email') {
                                  body.email = value;
                              }
                          }
                          try {
                              responseData = await GenericFunctions_1.intercomApiRequest.call(this, '/users', 'POST', body, qs);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'get') {
                          const selectBy = this.getNodeParameter('selectBy', 0);
                          const value = this.getNodeParameter('value', i);
                          if (selectBy === 'userId') {
                              qs.user_id = value;
                          }
                          try {
                              if (selectBy === 'id') {
                                  responseData = await GenericFunctions_1.intercomApiRequest.call(this, `/users/${value}`, 'GET', {}, qs);
                              }
                              else {
                                  responseData = await GenericFunctions_1.intercomApiRequest.call(this, '/users', 'GET', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const filters = this.getNodeParameter('filters', i);
                          Object.assign(qs, filters);
                          try {
                              if (returnAll) {
                                  responseData = await GenericFunctions_1.intercomApiRequestAllItems.call(this, 'users', '/users', 'GET', {}, qs);
                              }
                              else {
                                  qs.per_page = this.getNodeParameter('limit', i);
                                  responseData = await GenericFunctions_1.intercomApiRequest.call(this, '/users', 'GET', {}, qs);
                                  responseData = responseData.users;
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                          }
                      }
                      if (operation === 'delete') {
                          const id = this.getNodeParameter('id', i);
                          try {
                              responseData = await GenericFunctions_1.intercomApiRequest.call(this, `/users/${id}`, 'DELETE');
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`, { itemIndex: i });
                          }
                      }
                  }
                  if (resource === 'company') {
                      if (operation === 'create' || operation === 'update') {
                          const id = this.getNodeParameter('companyId', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const jsonActive = this.getNodeParameter('jsonParameters', i);
                          const body = {
                              company_id: id,
                          };
                          if (additionalFields.monthlySpend) {
                              body.monthly_spend = additionalFields.monthlySpend;
                          }
                          if (additionalFields.name) {
                              body.name = additionalFields.name;
                          }
                          if (additionalFields.plan) {
                              body.plan = additionalFields.plan;
                          }
                          if (additionalFields.size) {
                              body.size = additionalFields.size;
                          }
                          if (additionalFields.website) {
                              body.website = additionalFields.website;
                          }
                          if (additionalFields.industry) {
                              body.industry = additionalFields.industry;
                          }
                          if (!jsonActive) {
                              const customAttributesValues = this.getNodeParameter('customAttributesUi', i).customAttributesValues;
                              if (customAttributesValues) {
                                  const customAttributes = {};
                                  for (let index = 0; index < customAttributesValues.length; index++) {
                                      customAttributes[customAttributesValues[index].name] =
                                          customAttributesValues[index].value;
                                  }
                                  body.custom_attributes = customAttributes;
                              }
                          }
                          else {
                              const customAttributesJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('customAttributesJson', i));
                              if (customAttributesJson) {
                                  body.custom_attributes = customAttributesJson;
                              }
                          }
                          try {
                              responseData = await GenericFunctions_1.intercomApiRequest.call(this, '/companies', 'POST', body, qs);
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`, { itemIndex: i });
                          }
                      }
                      if (operation === 'get') {
                          const selectBy = this.getNodeParameter('selectBy', 0);
                          const value = this.getNodeParameter('value', i);
                          if (selectBy === 'companyId') {
                              qs.company_id = value;
                          }
                          if (selectBy === 'name') {
                              qs.name = value;
                          }
                          try {
                              if (selectBy === 'id') {
                                  responseData = await GenericFunctions_1.intercomApiRequest.call(this, `/companies/${value}`, 'GET', {}, qs);
                              }
                              else {
                                  responseData = await GenericFunctions_1.intercomApiRequest.call(this, '/companies', 'GET', {}, qs);
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`, { itemIndex: i });
                          }
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const filters = this.getNodeParameter('filters', i);
                          Object.assign(qs, filters);
                          try {
                              if (returnAll) {
                                  responseData = await GenericFunctions_1.intercomApiRequestAllItems.call(this, 'companies', '/companies', 'GET', {}, qs);
                              }
                              else {
                                  qs.per_page = this.getNodeParameter('limit', i);
                                  responseData = await GenericFunctions_1.intercomApiRequest.call(this, '/companies', 'GET', {}, qs);
                                  responseData = responseData.companies;
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`, { itemIndex: i });
                          }
                      }
                      if (operation === 'users') {
                          const listBy = this.getNodeParameter('listBy', 0);
                          const value = this.getNodeParameter('value', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (listBy === 'companyId') {
                              qs.company_id = value;
                          }
                          try {
                              if (listBy === 'id') {
                                  if (returnAll) {
                                      responseData = await GenericFunctions_1.intercomApiRequestAllItems.call(this, 'users', `/companies/${value}/users`, 'GET', {}, qs);
                                  }
                                  else {
                                      qs.per_page = this.getNodeParameter('limit', i);
                                      responseData = await GenericFunctions_1.intercomApiRequest.call(this, `/companies/${value}/users`, 'GET', {}, qs);
                                      responseData = responseData.users;
                                  }
                              }
                              else {
                                  qs.type = 'users';
                                  if (returnAll) {
                                      responseData = await GenericFunctions_1.intercomApiRequestAllItems.call(this, 'users', '/companies', 'GET', {}, qs);
                                  }
                                  else {
                                      qs.per_page = this.getNodeParameter('limit', i);
                                      responseData = await GenericFunctions_1.intercomApiRequest.call(this, '/companies', 'GET', {}, qs);
                                      responseData = responseData.users;
                                  }
                              }
                          }
                          catch (error) {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Intercom Error: ${JSON.stringify(error)}`, { itemIndex: i });
                          }
                      }
                  }
                  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.Intercom = Intercom;
  //# sourceMappingURL=Intercom.node.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: Intercom credentials
  description: Documentation for Intercom credentials. Use these credentials to authenticate Intercom in n8n, a workflow automation platform.
  contentType: [integration, reference]
  ---

  # Intercom credentials

  You can use these credentials to authenticate the following nodes:

  - [Intercom](/integrations/builtin/app-nodes/n8n-nodes-base.intercom.md)


  ## Prerequisites

  - Create an [Intercom](https://www.intercom.com/) developer account.
  - [Create an app](https://developers.intercom.com/docs/build-an-integration/learn-more/authentication/){:target=_blank .external-link} in your developer hub.

  ## Supported authentication methods

  - API key

  ## Related resources

  Refer to [Intercom's API documentation](https://developers.intercom.com/docs/references/introduction/){:target=_blank .external-link} for more information about the service.

  ## Using API key

  To configure this credential, you'll need:

  - An **API Key**: Intercom automatically generates an **Access Token** when you [create an app](https://developers.intercom.com/docs/build-an-integration/learn-more/authentication/){:target=_blank .external-link}. Use this **Access Token** as your n8n **API Key**. Refer to [How to get your Access Token](https://developers.intercom.com/docs/build-an-integration/learn-more/authentication/#how-to-get-your-access-token){:target=_blank .external-link} for more detailed instructions. 

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"0cf6877d-14a4-45b1-94d7-f2aa0467e417","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"48aa568b1dbe54b534eaf19146f823c66766e1f922b47d0ac512ee61fa6e6380"}}


node_type: n8n-nodes-base.InvoiceNinja
name: InvoiceNinja
display_name: Invoice Ninja
description: Consume Invoice Ninja API
category: Other
code_hash: e826788255190576d2864bc51ab1a171463e343e67140ef1c5119c78e49acd8f
documentation_url: https://docs.n8n.io/integrations/builtin/credentials/invoiceninja
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:24
updated_at: 2025-06-08 08:05:24
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.InvoiceNinja = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const ClientDescription_1 = require("./ClientDescription");
  const InvoiceDescription_1 = require("./InvoiceDescription");
  const ISOCountryCodes_1 = require("./ISOCountryCodes");
  const TaskDescription_1 = require("./TaskDescription");
  const PaymentDescription_1 = require("./PaymentDescription");
  const ExpenseDescription_1 = require("./ExpenseDescription");
  const QuoteDescription_1 = require("./QuoteDescription");
  class InvoiceNinja {
      constructor() {
          this.description = {
              displayName: 'Invoice Ninja',
              name: 'invoiceNinja',
              icon: 'file:invoiceNinja.svg',
              group: ['output'],
              version: [1, 2],
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Invoice Ninja API',
              defaults: {
                  name: 'Invoice Ninja',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'invoiceNinjaApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'API Version',
                      name: 'apiVersion',
                      type: 'options',
                      isNodeSetting: true,
                      displayOptions: {
                          show: {
                              '@version': [1],
                          },
                      },
                      options: [
                          {
                              name: 'Version 4',
                              value: 'v4',
                          },
                          {
                              name: 'Version 5',
                              value: 'v5',
                          },
                      ],
                      default: 'v4',
                  },
                  {
                      displayName: 'API Version',
                      name: 'apiVersion',
                      type: 'options',
                      isNodeSetting: true,
                      displayOptions: {
                          show: {
                              '@version': [2],
                          },
                      },
                      options: [
                          {
                              name: 'Version 4',
                              value: 'v4',
                          },
                          {
                              name: 'Version 5',
                              value: 'v5',
                          },
                      ],
                      default: 'v5',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Client',
                              value: 'client',
                          },
                          {
                              name: 'Expense',
                              value: 'expense',
                          },
                          {
                              name: 'Invoice',
                              value: 'invoice',
                          },
                          {
                              name: 'Payment',
                              value: 'payment',
                          },
                          {
                              name: 'Quote',
                              value: 'quote',
                          },
                          {
                              name: 'Task',
                              value: 'task',
                          },
                      ],
                      default: 'client',
                  },
                  ...ClientDescription_1.clientOperations,
                  ...ClientDescription_1.clientFields,
                  ...InvoiceDescription_1.invoiceOperations,
                  ...InvoiceDescription_1.invoiceFields,
                  ...TaskDescription_1.taskOperations,
                  ...TaskDescription_1.taskFields,
                  ...PaymentDescription_1.paymentOperations,
                  ...PaymentDescription_1.paymentFields,
                  ...ExpenseDescription_1.expenseOperations,
                  ...ExpenseDescription_1.expenseFields,
                  ...QuoteDescription_1.quoteOperations,
                  ...QuoteDescription_1.quoteFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getClients() {
                      const returnData = [];
                      const clients = await GenericFunctions_1.invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/clients');
                      for (const client of clients) {
                          const clientName = client.display_name;
                          const clientId = client.id;
                          returnData.push({
                              name: clientName,
                              value: clientId,
                          });
                      }
                      return returnData;
                  },
                  async getProjects() {
                      const returnData = [];
                      const projects = await GenericFunctions_1.invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/projects');
                      for (const project of projects) {
                          const projectName = project.name;
                          const projectId = project.id;
                          returnData.push({
                              name: projectName,
                              value: projectId,
                          });
                      }
                      return returnData;
                  },
                  async getInvoices() {
                      const returnData = [];
                      const invoices = await GenericFunctions_1.invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/invoices');
                      for (const invoice of invoices) {
                          const invoiceName = (invoice.invoice_number || invoice.number);
                          const invoiceId = invoice.id;
                          returnData.push({
                              name: invoiceName,
                              value: invoiceId,
                          });
                      }
                      return returnData;
                  },
                  async getCountryCodes() {
                      const returnData = [];
                      for (let i = 0; i < ISOCountryCodes_1.countryCodes.length; i++) {
                          const countryName = ISOCountryCodes_1.countryCodes[i].name;
                          const countryId = ISOCountryCodes_1.countryCodes[i].numeric;
                          returnData.push({
                              name: countryName,
                              value: countryId,
                          });
                      }
                      return returnData;
                  },
                  async getVendors() {
                      const returnData = [];
                      const vendors = await GenericFunctions_1.invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/vendors');
                      for (const vendor of vendors) {
                          const vendorName = vendor.name;
                          const vendorId = vendor.id;
                          returnData.push({
                              name: vendorName,
                              value: vendorId,
                          });
                      }
                      return returnData;
                  },
                  async getExpenseCategories() {
                      const returnData = [];
                      const categories = await GenericFunctions_1.invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/expense_categories');
                      for (const category of categories) {
                          const categoryName = category.name;
                          const categoryId = category.id;
                          returnData.push({
                              name: categoryName,
                              value: categoryId,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          var _a;
          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);
          const apiVersion = this.getNodeParameter('apiVersion', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'client') {
                      if (operation === 'create') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {};
                          if (additionalFields.clientName) {
                              body.name = additionalFields.clientName;
                          }
                          if (additionalFields.clientName) {
                              body.name = additionalFields.clientName;
                          }
                          if (additionalFields.idNumber) {
                              body.id_number = additionalFields.idNumber;
                          }
                          if (additionalFields.idNumber) {
                              body.id_number = additionalFields.idNumber;
                          }
                          if (additionalFields.privateNotes) {
                              body.private_notes = additionalFields.privateNotes;
                          }
                          if (additionalFields.vatNumber) {
                              body.vat_number = additionalFields.vatNumber;
                          }
                          if (additionalFields.workPhone) {
                              body.work_phone = additionalFields.workPhone;
                          }
                          if (additionalFields.website) {
                              body.website = additionalFields.website;
                          }
                          const contactsValues = this.getNodeParameter('contactsUi', i)
                              .contacstValues;
                          if (contactsValues) {
                              const contacts = [];
                              for (const contactValue of contactsValues) {
                                  const contact = {
                                      first_name: contactValue.firstName,
                                      last_name: contactValue.lastName,
                                      email: contactValue.email,
                                      phone: contactValue.phone,
                                  };
                                  contacts.push(contact);
                              }
                              body.contacts = contacts;
                          }
                          const shippingAddressValue = this.getNodeParameter('shippingAddressUi', i).shippingAddressValue;
                          if (shippingAddressValue) {
                              body.shipping_address1 = shippingAddressValue.streetAddress;
                              body.shipping_address2 = shippingAddressValue.aptSuite;
                              body.shipping_city = shippingAddressValue.city;
                              body.shipping_state = shippingAddressValue.state;
                              body.shipping_postal_code = shippingAddressValue.postalCode;
                              body.shipping_country_id = parseInt(shippingAddressValue.countryCode, 10);
                          }
                          const billingAddressValue = this.getNodeParameter('billingAddressUi', i).billingAddressValue;
                          if (billingAddressValue) {
                              body.address1 = billingAddressValue.streetAddress;
                              body.address2 = billingAddressValue.aptSuite;
                              body.city = billingAddressValue.city;
                              body.state = billingAddressValue.state;
                              body.postal_code = billingAddressValue.postalCode;
                              body.country_id = parseInt(billingAddressValue.countryCode, 10);
                          }
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'POST', '/clients', body);
                          responseData = responseData.data;
                      }
                      if (operation === 'get') {
                          const clientId = this.getNodeParameter('clientId', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.include) {
                              qs.include = options.include;
                          }
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'GET', `/clients/${clientId}`, {}, qs);
                          responseData = responseData.data;
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          const options = this.getNodeParameter('options', i);
                          if (options.include) {
                              qs.include = options.include;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/clients', {}, qs);
                          }
                          else {
                              qs.per_page = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'GET', '/clients', {}, qs);
                              responseData = responseData.data;
                          }
                      }
                      if (operation === 'delete') {
                          const clientId = this.getNodeParameter('clientId', i);
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'DELETE', `/clients/${clientId}`);
                          responseData = responseData.data;
                      }
                  }
                  if (resource === 'invoice') {
                      if (operation === 'create') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {};
                          if (additionalFields.email) {
                              body.email = additionalFields.email;
                          }
                          if (additionalFields.client) {
                              body.client_id = additionalFields.client;
                          }
                          if (additionalFields.autoBill) {
                              body.auto_bill = additionalFields.autoBill;
                          }
                          if (additionalFields.customValue1) {
                              body.custom_value1 = additionalFields.customValue1;
                          }
                          if (additionalFields.customValue2) {
                              body.custom_value2 = additionalFields.customValue2;
                          }
                          if (additionalFields.dueDate) {
                              body.due_date = additionalFields.dueDate;
                          }
                          if (additionalFields.invoiceDate) {
                              body.invoice_date = additionalFields.invoiceDate;
                          }
                          if (additionalFields.invoiceNumber) {
                              body.invoice_number = additionalFields.invoiceNumber;
                          }
                          if (additionalFields.invoiceStatus) {
                              body.invoice_status_id = additionalFields.invoiceStatus;
                          }
                          if (additionalFields.isAmountDiscount) {
                              body.is_amount_discount = additionalFields.isAmountDiscount;
                          }
                          if (additionalFields.partial) {
                              body.partial = additionalFields.partial;
                          }
                          if (additionalFields.partialDueDate) {
                              body.partial_due_date = additionalFields.partialDueDate;
                          }
                          if (additionalFields.poNumber) {
                              body.po_number = additionalFields.poNumber;
                          }
                          if (additionalFields.privateNotes) {
                              body.private_notes = additionalFields.privateNotes;
                          }
                          if (additionalFields.publicNotes) {
                              body.public_notes = additionalFields.publicNotes;
                          }
                          if (additionalFields.taxName1) {
                              body.tax_name1 = additionalFields.taxName1;
                          }
                          if (additionalFields.taxName2) {
                              body.tax_name2 = additionalFields.taxName2;
                          }
                          if (additionalFields.taxtRate1) {
                              body.tax_rate1 = additionalFields.taxtRate1;
                          }
                          if (additionalFields.taxtRate2) {
                              body.tax_rate2 = additionalFields.taxtRate2;
                          }
                          if (additionalFields.discount) {
                              body.discount = additionalFields.discount;
                          }
                          if (additionalFields.paid) {
                              body.paid = additionalFields.paid;
                          }
                          if (additionalFields.emailInvoice) {
                              body.email_invoice = additionalFields.emailInvoice;
                          }
                          const invoceItemsValues = this.getNodeParameter('invoiceItemsUi', i)
                              .invoiceItemsValues;
                          if (invoceItemsValues) {
                              const invoiceItems = [];
                              for (const itemValue of invoceItemsValues) {
                                  const item = {
                                      cost: itemValue.cost,
                                      notes: itemValue.description,
                                      product_key: itemValue.service,
                                      tax_rate1: itemValue.taxRate1,
                                      tax_rate2: itemValue.taxRate2,
                                      tax_name1: itemValue.taxName1,
                                      tax_name2: itemValue.taxName2,
                                  };
                                  if (apiVersion === 'v4') {
                                      item.qty = itemValue.hours;
                                  }
                                  if (apiVersion === 'v5') {
                                      item.quantity = itemValue.hours;
                                  }
                                  invoiceItems.push(item);
                              }
                              if (apiVersion === 'v4') {
                                  body.invoice_items = invoiceItems;
                              }
                              if (apiVersion === 'v5') {
                                  body.line_items = invoiceItems;
                              }
                          }
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'POST', '/invoices', body);
                          responseData = responseData.data;
                      }
                      if (operation === 'email') {
                          const invoiceId = this.getNodeParameter('invoiceId', i);
                          if (apiVersion === 'v4') {
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'POST', '/email_invoice', {
                                  id: invoiceId,
                              });
                          }
                          if (apiVersion === 'v5') {
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'GET', `/invoices/${invoiceId}/email`);
                          }
                      }
                      if (operation === 'get') {
                          const invoiceId = this.getNodeParameter('invoiceId', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.include) {
                              qs.include = options.include;
                          }
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'GET', `/invoices/${invoiceId}`, {}, qs);
                          responseData = responseData.data;
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          const options = this.getNodeParameter('options', i);
                          if (options.include) {
                              qs.include = options.include;
                          }
                          if (options.invoiceNumber) {
                              qs.invoice_number = options.invoiceNumber;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/invoices', {}, qs);
                          }
                          else {
                              qs.per_page = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'GET', '/invoices', {}, qs);
                              responseData = responseData.data;
                          }
                      }
                      if (operation === 'delete') {
                          const invoiceId = this.getNodeParameter('invoiceId', i);
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'DELETE', `/invoices/${invoiceId}`);
                          responseData = responseData.data;
                      }
                  }
                  if (resource === 'task') {
                      if (operation === 'create') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {};
                          if (additionalFields.client) {
                              body.client_id = additionalFields.client;
                          }
                          if (additionalFields.project) {
                              body.project_id = additionalFields.project;
                          }
                          if (additionalFields.customValue1) {
                              body.custom_value1 = additionalFields.customValue1;
                          }
                          if (additionalFields.customValue2) {
                              body.custom_value2 = additionalFields.customValue2;
                          }
                          if (additionalFields.description) {
                              body.description = additionalFields.description;
                          }
                          const timeLogsValues = this.getNodeParameter('timeLogsUi', i)
                              .timeLogsValues;
                          if (timeLogsValues) {
                              const logs = [];
                              for (const logValue of timeLogsValues) {
                                  let from = 0, to;
                                  if (logValue.startDate) {
                                      from = new Date(logValue.startDate).getTime() / 1000;
                                  }
                                  if (logValue.endDate) {
                                      to = new Date(logValue.endDate).getTime() / 1000;
                                  }
                                  if (logValue.duration) {
                                      to = from + logValue.duration * 3600;
                                  }
                                  logs.push([from, to]);
                              }
                              body.time_log = JSON.stringify(logs);
                          }
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'POST', '/tasks', body);
                          responseData = responseData.data;
                      }
                      if (operation === 'get') {
                          const taskId = this.getNodeParameter('taskId', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.include) {
                              qs.include = options.include;
                          }
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'GET', `/tasks/${taskId}`, {}, qs);
                          responseData = responseData.data;
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          const options = this.getNodeParameter('options', i);
                          if (options.include) {
                              qs.include = options.include;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/tasks', {}, qs);
                          }
                          else {
                              qs.per_page = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'GET', '/tasks', {}, qs);
                              responseData = responseData.data;
                          }
                      }
                      if (operation === 'delete') {
                          const taskId = this.getNodeParameter('taskId', i);
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'DELETE', `/tasks/${taskId}`);
                          responseData = responseData.data;
                      }
                  }
                  if (resource === 'payment') {
                      if (operation === 'create') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const invoice = this.getNodeParameter('invoice', i);
                          const client = (_a = (await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'GET', `/invoices/${invoice}`, {}, qs)).data) === null || _a === void 0 ? void 0 : _a.client_id;
                          const amount = this.getNodeParameter('amount', i);
                          const body = {
                              invoice_id: invoice,
                              amount,
                              client_id: client,
                          };
                          if (additionalFields.paymentType) {
                              body.payment_type_id = additionalFields.paymentType;
                          }
                          if (additionalFields.transferReference) {
                              body.transaction_reference = additionalFields.transferReference;
                          }
                          if (additionalFields.privateNotes) {
                              body.private_notes = additionalFields.privateNotes;
                          }
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'POST', '/payments', body);
                          responseData = responseData.data;
                      }
                      if (operation === 'get') {
                          const paymentId = this.getNodeParameter('paymentId', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.include) {
                              qs.include = options.include;
                          }
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'GET', `/payments/${paymentId}`, {}, qs);
                          responseData = responseData.data;
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          const options = this.getNodeParameter('options', i);
                          if (options.include) {
                              qs.include = options.include;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/payments', {}, qs);
                          }
                          else {
                              qs.per_page = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'GET', '/payments', {}, qs);
                              responseData = responseData.data;
                          }
                      }
                      if (operation === 'delete') {
                          const paymentId = this.getNodeParameter('paymentId', i);
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'DELETE', `/payments/${paymentId}`);
                          responseData = responseData.data;
                      }
                  }
                  if (resource === 'expense') {
                      if (operation === 'create') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {};
                          if (additionalFields.amount) {
                              body.amount = additionalFields.amount;
                          }
                          if (additionalFields.billable) {
                              body.should_be_invoiced = additionalFields.billable;
                          }
                          if (additionalFields.client) {
                              body.client_id = additionalFields.client;
                          }
                          if (additionalFields.customValue1) {
                              body.custom_value1 = additionalFields.customValue1;
                          }
                          if (additionalFields.customValue2) {
                              body.custom_value2 = additionalFields.customValue2;
                          }
                          if (additionalFields.category) {
                              body.expense_category_id = additionalFields.category;
                          }
                          if (additionalFields.expenseDate) {
                              body.expense_date = additionalFields.expenseDate;
                          }
                          if (additionalFields.paymentDate) {
                              body.payment_date = additionalFields.paymentDate;
                          }
                          if (additionalFields.paymentType) {
                              body.payment_type_id = additionalFields.paymentType;
                          }
                          if (additionalFields.publicNotes) {
                              body.public_notes = additionalFields.publicNotes;
                          }
                          if (additionalFields.privateNotes) {
                              body.private_notes = additionalFields.privateNotes;
                          }
                          if (additionalFields.taxName1) {
                              body.tax_name1 = additionalFields.taxName1;
                          }
                          if (additionalFields.taxName2) {
                              body.tax_name2 = additionalFields.taxName2;
                          }
                          if (additionalFields.taxRate1) {
                              body.tax_rate1 = additionalFields.taxRate1;
                          }
                          if (additionalFields.taxRate2) {
                              body.tax_rate2 = additionalFields.taxRate2;
                          }
                          if (additionalFields.transactionReference) {
                              body.transaction_reference = additionalFields.transactionReference;
                          }
                          if (additionalFields.vendor) {
                              body.vendor_id = additionalFields.vendor;
                          }
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'POST', '/expenses', body);
                          responseData = responseData.data;
                      }
                      if (operation === 'get') {
                          const expenseId = this.getNodeParameter('expenseId', i);
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'GET', `/expenses/${expenseId}`, {}, qs);
                          responseData = responseData.data;
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/expenses', {}, qs);
                          }
                          else {
                              qs.per_page = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'GET', '/expenses', {}, qs);
                              responseData = responseData.data;
                          }
                      }
                      if (operation === 'delete') {
                          const expenseId = this.getNodeParameter('expenseId', i);
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'DELETE', `/expenses/${expenseId}`);
                          responseData = responseData.data;
                      }
                  }
                  if (resource === 'quote') {
                      const resourceEndpoint = apiVersion === 'v4' ? '/invoices' : '/quotes';
                      if (operation === 'create') {
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              is_quote: true,
                          };
                          if (additionalFields.client) {
                              body.client_id = additionalFields.client;
                          }
                          if (additionalFields.email) {
                              body.email = additionalFields.email;
                          }
                          if (additionalFields.autoBill) {
                              body.auto_bill = additionalFields.autoBill;
                          }
                          if (additionalFields.customValue1) {
                              body.custom_value1 = additionalFields.customValue1;
                          }
                          if (additionalFields.customValue2) {
                              body.custom_value2 = additionalFields.customValue2;
                          }
                          if (additionalFields.dueDate) {
                              body.due_date = additionalFields.dueDate;
                          }
                          if (additionalFields.quouteDate) {
                              body.invoice_date = additionalFields.quouteDate;
                          }
                          if (additionalFields.quoteNumber) {
                              body.invoice_number = additionalFields.quoteNumber;
                          }
                          if (additionalFields.invoiceStatus) {
                              body.invoice_status_id = additionalFields.invoiceStatus;
                          }
                          if (additionalFields.isAmountDiscount) {
                              body.is_amount_discount = additionalFields.isAmountDiscount;
                          }
                          if (additionalFields.partial) {
                              body.partial = additionalFields.partial;
                          }
                          if (additionalFields.partialDueDate) {
                              body.partial_due_date = additionalFields.partialDueDate;
                          }
                          if (additionalFields.poNumber) {
                              body.po_number = additionalFields.poNumber;
                          }
                          if (additionalFields.privateNotes) {
                              body.private_notes = additionalFields.privateNotes;
                          }
                          if (additionalFields.publicNotes) {
                              body.public_notes = additionalFields.publicNotes;
                          }
                          if (additionalFields.taxName1) {
                              body.tax_name1 = additionalFields.taxName1;
                          }
                          if (additionalFields.taxName2) {
                              body.tax_name2 = additionalFields.taxName2;
                          }
                          if (additionalFields.taxtRate1) {
                              body.tax_rate1 = additionalFields.taxtRate1;
                          }
                          if (additionalFields.taxtRate2) {
                              body.tax_rate2 = additionalFields.taxtRate2;
                          }
                          if (additionalFields.discount) {
                              body.discount = additionalFields.discount;
                          }
                          if (additionalFields.paid) {
                              body.paid = additionalFields.paid;
                          }
                          if (additionalFields.emailQuote) {
                              body.email_invoice = additionalFields.emailQuote;
                          }
                          const invoceItemsValues = this.getNodeParameter('invoiceItemsUi', i)
                              .invoiceItemsValues;
                          if (invoceItemsValues) {
                              const invoiceItems = [];
                              for (const itemValue of invoceItemsValues) {
                                  const item = {
                                      cost: itemValue.cost,
                                      notes: itemValue.description,
                                      product_key: itemValue.service,
                                      tax_rate1: itemValue.taxRate1,
                                      tax_rate2: itemValue.taxRate2,
                                      tax_name1: itemValue.taxName1,
                                      tax_name2: itemValue.taxName2,
                                  };
                                  if (apiVersion === 'v4') {
                                      item.qty = itemValue.hours;
                                  }
                                  if (apiVersion === 'v5') {
                                      item.quantity = itemValue.hours;
                                  }
                                  invoiceItems.push(item);
                              }
                              if (apiVersion === 'v4') {
                                  body.invoice_items = invoiceItems;
                              }
                              if (apiVersion === 'v5') {
                                  body.line_items = invoiceItems;
                              }
                          }
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'POST', resourceEndpoint, body);
                          responseData = responseData.data;
                      }
                      if (operation === 'email') {
                          const quoteId = this.getNodeParameter('quoteId', i);
                          if (apiVersion === 'v4') {
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'POST', '/email_invoice', {
                                  id: quoteId,
                              });
                          }
                          if (apiVersion === 'v5') {
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'GET', `/quotes/${quoteId}/email`);
                          }
                      }
                      if (operation === 'get') {
                          const quoteId = this.getNodeParameter('quoteId', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.include) {
                              qs.include = options.include;
                          }
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'GET', `${resourceEndpoint}/${quoteId}`, {}, qs);
                          responseData = responseData.data;
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', 0);
                          const options = this.getNodeParameter('options', i);
                          if (options.include) {
                              qs.include = options.include;
                          }
                          if (options.invoiceNumber) {
                              qs.invoice_number = options.invoiceNumber;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequestAllItems.call(this, 'data', 'GET', '/quotes', {}, qs);
                          }
                          else {
                              qs.per_page = this.getNodeParameter('limit', 0);
                              responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'GET', '/quotes', {}, qs);
                              responseData = responseData.data;
                          }
                      }
                      if (operation === 'delete') {
                          const quoteId = this.getNodeParameter('quoteId', i);
                          responseData = await GenericFunctions_1.invoiceNinjaApiRequest.call(this, 'DELETE', `${resourceEndpoint}/${quoteId}`);
                          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.InvoiceNinja = InvoiceNinja;
  //# sourceMappingURL=InvoiceNinja.node.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: Invoice Ninja credentials
  description: Documentation for Invoice Ninja credentials. Use these credentials to authenticate Invoice Ninja in n8n, a workflow automation platform.
  contentType: [integration, reference]
  ---

  # Invoice Ninja credentials

  You can use these credentials to authenticate the following nodes:

  - [Invoice Ninja](/integrations/builtin/app-nodes/n8n-nodes-base.invoiceninja.md)
  - [Invoice Ninja Trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.invoiceninjatrigger.md)

  ## Prerequisites

  Create an [Invoice Ninja](https://www.invoiceninja.com/){:target=_blank .external-link} account. Only the Pro and Enterprise plans support API integrations.

  ## Supported authentication methods

  - API key

  ## Related resources

  Refer to Invoice Ninja's [v4 API documentation](https://invoice-ninja.readthedocs.io/en/latest/api.html){:target=_blank .external-link} and [v5 API documentation](https://api-docs.invoicing.co/){:target=_blank .external-link} for more information about the APIs.

  ## Using API key

  To configure this credential, you'll need:

  - A **URL**: If Invoice Ninja hosts your installation, use either of the default URLs mentioned. If you're self-hosting your installation, use the URL of your Invoice Ninja instance.
  - An **API Token**: Generate an API token in **Settings > Account Management > API Tokens**.
  - An optional **Secret**, available only for v5 API users

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"33210bb0-dddc-4ae7-9ea1-483a60f885a6","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"7b523dca3a320b4829ee51f38b4c5c8505f8c9e024da663d37109e1711e65ba6"}}


node_type: n8n-nodes-base.Iterable
name: Iterable
display_name: Iterable
description: Consume Iterable API
category: Other
code_hash: a25bf56399e021962735e8a204bbfbeb4be8a9760a2650eb2534acd7ffed11d6
documentation_url: https://docs.n8n.io/integrations/builtin/credentials/iterable
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:24
updated_at: 2025-06-08 08:05:24
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.Iterable = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const EventDescription_1 = require("./EventDescription");
  const UserDescription_1 = require("./UserDescription");
  const UserListDescription_1 = require("./UserListDescription");
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
  class Iterable {
      constructor() {
          this.description = {
              displayName: 'Iterable',
              name: 'iterable',
              icon: 'file:iterable.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Iterable API',
              defaults: {
                  name: 'Iterable',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'iterableApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Event',
                              value: 'event',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                          {
                              name: 'User List',
                              value: 'userList',
                          },
                      ],
                      default: 'user',
                  },
                  ...EventDescription_1.eventOperations,
                  ...EventDescription_1.eventFields,
                  ...UserDescription_1.userOperations,
                  ...UserDescription_1.userFields,
                  ...UserListDescription_1.userListOperations,
                  ...UserListDescription_1.userListFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getLists() {
                      const { lists } = await GenericFunctions_1.iterableApiRequest.call(this, 'GET', '/lists');
                      const returnData = [];
                      for (const list of lists) {
                          returnData.push({
                              name: list.name,
                              value: list.id,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const timezone = this.getTimezone();
          const qs = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          if (resource === 'event') {
              if (operation === 'track') {
                  const events = [];
                  for (let i = 0; i < length; i++) {
                      const name = this.getNodeParameter('name', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      if (!additionalFields.email && !additionalFields.id) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Either email or userId must be passed in to identify the user. Please add one of both via "Additional Fields". If both are passed in, email takes precedence.', { itemIndex: i });
                      }
                      const body = {
                          eventName: name,
                      };
                      Object.assign(body, additionalFields);
                      if (body.dataFieldsUi) {
                          const dataFields = body.dataFieldsUi.dataFieldValues;
                          const data = {};
                          for (const dataField of dataFields) {
                              data[dataField.key] = dataField.value;
                          }
                          body.dataFields = data;
                          delete body.dataFieldsUi;
                      }
                      if (body.createdAt) {
                          body.createdAt = moment_timezone_1.default.tz(body.createdAt, timezone).unix();
                      }
                      events.push(body);
                  }
                  responseData = await GenericFunctions_1.iterableApiRequest.call(this, 'POST', '/events/trackBulk', { events });
                  returnData.push(responseData);
              }
          }
          if (resource === 'user') {
              if (operation === 'upsert') {
                  for (let i = 0; i < length; i++) {
                      const identifier = this.getNodeParameter('identifier', i);
                      const value = this.getNodeParameter('value', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {};
                      if (identifier === 'email') {
                          body.email = value;
                      }
                      else {
                          body.preferUserId = this.getNodeParameter('preferUserId', i);
                          body.userId = value;
                      }
                      Object.assign(body, additionalFields);
                      if (body.dataFieldsUi) {
                          const dataFields = body.dataFieldsUi.dataFieldValues;
                          const data = {};
                          for (const dataField of dataFields) {
                              data[dataField.key] = dataField.value;
                          }
                          body.dataFields = data;
                          delete body.dataFieldsUi;
                      }
                      responseData = await GenericFunctions_1.iterableApiRequest.call(this, 'POST', '/users/update', body);
                      if (!this.continueOnFail()) {
                          if (responseData.code !== 'Success') {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Iterable error response [400]: ${responseData.msg}`, { itemIndex: i });
                          }
                      }
                      returnData.push(responseData);
                  }
              }
              if (operation === 'delete') {
                  for (let i = 0; i < length; i++) {
                      const by = this.getNodeParameter('by', i);
                      let endpoint;
                      if (by === 'email') {
                          const email = this.getNodeParameter('email', i);
                          endpoint = `/users/${email}`;
                      }
                      else {
                          const userId = this.getNodeParameter('userId', i);
                          endpoint = `/users/byUserId/${userId}`;
                      }
                      responseData = await GenericFunctions_1.iterableApiRequest.call(this, 'DELETE', endpoint);
                      if (!this.continueOnFail()) {
                          if (responseData.code !== 'Success') {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), responseData);
                          }
                      }
                      returnData.push(responseData);
                  }
              }
              if (operation === 'get') {
                  for (let i = 0; i < length; i++) {
                      const by = this.getNodeParameter('by', i);
                      let endpoint;
                      if (by === 'email') {
                          const email = this.getNodeParameter('email', i);
                          endpoint = '/users/getByEmail';
                          qs.email = email;
                      }
                      else {
                          const userId = this.getNodeParameter('userId', i);
                          endpoint = `/users/byUserId/${userId}`;
                      }
                      responseData = await GenericFunctions_1.iterableApiRequest.call(this, 'GET', endpoint, {}, qs);
                      if (!this.continueOnFail()) {
                          if (Object.keys(responseData).length === 0) {
                              throw new n8n_workflow_1.NodeApiError(this.getNode(), responseData, {
                                  message: 'User not found',
                                  httpCode: '404',
                              });
                          }
                      }
                      responseData = responseData.user || {};
                      returnData.push(responseData);
                  }
              }
          }
          if (resource === 'userList') {
              if (operation === 'add') {
                  const listId = this.getNodeParameter('listId', 0);
                  const identifier = this.getNodeParameter('identifier', 0);
                  const body = {
                      listId: parseInt(listId, 10),
                      subscribers: [],
                  };
                  const subscribers = [];
                  for (let i = 0; i < length; i++) {
                      const value = this.getNodeParameter('value', i);
                      if (identifier === 'email') {
                          subscribers.push({ email: value });
                      }
                      else {
                          subscribers.push({ userId: value });
                      }
                  }
                  body.subscribers = subscribers;
                  responseData = await GenericFunctions_1.iterableApiRequest.call(this, 'POST', '/lists/subscribe', body);
                  returnData.push(responseData);
              }
              if (operation === 'remove') {
                  const listId = this.getNodeParameter('listId', 0);
                  const identifier = this.getNodeParameter('identifier', 0);
                  const additionalFields = this.getNodeParameter('additionalFields', 0);
                  const body = {
                      listId: parseInt(listId, 10),
                      subscribers: [],
                      campaignId: additionalFields.campaignId,
                      channelUnsubscribe: additionalFields.channelUnsubscribe,
                  };
                  const subscribers = [];
                  for (let i = 0; i < length; i++) {
                      const value = this.getNodeParameter('value', i);
                      if (identifier === 'email') {
                          subscribers.push({ email: value });
                      }
                      else {
                          subscribers.push({ userId: value });
                      }
                  }
                  body.subscribers = subscribers;
                  responseData = await GenericFunctions_1.iterableApiRequest.call(this, 'POST', '/lists/unsubscribe', body);
                  returnData.push(responseData);
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Iterable = Iterable;
  //# sourceMappingURL=Iterable.node.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: Iterable credentials
  description: Documentation for Iterable credentials. Use these credentials to authenticate Iterable in n8n, a workflow automation platform.
  contentType: [integration, reference]
  ---

  # Iterable credentials

  You can use these credentials to authenticate the following nodes:

  - [Iterable](/integrations/builtin/app-nodes/n8n-nodes-base.iterable.md)

  ## Prerequisites

  Create an [Iterable](https://iterable.com){:target=_blank .external-link} account.

  ## Supported authentication methods

  - API key

  ## Related resources

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

  - [US-based Iterable projects](https://api.iterable.com/api/docs){:target=_blank .external-link}
  - [Europe-based Iterable projects](https://api.eu.iterable.com/api/docs){:target=_blank .external-link}

  ## Using API key

  To configure this credential, you'll need:

  - An **API Key**: Refer to [Iterable's Creating API keys documentation](https://support.iterable.com/hc/en-us/articles/360043464871-API-Keys#creating-api-keys){:target=_blank .external-link} for instructions on creating API keys.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"da298a9b-0969-4630-a4fb-5d66aa0997f0","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"f2daf7e2544a41e4327be5bd1051741a6cafa51bc6da22fb0980e53c72a36362"}}


node_type: n8n-nodes-base.Jenkins
name: Jenkins
display_name: Jenkins
description: Consume Jenkins API
category: Other
code_hash: f2cc66998d1891568379ae5503e6ad1467a505ba3e06e5df8209d990381c015e
documentation_url: https://docs.n8n.io/integrations/builtin/credentials/jenkins
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:24
updated_at: 2025-06-08 08:05:24
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Jenkins = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  class Jenkins {
      constructor() {
          this.description = {
              displayName: 'Jenkins',
              name: 'jenkins',
              icon: 'file:jenkins.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Jenkins API',
              defaults: {
                  name: 'Jenkins',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'jenkinsApi',
                      required: true,
                      testedBy: 'jenkinApiCredentialTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      options: [
                          {
                              name: 'Build',
                              value: 'build',
                          },
                          {
                              name: 'Instance',
                              value: 'instance',
                          },
                          {
                              name: 'Job',
                              value: 'job',
                          },
                      ],
                      default: 'job',
                      noDataExpression: true,
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      displayOptions: {
                          show: {
                              resource: ['job'],
                          },
                      },
                      options: [
                          {
                              name: 'Copy',
                              value: 'copy',
                              description: 'Copy a specific job',
                              action: 'Copy a job',
                          },
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a new job',
                              action: 'Create a job',
                          },
                          {
                              name: 'Trigger',
                              value: 'trigger',
                              description: 'Trigger a specific job',
                              action: 'Trigger a job',
                          },
                          {
                              name: 'Trigger with Parameters',
                              value: 'triggerParams',
                              description: 'Trigger a specific job',
                              action: 'Trigger a job with parameters',
                          },
                      ],
                      default: 'trigger',
                      description: 'Possible operations',
                      noDataExpression: true,
                  },
                  {
                      displayName: 'Make sure the job is setup to support triggering with parameters. <a href="https://wiki.jenkins.io/display/JENKINS/Parameterized+Build" target="_blank">More info</a>',
                      name: 'triggerParamsNotice',
                      type: 'notice',
                      displayOptions: {
                          show: {
                              resource: ['job'],
                              operation: ['triggerParams'],
                          },
                      },
                      default: '',
                  },
                  {
                      displayName: 'Job Name or ID',
                      name: 'job',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getJobs',
                      },
                      displayOptions: {
                          show: {
                              resource: ['job'],
                              operation: ['trigger', 'triggerParams', 'copy'],
                          },
                      },
                      required: true,
                      default: '',
                      description: 'Name of the job. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Parameters',
                      name: 'param',
                      type: 'fixedCollection',
                      placeholder: 'Add Parameter',
                      displayOptions: {
                          show: {
                              resource: ['job'],
                              operation: ['triggerParams'],
                          },
                      },
                      required: true,
                      default: {},
                      typeOptions: {
                          multipleValues: true,
                      },
                      options: [
                          {
                              name: 'params',
                              displayName: 'Parameters',
                              values: [
                                  {
                                      displayName: 'Name or ID',
                                      name: 'name',
                                      type: 'options',
                                      description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
                                      typeOptions: {
                                          loadOptionsMethod: 'getJobParameters',
                                          loadOptionsDependsOn: ['job'],
                                      },
                                      default: '',
                                  },
                                  {
                                      displayName: 'Value',
                                      name: 'value',
                                      type: 'string',
                                      default: '',
                                  },
                              ],
                          },
                      ],
                      description: 'Parameters for Jenkins job',
                  },
                  {
                      displayName: 'New Job Name',
                      name: 'newJob',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['job'],
                              operation: ['copy', 'create'],
                          },
                      },
                      required: true,
                      default: '',
                      description: 'Name of the new Jenkins job',
                  },
                  {
                      displayName: 'XML',
                      name: 'xml',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['job'],
                              operation: ['create'],
                          },
                      },
                      required: true,
                      default: '',
                      description: 'XML of Jenkins config',
                  },
                  {
                      displayName: 'To get the XML of an existing job, add ‘config.xml’ to the end of the job URL',
                      name: 'createNotice',
                      type: 'notice',
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['job'],
                              operation: ['create'],
                          },
                      },
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      displayOptions: {
                          show: {
                              resource: ['instance'],
                          },
                      },
                      options: [
                          {
                              name: 'Cancel Quiet Down',
                              value: 'cancelQuietDown',
                              description: 'Cancel quiet down state',
                              action: 'Cancel Quiet Down an instance',
                          },
                          {
                              name: 'Quiet Down',
                              value: 'quietDown',
                              description: 'Put Jenkins in quiet mode, no builds can be started, Jenkins is ready for shutdown',
                              action: 'Quiet Down an instance',
                          },
                          {
                              name: 'Restart',
                              value: 'restart',
                              description: 'Restart Jenkins immediately on environments where it is possible',
                              action: 'Restart an instance',
                          },
                          {
                              name: 'Safely Restart',
                              value: 'safeRestart',
                              description: 'Restart Jenkins once no jobs are running on environments where it is possible',
                              action: 'Safely Restart an instance',
                          },
                          {
                              name: 'Safely Shutdown',
                              value: 'safeExit',
                              description: 'Shutdown once no jobs are running',
                              action: 'Safely Shutdown an instance',
                          },
                          {
                              name: 'Shutdown',
                              value: 'exit',
                              description: 'Shutdown Jenkins immediately',
                              action: 'Shutdown an instance',
                          },
                      ],
                      default: 'safeRestart',
                      description: 'Jenkins instance operations',
                      noDataExpression: true,
                  },
                  {
                      displayName: 'Reason',
                      name: 'reason',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['instance'],
                              operation: ['quietDown'],
                          },
                      },
                      default: '',
                      description: 'Freeform reason for quiet down mode',
                  },
                  {
                      displayName: 'Instance operation can shutdown Jenkins instance and make it unresponsive. Some commands may not be available depending on instance implementation.',
                      name: 'instanceNotice',
                      type: 'notice',
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['instance'],
                          },
                      },
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      displayOptions: {
                          show: {
                              resource: ['build'],
                          },
                      },
                      options: [
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'List Builds',
                              action: 'Get many builds',
                          },
                      ],
                      default: 'getAll',
                      noDataExpression: true,
                  },
                  {
                      displayName: 'Job Name or ID',
                      name: 'job',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getJobs',
                      },
                      displayOptions: {
                          show: {
                              resource: ['build'],
                              operation: ['getAll'],
                          },
                      },
                      required: true,
                      default: '',
                      description: 'Name of the job. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      default: false,
                      displayOptions: {
                          show: {
                              resource: ['build'],
                              operation: ['getAll'],
                          },
                      },
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      default: 50,
                      typeOptions: {
                          minValue: 1,
                      },
                      displayOptions: {
                          show: {
                              resource: ['build'],
                              operation: ['getAll'],
                              returnAll: [false],
                          },
                      },
                      description: 'Max number of results to return',
                  },
              ],
          };
          this.methods = {
              credentialTest: {
                  async jenkinApiCredentialTest(credential) {
                      const { baseUrl, username, apiKey } = credential.data;
                      const url = (0, GenericFunctions_1.tolerateTrailingSlash)(baseUrl);
                      const endpoint = '/api/json';
                      const options = {
                          auth: {
                              username,
                              password: apiKey,
                          },
                          method: 'GET',
                          body: {},
                          qs: {},
                          uri: `${url}${endpoint}`,
                          json: true,
                      };
                      try {
                          await this.helpers.request(options);
                          return {
                              status: 'OK',
                              message: 'Authentication successful',
                          };
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                  },
              },
              loadOptions: {
                  async getJobs() {
                      const returnData = [];
                      const endpoint = '/api/json';
                      const { jobs } = await GenericFunctions_1.jenkinsApiRequest.call(this, 'GET', endpoint);
                      for (const job of jobs) {
                          returnData.push({
                              name: job.name,
                              value: job.name,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return returnData;
                  },
                  async getJobParameters() {
                      const job = this.getCurrentNodeParameter('job');
                      const returnData = [];
                      const endpoint = `/job/${job}/api/json?tree=actions[parameterDefinitions[*]]`;
                      const { actions } = await GenericFunctions_1.jenkinsApiRequest.call(this, 'GET', endpoint);
                      for (const { _class, parameterDefinitions } of actions) {
                          if (_class === null || _class === void 0 ? void 0 : _class.includes('ParametersDefinitionProperty')) {
                              for (const { name, type } of parameterDefinitions) {
                                  returnData.push({
                                      name: `${name} - (${type})`,
                                      value: name,
                                  });
                              }
                          }
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'job') {
                      if (operation === 'trigger') {
                          const job = this.getNodeParameter('job', i);
                          const endpoint = `/job/${job}/build`;
                          await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint);
                          responseData = { success: true };
                      }
                      if (operation === 'triggerParams') {
                          const job = this.getNodeParameter('job', i);
                          const params = this.getNodeParameter('param.params', i, []);
                          let form = {};
                          if (params.length) {
                              form = params.reduce((body, param) => {
                                  body[param.name] = param.value;
                                  return body;
                              }, {});
                          }
                          const endpoint = `/job/${job}/buildWithParameters`;
                          await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint, {}, {}, {
                              form,
                              headers: {
                                  'content-type': 'application/x-www-form-urlencoded',
                              },
                          });
                          responseData = { success: true };
                      }
                      if (operation === 'copy') {
                          const job = this.getNodeParameter('job', i);
                          const name = this.getNodeParameter('newJob', i);
                          const queryParams = {
                              name,
                              mode: 'copy',
                              from: job,
                          };
                          const endpoint = '/createItem';
                          try {
                              await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint, queryParams);
                              responseData = { success: true };
                          }
                          catch (error) {
                              if (error.httpCode === '302') {
                                  responseData = { success: true };
                              }
                              else {
                                  throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                              }
                          }
                      }
                      if (operation === 'create') {
                          const name = this.getNodeParameter('newJob', i);
                          const queryParams = {
                              name,
                          };
                          const headers = {
                              'content-type': 'application/xml',
                          };
                          const body = this.getNodeParameter('xml', i);
                          const endpoint = '/createItem';
                          await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint, queryParams, body, {
                              headers,
                              json: false,
                          });
                          responseData = { success: true };
                      }
                  }
                  if (resource === 'instance') {
                      if (operation === 'quietDown') {
                          const reason = this.getNodeParameter('reason', i);
                          let queryParams;
                          if (reason) {
                              queryParams = {
                                  reason,
                              };
                          }
                          const endpoint = '/quietDown';
                          await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint, queryParams);
                          responseData = { success: true };
                      }
                      if (operation === 'cancelQuietDown') {
                          const endpoint = '/cancelQuietDown';
                          await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint);
                          responseData = { success: true };
                      }
                      if (operation === 'restart') {
                          const endpoint = '/restart';
                          try {
                              await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint);
                          }
                          catch (error) {
                              if (error.httpCode === '503') {
                                  responseData = { success: true };
                              }
                              else {
                                  throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                              }
                          }
                      }
                      if (operation === 'safeRestart') {
                          const endpoint = '/safeRestart';
                          try {
                              await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint);
                          }
                          catch (error) {
                              if (error.httpCode === '503') {
                                  responseData = { success: true };
                              }
                              else {
                                  throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
                              }
                          }
                      }
                      if (operation === 'exit') {
                          const endpoint = '/exit';
                          await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint);
                          responseData = { success: true };
                      }
                      if (operation === 'safeExit') {
                          const endpoint = '/safeExit';
                          await GenericFunctions_1.jenkinsApiRequest.call(this, 'POST', endpoint);
                          responseData = { success: true };
                      }
                  }
                  if (resource === 'build') {
                      if (operation === 'getAll') {
                          const job = this.getNodeParameter('job', i);
                          let endpoint = `/job/${job}/api/json?tree=builds[*]`;
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (!returnAll) {
                              const limit = this.getNodeParameter('limit', i);
                              endpoint += `{0,${limit}}`;
                          }
                          responseData = await GenericFunctions_1.jenkinsApiRequest.call(this, 'GET', endpoint);
                          responseData = responseData.builds;
                      }
                  }
                  if (Array.isArray(responseData)) {
                      returnData.push.apply(returnData, responseData);
                  }
                  else {
                      returnData.push(responseData);
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ error: error.message });
                      continue;
                  }
                  throw error;
              }
          }
          return [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.Jenkins = Jenkins;
  //# sourceMappingURL=Jenkins.node.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: Jenkins credentials
  description: Documentation for Jenkins credentials. Use these credentials to authenticate Jenkins in n8n, a workflow automation platform.
  contentType: [integration, reference]
  ---

  # Jenkins credentials

  You can use these credentials to authenticate the following nodes:

  - [Jenkins](/integrations/builtin/app-nodes/n8n-nodes-base.jenkins.md)


  ## Prerequisites

  Create an account on a [Jenkins](https://www.jenkins.io/){:target=_blank .external-link} instance.

  ## Supported authentication methods

  - API token

  ## Related resources

  Jenkins doesn't provide public API documentation; API documentation for each page is available from the user interface in the bottom right. Refer to those detailed pages for more information about the service. Refer to [Jenkins Remote Access API](https://www.jenkins.io/doc/book/using/remote-access-api/){:target=_blank .external-link} for information on the API and API wrappers.

  ## Using API token

  To configure this credential, you'll need:

  - The **Jenkins Username**: For the user whom the token belongs to
  - A **Personal API Token**: Generate this from the user's **profile details > Configure > Add new token**. Refer to [these Stack Overflow instructions](https://stackoverflow.com/questions/45466090/how-to-get-the-api-token-for-jenkins){:target=_blank .external-link} for more detail.
  - The **Jenkins Instance URL**

  Jenkins rebuilt their API token setup in 2018. If you're working with an older Jenkins instance, be sure you're using a non-legacy API token. Refer to [Security Hardening: New API token system in Jenkins 2.129+](https://www.jenkins.io/blog/2018/07/02/new-api-token-system/){:target=_blank .external-link} for more information.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"cb5a5e8e-7721-4a3a-a3c1-29936625452d","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"5ff9e92a9f4e4b3b00a57156531702bf39a2a0a3f81c9dfa5266e214f96ba63b"}}


node_type: n8n-nodes-base.Jira
name: Jira
display_name: Jira Software
description: Consume Jira Software API
category: Other
code_hash: 4e93fa0d77ac1881853591e98dea6a0effa65338c59c3a2097a06ff8c8d34278
documentation_url: https://docs.n8n.io/integrations/builtin/credentials/jira
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:24
updated_at: 2025-06-08 08:05:24
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.Jira = void 0;
  const mergeWith_1 = __importDefault(require("lodash/mergeWith"));
  const n8n_workflow_1 = require("n8n-workflow");
  const GenericFunctions_1 = require("./GenericFunctions");
  const IssueAttachmentDescription_1 = require("./IssueAttachmentDescription");
  const IssueCommentDescription_1 = require("./IssueCommentDescription");
  const IssueDescription_1 = require("./IssueDescription");
  const UserDescription_1 = require("./UserDescription");
  class Jira {
      constructor() {
          this.description = {
              displayName: 'Jira Software',
              name: 'jira',
              icon: 'file:jira.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Jira Software API',
              defaults: {
                  name: 'Jira Software',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'jiraSoftwareCloudApi',
                      required: true,
                      displayOptions: {
                          show: {
                              jiraVersion: ['cloud'],
                          },
                      },
                  },
                  {
                      name: 'jiraSoftwareServerApi',
                      required: true,
                      displayOptions: {
                          show: {
                              jiraVersion: ['server'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Jira Version',
                      name: 'jiraVersion',
                      type: 'options',
                      options: [
                          {
                              name: 'Cloud',
                              value: 'cloud',
                          },
                          {
                              name: 'Server (Self Hosted)',
                              value: 'server',
                          },
                      ],
                      default: 'cloud',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Issue',
                              value: 'issue',
                              description: 'Creates an issue or, where the option to create subtasks is enabled in Jira, a subtask',
                          },
                          {
                              name: 'Issue Attachment',
                              value: 'issueAttachment',
                              description: 'Add, remove, and get an attachment from an issue',
                          },
                          {
                              name: 'Issue Comment',
                              value: 'issueComment',
                              description: 'Get, create, update, and delete a comment from an issue',
                          },
                          {
                              name: 'User',
                              value: 'user',
                              description: 'Get, create and delete a user',
                          },
                      ],
                      default: 'issue',
                  },
                  ...IssueDescription_1.issueOperations,
                  ...IssueDescription_1.issueFields,
                  ...IssueAttachmentDescription_1.issueAttachmentOperations,
                  ...IssueAttachmentDescription_1.issueAttachmentFields,
                  ...IssueCommentDescription_1.issueCommentOperations,
                  ...IssueCommentDescription_1.issueCommentFields,
                  ...UserDescription_1.userOperations,
                  ...UserDescription_1.userFields,
              ],
          };
          this.methods = {
              listSearch: {
                  async getProjects(filter) {
                      const returnData = [];
                      const jiraVersion = this.getCurrentNodeParameter('jiraVersion');
                      let endpoint = '';
                      let projects;
                      if (jiraVersion === 'server') {
                          endpoint = '/api/2/project';
                          projects = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, endpoint, 'GET');
                      }
                      else {
                          endpoint = '/api/2/project/search';
                          projects = await GenericFunctions_1.jiraSoftwareCloudApiRequestAllItems.call(this, 'values', endpoint, 'GET');
                      }
                      if (projects.values && Array.isArray(projects.values)) {
                          projects = projects.values;
                      }
                      for (const project of projects) {
                          const projectName = project.name;
                          const projectId = project.id;
                          returnData.push({
                              name: projectName,
                              value: projectId,
                          });
                      }
                      return { results: (0, GenericFunctions_1.filterSortSearchListItems)(returnData, filter) };
                  },
                  async getIssueTypes() {
                      const projectId = this.getCurrentNodeParameter('project', { extractValue: true });
                      const returnData = [];
                      const { issueTypes } = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/project/${projectId}`, 'GET');
                      for (const issueType of issueTypes) {
                          const issueTypeName = issueType.name;
                          const issueTypeId = issueType.id;
                          returnData.push({
                              name: issueTypeName,
                              value: issueTypeId,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return { results: returnData };
                  },
                  async getUsers(filter) {
                      const users = await GenericFunctions_1.getUsers.call(this);
                      return { results: (0, GenericFunctions_1.filterSortSearchListItems)(users, filter) };
                  },
                  async getPriorities() {
                      const returnData = [];
                      const priorities = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '/api/2/priority', 'GET');
                      for (const priority of priorities) {
                          const priorityName = priority.name;
                          const priorityId = priority.id;
                          returnData.push({
                              name: priorityName,
                              value: priorityId,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return { results: returnData };
                  },
                  async getTransitions() {
                      const returnData = [];
                      const issueKey = this.getCurrentNodeParameter('issueKey');
                      const transitions = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}/transitions`, 'GET');
                      for (const transition of transitions.transitions) {
                          returnData.push({
                              name: transition.name,
                              value: transition.id,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return { results: returnData };
                  },
                  async getCustomFields() {
                      const returnData = [];
                      const operation = this.getCurrentNodeParameter('operation');
                      let projectId;
                      let issueTypeId;
                      if (operation === 'create') {
                          projectId = this.getCurrentNodeParameter('project', { extractValue: true });
                          issueTypeId = this.getCurrentNodeParameter('issueType', { extractValue: true });
                      }
                      else {
                          const issueKey = this.getCurrentNodeParameter('issueKey');
                          const res = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'GET', {}, {});
                          projectId = res.fields.project.id;
                          issueTypeId = res.fields.issuetype.id;
                      }
                      const res = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/createmeta?projectIds=${projectId}&issueTypeIds=${issueTypeId}&expand=projects.issuetypes.fields`, 'GET');
                      const fields = res.projects
                          .find((o) => o.id === projectId)
                          .issuetypes.find((o) => o.id === issueTypeId).fields;
                      for (const key of Object.keys(fields)) {
                          const field = fields[key];
                          if (field.schema && Object.keys(field.schema).includes('customId')) {
                              returnData.push({
                                  name: field.name,
                                  value: field.key || field.fieldId,
                              });
                          }
                      }
                      return { results: returnData };
                  },
              },
              loadOptions: {
                  async getLabels() {
                      const returnData = [];
                      const labels = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '/api/2/label', 'GET');
                      for (const label of labels.values) {
                          const labelName = label;
                          const labelId = label;
                          returnData.push({
                              name: labelName,
                              value: labelId,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return returnData;
                  },
                  async getUsers() {
                      return GenericFunctions_1.getUsers.call(this);
                  },
                  async getGroups() {
                      const returnData = [];
                      const groups = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '/api/2/groups/picker', 'GET');
                      for (const group of groups.groups) {
                          const groupName = group.name;
                          const groupId = group.name;
                          returnData.push({
                              name: groupName,
                              value: groupId,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      return returnData;
                  },
                  async getProjectComponents() {
                      const returnData = [];
                      const project = this.getCurrentNodeParameter('project', { extractValue: true });
                      const { values: components } = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/project/${project}/component`, 'GET');
                      for (const component of components) {
                          returnData.push({
                              name: component.name,
                              value: component.id,
                          });
                      }
                      returnData.sort((a, b) => {
                          if (a.name < b.name) {
                              return -1;
                          }
                          if (a.name > b.name) {
                              return 1;
                          }
                          return 0;
                      });
                      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);
          const jiraVersion = this.getNodeParameter('jiraVersion', 0);
          if (resource === 'issue') {
              if (operation === 'create') {
                  for (let i = 0; i < length; i++) {
                      const summary = this.getNodeParameter('summary', i);
                      const projectId = this.getNodeParameter('project', i, '', {
                          extractValue: true,
                      });
                      const issueTypeId = this.getNodeParameter('issueType', i, '', {
                          extractValue: true,
                      });
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const assignee = this.getNodeParameter('additionalFields.assignee', i, '', {
                          extractValue: true,
                      });
                      if (assignee)
                          additionalFields.assignee = assignee;
                      const reporter = this.getNodeParameter('additionalFields.reporter', i, '', {
                          extractValue: true,
                      });
                      if (reporter)
                          additionalFields.reporter = reporter;
                      const priority = this.getNodeParameter('additionalFields.priority', i, '', {
                          extractValue: true,
                      });
                      if (priority)
                          additionalFields.priority = priority;
                      const body = {};
                      const fields = {
                          summary,
                          project: {
                              id: projectId,
                          },
                          issuetype: {
                              id: issueTypeId,
                          },
                      };
                      if (additionalFields.labels) {
                          fields.labels = additionalFields.labels;
                      }
                      if (additionalFields.serverLabels) {
                          fields.labels = additionalFields.serverLabels;
                      }
                      if (additionalFields.priority) {
                          fields.priority = {
                              id: additionalFields.priority,
                          };
                      }
                      if (additionalFields.assignee) {
                          if (jiraVersion === 'server') {
                              fields.assignee = {
                                  name: additionalFields.assignee,
                              };
                          }
                          else {
                              fields.assignee = {
                                  id: additionalFields.assignee,
                              };
                          }
                      }
                      if (additionalFields.reporter) {
                          if (jiraVersion === 'server') {
                              fields.reporter = {
                                  name: additionalFields.reporter,
                              };
                          }
                          else {
                              fields.reporter = {
                                  id: additionalFields.reporter,
                              };
                          }
                      }
                      if (additionalFields.description) {
                          fields.description = additionalFields.description;
                      }
                      if (additionalFields.updateHistory) {
                          qs.updateHistory = additionalFields.updateHistory;
                      }
                      if (additionalFields.componentIds) {
                          fields.components = additionalFields.componentIds.map((id) => ({ id }));
                      }
                      if (additionalFields.customFieldsUi) {
                          const customFields = additionalFields.customFieldsUi
                              .customFieldsValues;
                          if (customFields) {
                              customFields.forEach((cf) => {
                                  if (typeof cf.fieldId !== 'string') {
                                      cf.fieldId = cf.fieldId.value.trim();
                                  }
                              });
                              const data = customFields.reduce((obj, value) => Object.assign(obj, { [`${value.fieldId}`]: value.fieldValue }), {});
                              Object.assign(fields, data);
                          }
                      }
                      const issueTypes = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '/api/2/issuetype', 'GET', body, qs);
                      const subtaskIssues = [];
                      for (const issueType of issueTypes) {
                          if (issueType.subtask) {
                              subtaskIssues.push(issueType.id);
                          }
                      }
                      if (!additionalFields.parentIssueKey && subtaskIssues.includes(issueTypeId)) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You must define a Parent Issue Key when Issue type is sub-task', { itemIndex: i });
                      }
                      else if (additionalFields.parentIssueKey && subtaskIssues.includes(issueTypeId)) {
                          fields.parent = {
                              key: additionalFields.parentIssueKey.toUpperCase(),
                          };
                      }
                      body.fields = fields;
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '/api/2/issue', 'POST', body);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'update') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const updateFields = this.getNodeParameter('updateFields', i);
                      const assignee = this.getNodeParameter('updateFields.assignee', i, '', {
                          extractValue: true,
                      });
                      if (assignee)
                          updateFields.assignee = assignee;
                      const reporter = this.getNodeParameter('updateFields.reporter', i, '', {
                          extractValue: true,
                      });
                      if (reporter)
                          updateFields.reporter = reporter;
                      const priority = this.getNodeParameter('updateFields.priority', i, '', {
                          extractValue: true,
                      });
                      if (priority)
                          updateFields.priority = priority;
                      const statusId = this.getNodeParameter('updateFields.statusId', i, '', {
                          extractValue: true,
                      });
                      if (statusId)
                          updateFields.statusId = statusId;
                      const body = {};
                      const fields = {};
                      if (updateFields.summary) {
                          fields.summary = updateFields.summary;
                      }
                      if (updateFields.issueType) {
                          fields.issuetype = {
                              id: updateFields.issueType,
                          };
                      }
                      if (updateFields.labels) {
                          fields.labels = updateFields.labels;
                      }
                      if (updateFields.serverLabels) {
                          fields.labels = updateFields.serverLabels;
                      }
                      if (updateFields.priority) {
                          fields.priority = {
                              id: updateFields.priority,
                          };
                      }
                      if (updateFields.assignee) {
                          if (jiraVersion === 'server') {
                              fields.assignee = {
                                  name: updateFields.assignee,
                              };
                          }
                          else {
                              fields.assignee = {
                                  id: updateFields.assignee,
                              };
                          }
                      }
                      if (updateFields.reporter) {
                          if (jiraVersion === 'server') {
                              fields.reporter = {
                                  name: updateFields.reporter,
                              };
                          }
                          else {
                              fields.reporter = {
                                  id: updateFields.reporter,
                              };
                          }
                      }
                      if (updateFields.description) {
                          fields.description = updateFields.description;
                      }
                      if (updateFields.customFieldsUi) {
                          const customFields = updateFields.customFieldsUi
                              .customFieldsValues;
                          if (customFields) {
                              customFields.forEach((cf) => {
                                  if (typeof cf.fieldId !== 'string') {
                                      cf.fieldId = cf.fieldId.value.trim();
                                  }
                              });
                              const data = customFields.reduce((obj, value) => Object.assign(obj, { [`${value.fieldId}`]: value.fieldValue }), {});
                              Object.assign(fields, data);
                          }
                      }
                      const issueTypes = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '/api/2/issuetype', 'GET', body);
                      const subtaskIssues = [];
                      for (const issueType of issueTypes) {
                          if (issueType.subtask) {
                              subtaskIssues.push(issueType.id);
                          }
                      }
                      if (!updateFields.parentIssueKey && subtaskIssues.includes(updateFields.issueType)) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'You must define a Parent Issue Key when Issue type is sub-task', { itemIndex: i });
                      }
                      else if (updateFields.parentIssueKey &&
                          subtaskIssues.includes(updateFields.issueType)) {
                          fields.parent = {
                              key: updateFields.parentIssueKey.toUpperCase(),
                          };
                      }
                      body.fields = fields;
                      if (updateFields.statusId) {
                          responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}/transitions`, 'POST', { transition: { id: updateFields.statusId } });
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'PUT', body);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'get') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const simplifyOutput = this.getNodeParameter('simplifyOutput', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      if (additionalFields.fields) {
                          qs.fields = additionalFields.fields;
                      }
                      if (additionalFields.fieldsByKey) {
                          qs.fieldsByKey = additionalFields.fieldsByKey;
                      }
                      if (additionalFields.expand) {
                          qs.expand = additionalFields.expand;
                      }
                      if (simplifyOutput) {
                          qs.expand = `${qs.expand || ''},names`;
                      }
                      if (additionalFields.properties) {
                          qs.properties = additionalFields.properties;
                      }
                      if (additionalFields.updateHistory) {
                          qs.updateHistory = additionalFields.updateHistory;
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'GET', {}, qs);
                      if (simplifyOutput) {
                          qs.expand = qs.expand || '';
                          if (qs.expand.toLowerCase().indexOf('renderedfields') !== -1 &&
                              responseData.renderedFields &&
                              Object.keys(responseData.renderedFields).length) {
                              responseData.fields = (0, mergeWith_1.default)(responseData.fields, responseData.renderedFields, (a, b) => (b === null ? a : b));
                          }
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray((0, GenericFunctions_1.simplifyIssueOutput)(responseData)), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                      else {
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                  }
              }
              if (operation === 'getAll') {
                  for (let i = 0; i < length; i++) {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      const body = {};
                      if (options.fields) {
                          body.fields = options.fields.split(',');
                      }
                      if (options.jql) {
                          body.jql = options.jql;
                      }
                      if (options.expand) {
                          if (typeof options.expand === 'string') {
                              body.expand = options.expand.split(',');
                          }
                          else {
                              body.expand = options.expand;
                          }
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequestAllItems.call(this, 'issues', '/api/2/search', 'POST', body);
                      }
                      else {
                          const limit = this.getNodeParameter('limit', i);
                          body.maxResults = limit;
                          responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '/api/2/search', 'POST', body);
                          responseData = responseData.issues;
                      }
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'changelog') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const returnAll = this.getNodeParameter('returnAll', i);
                      if (returnAll) {
                          responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequestAllItems.call(this, 'values', `/api/2/issue/${issueKey}/changelog`, 'GET');
                      }
                      else {
                          qs.maxResults = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}/changelog`, 'GET', {}, qs);
                          responseData = responseData.values;
                      }
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'notify') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const jsonActive = this.getNodeParameter('jsonParameters', 0);
                      const body = {};
                      if (additionalFields.textBody) {
                          body.textBody = additionalFields.textBody;
                      }
                      if (additionalFields.htmlBody) {
                          body.htmlBody = additionalFields.htmlBody;
                      }
                      if (!jsonActive) {
                          const notificationRecipientsValues = this.getNodeParameter('notificationRecipientsUi', i).notificationRecipientsValues;
                          const notificationRecipients = {};
                          if (notificationRecipientsValues) {
                              if (notificationRecipientsValues.reporter) {
                                  notificationRecipients.reporter = notificationRecipientsValues.reporter;
                              }
                              if (notificationRecipientsValues.assignee) {
                                  notificationRecipients.assignee = notificationRecipientsValues.assignee;
                              }
                              if (notificationRecipientsValues.assignee) {
                                  notificationRecipients.watchers = notificationRecipientsValues.watchers;
                              }
                              if (notificationRecipientsValues.voters) {
                                  notificationRecipients.watchers = notificationRecipientsValues.voters;
                              }
                              if ((notificationRecipientsValues.users || []).length > 0) {
                                  notificationRecipients.users = notificationRecipientsValues.users.map((user) => {
                                      return {
                                          accountId: user,
                                      };
                                  });
                              }
                              if ((notificationRecipientsValues.groups || []).length > 0) {
                                  notificationRecipients.groups = notificationRecipientsValues.groups.map((group) => {
                                      return {
                                          name: group,
                                      };
                                  });
                              }
                          }
                          body.to = notificationRecipients;
                          const notificationRecipientsRestrictionsValues = this.getNodeParameter('notificationRecipientsRestrictionsUi', i).notificationRecipientsRestrictionsValues;
                          const notificationRecipientsRestrictions = {};
                          if (notificationRecipientsRestrictionsValues) {
                              if ((notificationRecipientsRestrictionsValues.groups || []).length >
                                  0) {
                                  notificationRecipientsRestrictions.groups = notificationRecipientsRestrictionsValues.groups.map((group) => {
                                      return {
                                          name: group,
                                      };
                                  });
                              }
                          }
                          body.restrict = notificationRecipientsRestrictions;
                      }
                      else {
                          const notificationRecipientsJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('notificationRecipientsJson', i));
                          if (notificationRecipientsJson) {
                              body.to = notificationRecipientsJson;
                          }
                          const notificationRecipientsRestrictionsJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('notificationRecipientsRestrictionsJson', i));
                          if (notificationRecipientsRestrictionsJson) {
                              body.restrict = notificationRecipientsRestrictionsJson;
                          }
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}/notify`, 'POST', body, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'transitions') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      if (additionalFields.transitionId) {
                          qs.transitionId = additionalFields.transitionId;
                      }
                      if (additionalFields.expand) {
                          qs.expand = additionalFields.expand;
                      }
                      if (additionalFields.skipRemoteOnlyCondition) {
                          qs.skipRemoteOnlyCondition = additionalFields.skipRemoteOnlyCondition;
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}/transitions`, 'GET', {}, qs);
                      responseData = responseData.transitions;
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'delete') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const deleteSubtasks = this.getNodeParameter('deleteSubtasks', i);
                      qs.deleteSubtasks = deleteSubtasks;
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'DELETE', {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
          }
          if (resource === 'issueAttachment') {
              const apiVersion = jiraVersion === 'server' ? '2' : '3';
              if (operation === 'add') {
                  for (let i = 0; i < length; i++) {
                      const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                      const issueKey = this.getNodeParameter('issueKey', 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);
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/issue/${issueKey}/attachments`, 'POST', {}, {}, undefined, {
                          formData: {
                              file: {
                                  value: uploadData,
                                  options: {
                                      filename: binaryData.fileName,
                                  },
                              },
                          },
                      });
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'remove') {
                  for (let i = 0; i < length; i++) {
                      const attachmentId = this.getNodeParameter('attachmentId', i);
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/attachment/${attachmentId}`, 'DELETE', {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'get') {
                  const download = this.getNodeParameter('download', 0);
                  for (let i = 0; i < length; i++) {
                      const attachmentId = this.getNodeParameter('attachmentId', i);
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/attachment/${attachmentId}`, 'GET', {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
                  if (download) {
                      const binaryPropertyName = this.getNodeParameter('binaryProperty', 0);
                      for (const [index, attachment] of returnData.entries()) {
                          returnData[index].binary = {};
                          const buffer = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '', 'GET', {}, {}, attachment === null || attachment === void 0 ? void 0 : attachment.json.content, { json: false, encoding: null, useStream: true });
                          returnData[index].binary[binaryPropertyName] =
                              await this.helpers.prepareBinaryData(buffer, attachment.json.filename, attachment.json.mimeType);
                      }
                  }
              }
              if (operation === 'getAll') {
                  const download = this.getNodeParameter('download', 0);
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const { fields: { attachment }, } = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/2/issue/${issueKey}`, 'GET', {}, qs);
                      responseData = attachment;
                      if (!returnAll) {
                          const limit = this.getNodeParameter('limit', i);
                          responseData = responseData.slice(0, limit);
                      }
                      responseData = responseData.map((data) => ({ json: data }));
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
                  if (download) {
                      const binaryPropertyName = this.getNodeParameter('binaryProperty', 0);
                      for (const [index, attachment] of returnData.entries()) {
                          returnData[index].binary = {};
                          const buffer = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, '', 'GET', {}, {}, attachment.json.content, { json: false, encoding: null, useStream: true });
                          returnData[index].binary[binaryPropertyName] =
                              await this.helpers.prepareBinaryData(buffer, attachment.json.filename, attachment.json.mimeType);
                      }
                  }
              }
          }
          if (resource === 'issueComment') {
              const apiVersion = jiraVersion === 'server' ? '2' : '3';
              if (operation === 'add') {
                  for (let i = 0; i < length; i++) {
                      const jsonParameters = this.getNodeParameter('jsonParameters', 0);
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const options = this.getNodeParameter('options', i);
                      const body = {};
                      if (options.expand) {
                          qs.expand = options.expand;
                          delete options.expand;
                      }
                      Object.assign(body, options);
                      if (!jsonParameters) {
                          const comment = this.getNodeParameter('comment', i);
                          if (jiraVersion === 'server') {
                              Object.assign(body, { body: comment });
                          }
                          else {
                              Object.assign(body, {
                                  body: {
                                      type: 'doc',
                                      version: 1,
                                      content: [
                                          {
                                              type: 'paragraph',
                                              content: [
                                                  {
                                                      type: 'text',
                                                      text: comment,
                                                  },
                                              ],
                                          },
                                      ],
                                  },
                              });
                          }
                      }
                      else {
                          const commentJson = this.getNodeParameter('commentJson', i);
                          const json = (0, GenericFunctions_1.validateJSON)(commentJson);
                          if (json === '') {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Document Format must be a valid JSON', {
                                  itemIndex: i,
                              });
                          }
                          Object.assign(body, { body: json });
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/issue/${issueKey}/comment`, 'POST', body, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'get') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const commentId = this.getNodeParameter('commentId', i);
                      const options = this.getNodeParameter('options', i);
                      Object.assign(qs, options);
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/issue/${issueKey}/comment/${commentId}`, 'GET', {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'getAll') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      const body = {};
                      Object.assign(qs, options);
                      if (returnAll) {
                          responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequestAllItems.call(this, 'comments', `/api/${apiVersion}/issue/${issueKey}/comment`, 'GET', body, qs);
                      }
                      else {
                          const limit = this.getNodeParameter('limit', i);
                          body.maxResults = limit;
                          responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/issue/${issueKey}/comment`, 'GET', body, qs);
                          responseData = responseData.comments;
                      }
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'remove') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const commentId = this.getNodeParameter('commentId', i);
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/issue/${issueKey}/comment/${commentId}`, 'DELETE', {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              if (operation === 'update') {
                  for (let i = 0; i < length; i++) {
                      const issueKey = this.getNodeParameter('issueKey', i);
                      const commentId = this.getNodeParameter('commentId', i);
                      const options = this.getNodeParameter('options', i);
                      const jsonParameters = this.getNodeParameter('jsonParameters', 0);
                      const body = {};
                      if (options.expand) {
                          qs.expand = options.expand;
                          delete options.expand;
                      }
                      Object.assign(qs, options);
                      if (!jsonParameters) {
                          const comment = this.getNodeParameter('comment', i);
                          if (jiraVersion === 'server') {
                              Object.assign(body, { body: comment });
                          }
                          else {
                              Object.assign(body, {
                                  body: {
                                      type: 'doc',
                                      version: 1,
                                      content: [
                                          {
                                              type: 'paragraph',
                                              content: [
                                                  {
                                                      type: 'text',
                                                      text: comment,
                                                  },
                                              ],
                                          },
                                      ],
                                  },
                              });
                          }
                      }
                      else {
                          const commentJson = this.getNodeParameter('commentJson', i);
                          const json = (0, GenericFunctions_1.validateJSON)(commentJson);
                          if (json === '') {
                              throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Document Format must be a valid JSON', {
                                  itemIndex: i,
                              });
                          }
                          Object.assign(body, { body: json });
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/issue/${issueKey}/comment/${commentId}`, 'PUT', body, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
          }
          if (resource === 'user') {
              const apiVersion = jiraVersion === 'server' ? '2' : '3';
              if (operation === 'create') {
                  for (let i = 0; i < length; i++) {
                      const body = {
                          name: this.getNodeParameter('username', i),
                          emailAddress: this.getNodeParameter('emailAddress', i),
                          displayName: this.getNodeParameter('displayName', i),
                      };
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      Object.assign(body, additionalFields);
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/user`, 'POST', body, {});
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              else if (operation === 'delete') {
                  for (let i = 0; i < length; i++) {
                      qs.accountId = this.getNodeParameter('accountId', i);
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/user`, 'DELETE', {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ success: true }), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
              else if (operation === 'get') {
                  for (let i = 0; i < length; i++) {
                      qs.accountId = this.getNodeParameter('accountId', i);
                      const { expand } = this.getNodeParameter('additionalFields', i);
                      if (expand) {
                          qs.expand = expand.join(',');
                      }
                      responseData = await GenericFunctions_1.jiraSoftwareCloudApiRequest.call(this, `/api/${apiVersion}/user`, 'GET', {}, qs);
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                      returnData.push(...executionData);
                  }
              }
          }
          return [returnData];
      }
  }
  exports.Jira = Jira;
  //# sourceMappingURL=Jira.node.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: Jira credentials
  description: Documentation for Jira credentials. Use these credentials to authenticate Jira in n8n, a workflow automation platform.
  contentType: [integration, reference]
  priority: medium
  ---

  # Jira credentials

  You can use these credentials to authenticate the following nodes:

  - [Jira](/integrations/builtin/app-nodes/n8n-nodes-base.jira.md)
  - [Jira Trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.jiratrigger.md)

  ## Prerequisites

  Create a [Jira](https://www.atlassian.com/software/jira){:target=_blank .external-link} Software Cloud or Server account.

  ## Supported authentication methods

  - [SW Cloud API token](#using-sw-cloud-api-token): Use this method with [Jira Software Cloud](https://www.atlassian.com/software/jira){:target=_blank .external-link}.
  - [SW Server account](#using-sw-server-account): Use this method with [Jira Software Server](https://www.atlassian.com/software/jira/download.){:target=_blank .external-link}.

  ## Related resources

  Refer to [Jira's API documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v2/intro/#about){:target=_blank .external-link} for more information about the service.

  ## Using SW Cloud API token

  To configure this credential, you'll need an account on [Jira Software Cloud](https://www.atlassian.com/software/jira){:target=_blank .external-link}.

  Then:

  1. Log in to your Atlassian profile > **Security > API tokens** page, or jump straight there using this [link](https://id.atlassian.com/manage-profile/security/api-tokens){:target=_blank .external-link}.
  2. Select **Create API Token**.
  3. Enter a good **Label** for your token, like `n8n integration`.
  4. Select **Create**.
  5. Copy the API token.
  6. In n8n, enter the **Email** address associated with your Jira account.
  7. Paste the API token you copied as your **API Token**.
  8. Enter the **Domain** you access Jira on, for example `https://example.atlassian.net`.

  Refer to [Manage API tokens for your Atlassian account](https://support.atlassian.com/atlassian-account/docs/manage-api-tokens-for-your-atlassian-account/){:target=_blank .external-link} for more information.

  /// note | New tokens
  New tokens may take up to a minute before they work. If your credential verification fails the first time, wait a minute before retrying.
  ///

  ## Using SW Server account

  To configure this credential, you'll need an account on [Jira Software Server](https://www.atlassian.com/software/jira/download.){:target=_blank .external-link}.

  Then:

  1. Enter the **Email** address associated with your Jira account.
  2. Enter your Jira account **Password**.
  3. Enter the **Domain** you access Jira on.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"68e1043b-dd11-4ad1-a336-e28dd48bf8f9","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"37d0442751136eb08b5370212c2304ec341570a0194569e753b82cbdaa805418"}}


node_type: n8n-nodes-base.Kafka
name: Kafka
display_name: Kafka
description: Sends messages to a Kafka topic
category: Other
code_hash: 74c45cee3cedf2f42356b732d5025dcedca4654fe4a2c472ffc62e2d27715f7f
documentation_url: https://docs.n8n.io/integrations/builtin/credentials/kafka
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:24
updated_at: 2025-06-08 08:05:24
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Kafka = void 0;
  const kafkajs_1 = require("kafkajs");
  const confluent_schema_registry_1 = require("@kafkajs/confluent-schema-registry");
  const n8n_workflow_1 = require("n8n-workflow");
  const utilities_1 = require("../../utils/utilities");
  class Kafka {
      constructor() {
          this.description = {
              displayName: 'Kafka',
              name: 'kafka',
              icon: 'file:kafka.svg',
              group: ['transform'],
              version: 1,
              description: 'Sends messages to a Kafka topic',
              defaults: {
                  name: 'Kafka',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'kafka',
                      required: true,
                      testedBy: 'kafkaConnectionTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Topic',
                      name: 'topic',
                      type: 'string',
                      default: '',
                      placeholder: 'topic-name',
                      description: 'Name of the queue of topic to publish to',
                  },
                  {
                      displayName: 'Send Input Data',
                      name: 'sendInputData',
                      type: 'boolean',
                      default: true,
                      description: 'Whether to send the the data the node receives as JSON to Kafka',
                  },
                  {
                      displayName: 'Message',
                      name: 'message',
                      type: 'string',
                      displayOptions: {
                          show: {
                              sendInputData: [false],
                          },
                      },
                      default: '',
                      description: 'The message to be sent',
                  },
                  {
                      displayName: 'JSON Parameters',
                      name: 'jsonParameters',
                      type: 'boolean',
                      default: false,
                  },
                  {
                      displayName: 'Use Schema Registry',
                      name: 'useSchemaRegistry',
                      type: 'boolean',
                      default: false,
                      description: 'Whether to use Confluent Schema Registry',
                  },
                  {
                      displayName: 'Schema Registry URL',
                      name: 'schemaRegistryUrl',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              useSchemaRegistry: [true],
                          },
                      },
                      placeholder: 'https://schema-registry-domain:8081',
                      default: '',
                      description: 'URL of the schema registry',
                  },
                  {
                      displayName: 'Use Key',
                      name: 'useKey',
                      type: 'boolean',
                      default: false,
                      description: 'Whether to use a message key',
                  },
                  {
                      displayName: 'Key',
                      name: 'key',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              useKey: [true],
                          },
                      },
                      placeholder: '',
                      default: '',
                      description: 'The message key',
                  },
                  {
                      displayName: 'Event Name',
                      name: 'eventName',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              useSchemaRegistry: [true],
                          },
                      },
                      default: '',
                      description: 'Namespace and Name of Schema in Schema Registry (namespace.name)',
                  },
                  {
                      displayName: 'Headers',
                      name: 'headersUi',
                      placeholder: 'Add Header',
                      type: 'fixedCollection',
                      displayOptions: {
                          show: {
                              jsonParameters: [false],
                          },
                      },
                      typeOptions: {
                          multipleValues: true,
                      },
                      default: {},
                      options: [
                          {
                              name: 'headerValues',
                              displayName: 'Header',
                              values: [
                                  {
                                      displayName: 'Key',
                                      name: 'key',
                                      type: 'string',
                                      default: '',
                                  },
                                  {
                                      displayName: 'Value',
                                      name: 'value',
                                      type: 'string',
                                      default: '',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Headers (JSON)',
                      name: 'headerParametersJson',
                      type: 'json',
                      displayOptions: {
                          show: {
                              jsonParameters: [true],
                          },
                      },
                      default: '',
                      description: 'Header parameters as JSON (flat object)',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      default: {},
                      placeholder: 'Add Option',
                      options: [
                          {
                              displayName: 'Acks',
                              name: 'acks',
                              type: 'boolean',
                              default: false,
                              description: 'Whether or not producer must wait for acknowledgement from all replicas',
                          },
                          {
                              displayName: 'Compression',
                              name: 'compression',
                              type: 'boolean',
                              default: false,
                              description: 'Whether to send the data in a compressed format using the GZIP codec',
                          },
                          {
                              displayName: 'Timeout',
                              name: 'timeout',
                              type: 'number',
                              default: 30000,
                              description: 'The time to await a response in ms',
                          },
                      ],
                  },
              ],
          };
          this.methods = {
              credentialTest: {
                  async kafkaConnectionTest(credential) {
                      const credentials = credential.data;
                      try {
                          const brokers = (credentials.brokers || '')
                              .split(',')
                              .map((item) => item.trim());
                          const clientId = credentials.clientId;
                          const ssl = credentials.ssl;
                          const config = {
                              clientId,
                              brokers,
                              ssl,
                          };
                          if (credentials.authentication === true) {
                              if (!(credentials.username && credentials.password)) {
                                  throw Error('Username and password are required for authentication');
                              }
                              config.sasl = {
                                  username: credentials.username,
                                  password: credentials.password,
                                  mechanism: credentials.saslMechanism,
                              };
                          }
                          const kafka = new kafkajs_1.Kafka(config);
                          await kafka.admin().connect();
                          await kafka.admin().disconnect();
                          return {
                              status: 'OK',
                              message: 'Authentication successful',
                          };
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const itemData = (0, utilities_1.generatePairedItemData)(items.length);
          const length = items.length;
          const topicMessages = [];
          let responseData;
          try {
              const options = this.getNodeParameter('options', 0);
              const sendInputData = this.getNodeParameter('sendInputData', 0);
              const useSchemaRegistry = this.getNodeParameter('useSchemaRegistry', 0);
              const timeout = options.timeout;
              let compression = kafkajs_1.CompressionTypes.None;
              const acks = options.acks === true ? 1 : 0;
              if (options.compression === true) {
                  compression = kafkajs_1.CompressionTypes.GZIP;
              }
              const credentials = await this.getCredentials('kafka');
              const brokers = (credentials.brokers || '').split(',').map((item) => item.trim());
              const clientId = credentials.clientId;
              const ssl = credentials.ssl;
              const config = {
                  clientId,
                  brokers,
                  ssl,
              };
              if (credentials.authentication === true) {
                  if (!(credentials.username && credentials.password)) {
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Username and password are required for authentication');
                  }
                  config.sasl = {
                      username: credentials.username,
                      password: credentials.password,
                      mechanism: credentials.saslMechanism,
                  };
              }
              const kafka = new kafkajs_1.Kafka(config);
              const producer = kafka.producer();
              await producer.connect();
              let message;
              for (let i = 0; i < length; i++) {
                  if (sendInputData) {
                      message = JSON.stringify(items[i].json);
                  }
                  else {
                      message = this.getNodeParameter('message', i);
                  }
                  if (useSchemaRegistry) {
                      try {
                          const schemaRegistryUrl = this.getNodeParameter('schemaRegistryUrl', 0);
                          const eventName = this.getNodeParameter('eventName', 0);
                          const registry = new confluent_schema_registry_1.SchemaRegistry({ host: schemaRegistryUrl });
                          const id = await registry.getLatestSchemaId(eventName);
                          message = await registry.encode(id, JSON.parse(message));
                      }
                      catch (exception) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Verify your Schema Registry configuration');
                      }
                  }
                  const topic = this.getNodeParameter('topic', i);
                  const jsonParameters = this.getNodeParameter('jsonParameters', i);
                  const useKey = this.getNodeParameter('useKey', i);
                  const key = useKey ? this.getNodeParameter('key', i) : null;
                  let headers;
                  if (jsonParameters) {
                      headers = this.getNodeParameter('headerParametersJson', i);
                      try {
                          headers = JSON.parse(headers);
                      }
                      catch (exception) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Headers must be a valid json');
                      }
                  }
                  else {
                      const values = this.getNodeParameter('headersUi', i)
                          .headerValues;
                      headers = {};
                      if (values !== undefined) {
                          for (const value of values) {
                              headers[value.key] = value.value;
                          }
                      }
                  }
                  topicMessages.push({
                      topic,
                      messages: [
                          {
                              value: message,
                              headers,
                              key,
                          },
                      ],
                  });
              }
              responseData = await producer.sendBatch({
                  topicMessages,
                  timeout,
                  compression,
                  acks,
              });
              if (responseData.length === 0) {
                  responseData.push({
                      success: true,
                  });
              }
              await producer.disconnect();
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData });
              return [executionData];
          }
          catch (error) {
              if (this.continueOnFail()) {
                  return [[{ json: { error: error.message }, pairedItem: itemData }]];
              }
              else {
                  throw error;
              }
          }
      }
  }
  exports.Kafka = Kafka;
  //# sourceMappingURL=Kafka.node.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: Kafka credentials
  description: Documentation for Kafka credentials. Use these credentials to authenticate Kafka in n8n, a workflow automation platform.
  contentType: [integration, reference]
  priority: medium
  ---

  # Kafka credentials

  You can use these credentials to authenticate the following nodes:

  - [Kafka](/integrations/builtin/app-nodes/n8n-nodes-base.kafka.md)
  - [Kafka Trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.kafkatrigger.md)

  ## Supported authentication methods

  - Client ID

  ## Related resources

  Refer to [Kafka's documentation](https://kafka.apache.org/documentation/){:target=_blank .external-link} for more information about using the service.

  If you're new to Kafka, refer to the [Apache Kafka Quickstart](https://kafka.apache.org/quickstart){:target=_blank .external-link} for initial setup.

  Refer to [Encryption and Authentication using SSL](https://kafka.apache.org/documentation/#security_ssl){:target=_blank .external-link} for working with SSL in Kafka.

  ## Using client ID

  To configure this credential, you'll need a running Kafka environment and:

  - A **Client ID**
  - A list of relevant **Brokers**
  - Username/password authentication details if your Kafka environment uses authentication

  To set it up:

  1. Enter the `CLIENT-ID` of the client or consumer group in the **Client ID** field in your credential.
  2. Enter a comma-separated list of relevant **Brokers** for the credential to use in the format `<broker-service-name>:<port>`. Use the name you gave the broker when you defined it in the `services` list. For example, `kafka-1:9092,kafka-2:9092` would add the brokers `kafka-1` and `kafka-2` on port `9092`.
  3. If your Kafka environment doesn't use SSL, turn off the **SSL** toggle.
  4. If you've enabled authentication using SASL in your Kafka environment, turn on the **Authentication** toggle. Then add:
      1. The **Username**
      2. The **Password**
      3. Select the broker's configured **SASL Mechanism**. Refer to [SASL configuration](https://kafka.apache.org/documentation/#security_sasl_config){:target=_blank .external-link} for more information. Options include:
          - `Plain`
          - `scram-sha-256`
          - `scram-sha-512`

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"073c635c-011d-4139-b622-b691e782d63e","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"a84f9794100f907aa3e9c65b90dd02f3ffbbc895f7eebee49468e04f700158cf"}}


node_type: n8n-nodes-base.Keap
name: Keap
display_name: Keap
description: Consume Keap API
category: Other
code_hash: 6edbc9075b37a91bd9f057729c08aa0d1296fdd8316a1790b34ba81da790c32e
documentation_url: https://docs.n8n.io/integrations/builtin/credentials/keap
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:24
updated_at: 2025-06-08 08:05:24
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.Keap = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const ContactDescription_1 = require("./ContactDescription");
  const ContactNoteDescription_1 = require("./ContactNoteDescription");
  const ContactTagDescription_1 = require("./ContactTagDescription");
  const EcommerceOrderDescripion_1 = require("./EcommerceOrderDescripion");
  const EcommerceProductDescription_1 = require("./EcommerceProductDescription");
  const EmailDescription_1 = require("./EmailDescription");
  const FileDescription_1 = require("./FileDescription");
  const CompanyDescription_1 = require("./CompanyDescription");
  const change_case_1 = require("change-case");
  const moment_timezone_1 = __importDefault(require("moment-timezone"));
  class Keap {
      constructor() {
          this.description = {
              displayName: 'Keap',
              name: 'keap',
              icon: 'file:keap.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Keap API',
              defaults: {
                  name: 'Keap',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'keapOAuth2Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Company',
                              value: 'company',
                          },
                          {
                              name: 'Contact',
                              value: 'contact',
                          },
                          {
                              name: 'Contact Note',
                              value: 'contactNote',
                          },
                          {
                              name: 'Contact Tag',
                              value: 'contactTag',
                          },
                          {
                              name: 'Ecommerce Order',
                              value: 'ecommerceOrder',
                          },
                          {
                              name: 'Ecommerce Product',
                              value: 'ecommerceProduct',
                          },
                          {
                              name: 'Email',
                              value: 'email',
                          },
                          {
                              name: 'File',
                              value: 'file',
                          },
                      ],
                      default: 'company',
                  },
                  ...CompanyDescription_1.companyOperations,
                  ...CompanyDescription_1.companyFields,
                  ...ContactDescription_1.contactOperations,
                  ...ContactDescription_1.contactFields,
                  ...ContactNoteDescription_1.contactNoteOperations,
                  ...ContactNoteDescription_1.contactNoteFields,
                  ...ContactTagDescription_1.contactTagOperations,
                  ...ContactTagDescription_1.contactTagFields,
                  ...EcommerceOrderDescripion_1.ecommerceOrderOperations,
                  ...EcommerceOrderDescripion_1.ecommerceOrderFields,
                  ...EcommerceProductDescription_1.ecommerceProductOperations,
                  ...EcommerceProductDescription_1.ecommerceProductFields,
                  ...EmailDescription_1.emailOperations,
                  ...EmailDescription_1.emailFields,
                  ...FileDescription_1.fileOperations,
                  ...FileDescription_1.fileFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getTags() {
                      const returnData = [];
                      const tags = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'tags', 'GET', '/tags');
                      for (const tag of tags) {
                          const tagName = tag.name;
                          const tagId = tag.id;
                          returnData.push({
                              name: tagName,
                              value: tagId,
                          });
                      }
                      return returnData;
                  },
                  async getUsers() {
                      const returnData = [];
                      const users = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'users', 'GET', '/users');
                      for (const user of users) {
                          const userName = user.given_name;
                          const userId = user.id;
                          returnData.push({
                              name: userName,
                              value: userId,
                          });
                      }
                      return returnData;
                  },
                  async getCountries() {
                      const returnData = [];
                      const { countries } = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/locales/countries');
                      for (const key of Object.keys(countries)) {
                          const countryName = countries[key];
                          const countryId = key;
                          returnData.push({
                              name: countryName,
                              value: countryId,
                          });
                      }
                      return returnData;
                  },
                  async getProvinces() {
                      const countryCode = this.getCurrentNodeParameter('countryCode');
                      const returnData = [];
                      const { provinces } = await GenericFunctions_1.keapApiRequest.call(this, 'GET', `/locales/countries/${countryCode}/provinces`);
                      for (const key of Object.keys(provinces)) {
                          const provinceName = provinces[key];
                          const provinceId = key;
                          returnData.push({
                              name: provinceName,
                              value: provinceId,
                          });
                      }
                      return returnData;
                  },
                  async getContactTypes() {
                      const returnData = [];
                      const types = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/setting/contact/optionTypes');
                      for (const type of types.value.split(',')) {
                          const typeName = type;
                          const typeId = type;
                          returnData.push({
                              name: typeName,
                              value: typeId,
                          });
                      }
                      return returnData;
                  },
                  async getTimezones() {
                      const returnData = [];
                      for (const timezone of moment_timezone_1.default.tz.names()) {
                          const timezoneName = timezone;
                          const timezoneId = timezone;
                          returnData.push({
                              name: timezoneName,
                              value: timezoneId,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          const qs = {};
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              if (resource === 'company') {
                  if (operation === 'create') {
                      const addresses = this.getNodeParameter('addressesUi', i)
                          .addressesValues;
                      const faxes = this.getNodeParameter('faxesUi', i)
                          .faxesValues;
                      const phones = this.getNodeParameter('phonesUi', i)
                          .phonesValues;
                      const companyName = this.getNodeParameter('companyName', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          company_name: companyName,
                      };
                      (0, GenericFunctions_1.keysToSnakeCase)(additionalFields);
                      Object.assign(body, additionalFields);
                      if (addresses) {
                          body.address = (0, GenericFunctions_1.keysToSnakeCase)(addresses)[0];
                      }
                      if (faxes) {
                          body.fax_number = faxes[0];
                      }
                      if (phones) {
                          body.phone_number = phones[0];
                      }
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', '/companies', body);
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      (0, GenericFunctions_1.keysToSnakeCase)(options);
                      Object.assign(qs, options);
                      if (qs.fields) {
                          qs.optional_properties = qs.fields;
                          delete qs.fields;
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'companies', 'GET', '/companies', {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/companies', {}, qs);
                          responseData = responseData.companies;
                      }
                  }
              }
              if (resource === 'contact') {
                  if (operation === 'upsert') {
                      const duplicateOption = this.getNodeParameter('duplicateOption', i);
                      const addresses = this.getNodeParameter('addressesUi', i)
                          .addressesValues;
                      const emails = this.getNodeParameter('emailsUi', i)
                          .emailsValues;
                      const faxes = this.getNodeParameter('faxesUi', i)
                          .faxesValues;
                      const socialAccounts = this.getNodeParameter('socialAccountsUi', i)
                          .socialAccountsValues;
                      const phones = this.getNodeParameter('phonesUi', i)
                          .phonesValues;
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          duplicate_option: (0, change_case_1.pascalCase)(duplicateOption),
                      };
                      if (additionalFields.anniversary) {
                          body.anniversary = additionalFields.anniversary;
                      }
                      if (additionalFields.contactType) {
                          body.contact_type = additionalFields.contactType;
                      }
                      if (additionalFields.familyName) {
                          body.family_name = additionalFields.familyName;
                      }
                      if (additionalFields.givenName) {
                          body.given_name = additionalFields.givenName;
                      }
                      if (additionalFields.jobTitle) {
                          body.job_title = additionalFields.jobTitle;
                      }
                      if (additionalFields.leadSourceId) {
                          body.lead_source_id = additionalFields.leadSourceId;
                      }
                      if (additionalFields.middleName) {
                          body.middle_name = additionalFields.middleName;
                      }
                      if (additionalFields.middleName) {
                          body.middle_name = additionalFields.middleName;
                      }
                      if (additionalFields.OptInReason) {
                          body.opt_in_reason = additionalFields.OptInReason;
                      }
                      if (additionalFields.ownerId) {
                          body.owner_id = additionalFields.ownerId;
                      }
                      if (additionalFields.preferredLocale) {
                          body.preferred_locale = additionalFields.preferredLocale;
                      }
                      if (additionalFields.preferredName) {
                          body.preferred_name = additionalFields.preferredName;
                      }
                      if (additionalFields.sourceType) {
                          body.source_type = additionalFields.sourceType;
                      }
                      if (additionalFields.spouseName) {
                          body.spouse_name = additionalFields.spouseName;
                      }
                      if (additionalFields.timezone) {
                          body.time_zone = additionalFields.timezone;
                      }
                      if (additionalFields.website) {
                          body.website = additionalFields.website;
                      }
                      if (additionalFields.ipAddress) {
                          body.origin = { ip_address: additionalFields.ipAddress };
                      }
                      if (additionalFields.companyId) {
                          body.company = { id: additionalFields.companyId };
                      }
                      if (additionalFields.optInReason) {
                          body.opt_in_reason = additionalFields.optInReason;
                      }
                      if (addresses) {
                          body.addresses = (0, GenericFunctions_1.keysToSnakeCase)(addresses);
                      }
                      if (emails) {
                          body.email_addresses = emails;
                      }
                      if (faxes) {
                          body.fax_numbers = faxes;
                      }
                      if (socialAccounts) {
                          body.social_accounts = socialAccounts;
                      }
                      if (phones) {
                          body.phone_numbers = phones;
                      }
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'PUT', '/contacts', body);
                  }
                  if (operation === 'delete') {
                      const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'DELETE', `/contacts/${contactId}`);
                      responseData = { success: true };
                  }
                  if (operation === 'get') {
                      const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                      const options = this.getNodeParameter('options', i);
                      if (options.fields) {
                          qs.optional_properties = options.fields;
                      }
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', `/contacts/${contactId}`, {}, qs);
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      if (options.email) {
                          qs.email = options.email;
                      }
                      if (options.givenName) {
                          qs.given_name = options.givenName;
                      }
                      if (options.familyName) {
                          qs.family_name = options.familyName;
                      }
                      if (options.order) {
                          qs.order = options.order;
                      }
                      if (options.orderDirection) {
                          qs.order_direction = options.orderDirection;
                      }
                      if (options.since) {
                          qs.since = options.since;
                      }
                      if (options.until) {
                          qs.until = options.until;
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'contacts', 'GET', '/contacts', {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/contacts', {}, qs);
                          responseData = responseData.contacts;
                      }
                  }
              }
              if (resource === 'contactNote') {
                  if (operation === 'create') {
                      const userId = this.getNodeParameter('userId', i);
                      const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          user_id: userId,
                          contact_id: contactId,
                      };
                      (0, GenericFunctions_1.keysToSnakeCase)(additionalFields);
                      if (additionalFields.type) {
                          additionalFields.type = (0, change_case_1.pascalCase)(additionalFields.type);
                      }
                      Object.assign(body, additionalFields);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', '/notes', body);
                  }
                  if (operation === 'delete') {
                      const noteId = this.getNodeParameter('noteId', i);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'DELETE', `/notes/${noteId}`);
                      responseData = { success: true };
                  }
                  if (operation === 'get') {
                      const noteId = this.getNodeParameter('noteId', i);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', `/notes/${noteId}`);
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const filters = this.getNodeParameter('filters', i);
                      (0, GenericFunctions_1.keysToSnakeCase)(filters);
                      Object.assign(qs, filters);
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'notes', 'GET', '/notes', {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/notes', {}, qs);
                          responseData = responseData.notes;
                      }
                  }
                  if (operation === 'update') {
                      const noteId = this.getNodeParameter('noteId', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {};
                      (0, GenericFunctions_1.keysToSnakeCase)(additionalFields);
                      if (additionalFields.type) {
                          additionalFields.type = (0, change_case_1.pascalCase)(additionalFields.type);
                      }
                      Object.assign(body, additionalFields);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'PATCH', `/notes/${noteId}`, body);
                  }
              }
              if (resource === 'contactTag') {
                  if (operation === 'create') {
                      const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                      const tagIds = this.getNodeParameter('tagIds', i);
                      const body = {
                          tagIds,
                      };
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', `/contacts/${contactId}/tags`, body);
                  }
                  if (operation === 'delete') {
                      const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                      const tagIds = this.getNodeParameter('tagIds', i);
                      qs.ids = tagIds;
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'DELETE', `/contacts/${contactId}/tags`, {}, qs);
                      responseData = { success: true };
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'tags', 'GET', `/contacts/${contactId}/tags`, {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', `/contacts/${contactId}/tags`, {}, qs);
                          responseData = responseData.tags;
                      }
                  }
              }
              if (resource === 'ecommerceOrder') {
                  if (operation === 'create') {
                      const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                      const orderDate = this.getNodeParameter('orderDate', i);
                      const orderTitle = this.getNodeParameter('orderTitle', i);
                      const orderType = this.getNodeParameter('orderType', i);
                      const orderItems = this.getNodeParameter('orderItemsUi', i)
                          .orderItemsValues;
                      const shippingAddress = this.getNodeParameter('addressUi', i)
                          .addressValues;
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          contact_id: contactId,
                          order_date: orderDate,
                          order_title: orderTitle,
                          order_type: (0, change_case_1.pascalCase)(orderType),
                      };
                      if (additionalFields.promoCodes) {
                          additionalFields.promoCodes = additionalFields.promoCodes.split(',');
                      }
                      (0, GenericFunctions_1.keysToSnakeCase)(additionalFields);
                      Object.assign(body, additionalFields);
                      body.order_items = (0, GenericFunctions_1.keysToSnakeCase)(orderItems);
                      if (shippingAddress) {
                          body.shipping_address = (0, GenericFunctions_1.keysToSnakeCase)(shippingAddress)[0];
                      }
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', '/orders', body);
                  }
                  if (operation === 'delete') {
                      const orderId = parseInt(this.getNodeParameter('orderId', i), 10);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'DELETE', `/orders/${orderId}`);
                      responseData = { success: true };
                  }
                  if (operation === 'get') {
                      const orderId = parseInt(this.getNodeParameter('orderId', i), 10);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'get', `/orders/${orderId}`);
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const options = this.getNodeParameter('options', i);
                      (0, GenericFunctions_1.keysToSnakeCase)(options);
                      Object.assign(qs, options);
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'orders', 'GET', '/orders', {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/orders', {}, qs);
                          responseData = responseData.orders;
                      }
                  }
              }
              if (resource === 'ecommerceProduct') {
                  if (operation === 'create') {
                      const productName = this.getNodeParameter('productName', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          product_name: productName,
                      };
                      (0, GenericFunctions_1.keysToSnakeCase)(additionalFields);
                      Object.assign(body, additionalFields);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', '/products', body);
                  }
                  if (operation === 'delete') {
                      const productId = this.getNodeParameter('productId', i);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'DELETE', `/products/${productId}`);
                      responseData = { success: true };
                  }
                  if (operation === 'get') {
                      const productId = this.getNodeParameter('productId', i);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'get', `/products/${productId}`);
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const filters = this.getNodeParameter('filters', i);
                      (0, GenericFunctions_1.keysToSnakeCase)(filters);
                      Object.assign(qs, filters);
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'products', 'GET', '/products', {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/products', {}, qs);
                          responseData = responseData.products;
                      }
                  }
              }
              if (resource === 'email') {
                  if (operation === 'createRecord') {
                      const sentFromAddress = this.getNodeParameter('sentFromAddress', i);
                      const sendToAddress = this.getNodeParameter('sentToAddress', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          sent_to_address: sendToAddress,
                          sent_from_address: sentFromAddress,
                      };
                      Object.assign(body, additionalFields);
                      (0, GenericFunctions_1.keysToSnakeCase)(body);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', '/emails', body);
                  }
                  if (operation === 'deleteRecord') {
                      const emailRecordId = parseInt(this.getNodeParameter('emailRecordId', i), 10);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'DELETE', `/emails/${emailRecordId}`);
                      responseData = { success: true };
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const filters = this.getNodeParameter('filters', i);
                      (0, GenericFunctions_1.keysToSnakeCase)(filters);
                      Object.assign(qs, filters);
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'emails', 'GET', '/emails', {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/emails', {}, qs);
                          responseData = responseData.emails;
                      }
                  }
                  if (operation === 'send') {
                      const userId = this.getNodeParameter('userId', i);
                      const contactIds = this.getNodeParameter('contactIds', i)
                          .split(',')
                          .map((e) => parseInt(e, 10));
                      const subject = this.getNodeParameter('subject', i);
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      const body = {
                          user_id: userId,
                          contacts: contactIds,
                          subject,
                      };
                      (0, GenericFunctions_1.keysToSnakeCase)(additionalFields);
                      Object.assign(body, additionalFields);
                      const attachmentsUi = this.getNodeParameter('attachmentsUi', i);
                      let attachments = [];
                      if (attachmentsUi) {
                          if (attachmentsUi.attachmentsValues) {
                              (0, GenericFunctions_1.keysToSnakeCase)(attachmentsUi.attachmentsValues);
                              attachments = attachmentsUi.attachmentsValues;
                          }
                          const attachmentsBinary = attachmentsUi.attachmentsBinary;
                          if (attachmentsBinary === null || attachmentsBinary === void 0 ? void 0 : attachmentsBinary.length) {
                              for (const { property } of attachmentsBinary) {
                                  const binaryData = this.helpers.assertBinaryData(i, property);
                                  attachments.push({
                                      file_data: binaryData.data,
                                      file_name: binaryData.fileName,
                                  });
                              }
                          }
                          body.attachments = attachments;
                      }
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', '/emails/queue', body);
                      responseData = { success: true };
                  }
              }
              if (resource === 'file') {
                  if (operation === 'delete') {
                      const fileId = parseInt(this.getNodeParameter('fileId', i), 10);
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'DELETE', `/files/${fileId}`);
                      responseData = { success: true };
                  }
                  if (operation === 'getAll') {
                      const returnAll = this.getNodeParameter('returnAll', i);
                      const filters = this.getNodeParameter('filters', i);
                      (0, GenericFunctions_1.keysToSnakeCase)(filters);
                      Object.assign(qs, filters);
                      if (qs.permission) {
                          qs.permission = qs.permission.toUpperCase();
                      }
                      if (qs.type) {
                          qs.type = (0, change_case_1.capitalCase)(qs.type);
                      }
                      if (qs.viewable) {
                          qs.viewable = qs.viewable.toUpperCase();
                      }
                      if (returnAll) {
                          responseData = await GenericFunctions_1.keapApiRequestAllItems.call(this, 'files', 'GET', '/files', {}, qs);
                      }
                      else {
                          qs.limit = this.getNodeParameter('limit', i);
                          responseData = await GenericFunctions_1.keapApiRequest.call(this, 'GET', '/files', {}, qs);
                          responseData = responseData.files;
                      }
                  }
                  if (operation === 'upload') {
                      const fileAssociation = this.getNodeParameter('fileAssociation', i);
                      const isPublic = this.getNodeParameter('isPublic', i);
                      const body = {
                          is_public: isPublic,
                          file_association: fileAssociation.toUpperCase(),
                      };
                      if (fileAssociation === 'contact') {
                          const contactId = parseInt(this.getNodeParameter('contactId', i), 10);
                          body.contact_id = contactId;
                      }
                      if (this.getNodeParameter('binaryData', i)) {
                          const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                          const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
                          body.file_data = binaryData.data;
                          body.file_name = binaryData.fileName;
                      }
                      else {
                          const fileName = this.getNodeParameter('fileName', i);
                          const fileData = this.getNodeParameter('fileData', i);
                          body.file_name = fileName;
                          body.file_data = fileData;
                      }
                      responseData = await GenericFunctions_1.keapApiRequest.call(this, 'POST', '/files', body);
                  }
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.Keap = Keap;
  //# sourceMappingURL=Keap.node.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: Keap credentials
  description: Documentation for Keap credentials. Use these credentials to authenticate Keap in n8n, a workflow automation platform.
  contentType: [integration, reference]
  ---

  # Keap credentials

  You can use these credentials to authenticate the following nodes:

  - [Keap](/integrations/builtin/app-nodes/n8n-nodes-base.keap.md)
  - [Keap Trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.keaptrigger.md)

  ## Prerequisites

  Create a [Keap](https://developer.keap.com/){:target=_blank .external-link} developer account.

  ## Supported authentication methods

  - OAuth2

  ## Related resources

  Refer to Keap's [REST API documentation](https://developer.keap.com/docs/restv2/){:target=_blank .external-link} for more information about the service.

  ## Using OAuth2

  --8<-- "_snippets/integrations/builtin/credentials/cloud-oauth-button.md"

  If you need to configure OAuth2 from scratch or need more detail on what's happening in the OAuth web flow, refer to the instructions in the [Getting Started with OAuth2 documentation](https://developer.keap.com/getting-started-oauth-keys/){:target=_blank .external-link}.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"36ca67b0-4695-427d-87b2-59077d8464e3","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"024a70f1d60a8b2a4c803a5475a9802dbc339a2ed966a866a86edf963a6c311c"}}


node_type: n8n-nodes-base.KoBoToolbox
name: KoBoToolbox
display_name: KoBoToolbox
description: Work with KoBoToolbox forms and submissions
category: Other
code_hash: c9c4bb6871c6b52d5ab1470bb539737a94680fae02acf480bc6fb2b8b8c57a7f
documentation_url: https://docs.n8n.io/integrations/builtin/credentials/kobotoolbox
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:25
updated_at: 2025-06-08 08:05:25
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.KoBoToolbox = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const FormDescription_1 = require("./FormDescription");
  const SubmissionDescription_1 = require("./SubmissionDescription");
  const HookDescription_1 = require("./HookDescription");
  const FileDescription_1 = require("./FileDescription");
  class KoBoToolbox {
      constructor() {
          this.description = {
              displayName: 'KoBoToolbox',
              name: 'koBoToolbox',
              icon: 'file:koBoToolbox.svg',
              group: ['transform'],
              version: 1,
              description: 'Work with KoBoToolbox forms and submissions',
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              defaults: {
                  name: 'KoBoToolbox',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'koBoToolboxApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'File',
                              value: 'file',
                          },
                          {
                              name: 'Form',
                              value: 'form',
                          },
                          {
                              name: 'Hook',
                              value: 'hook',
                          },
                          {
                              name: 'Submission',
                              value: 'submission',
                          },
                      ],
                      default: 'submission',
                      required: true,
                  },
                  ...FormDescription_1.formOperations,
                  ...FormDescription_1.formFields,
                  ...HookDescription_1.hookOperations,
                  ...HookDescription_1.hookFields,
                  ...SubmissionDescription_1.submissionOperations,
                  ...SubmissionDescription_1.submissionFields,
                  ...FileDescription_1.fileOperations,
                  ...FileDescription_1.fileFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  loadForms: GenericFunctions_1.loadForms,
              },
          };
      }
      async execute() {
          var _a, _b, _c, _d, _e, _f;
          let responseData;
          let returnData = [];
          const binaryItems = [];
          const items = this.getInputData();
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < items.length; i++) {
              if (resource === 'form') {
                  if (operation === 'get') {
                      const formId = this.getNodeParameter('formId', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              url: `/api/v2/assets/${formId}`,
                          }),
                      ];
                  }
                  if (operation === 'getAll') {
                      const formQueryOptions = this.getNodeParameter('options', i);
                      const formFilterOptions = this.getNodeParameter('filters', i);
                      responseData = await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                          url: '/api/v2/assets/',
                          qs: {
                              limit: this.getNodeParameter('limit', i, 1000),
                              ...(formFilterOptions.filter && { q: formFilterOptions.filter }),
                              ...(((_b = (_a = formQueryOptions === null || formQueryOptions === void 0 ? void 0 : formQueryOptions.sort) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.ordering) && {
                                  ordering: (((_d = (_c = formQueryOptions === null || formQueryOptions === void 0 ? void 0 : formQueryOptions.sort) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.descending) ? '-' : '') +
                                      ((_f = (_e = formQueryOptions === null || formQueryOptions === void 0 ? void 0 : formQueryOptions.sort) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.ordering),
                              }),
                          },
                          scroll: this.getNodeParameter('returnAll', i),
                      });
                  }
                  if (operation === 'redeploy') {
                      const formId = this.getNodeParameter('formId', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              method: 'PATCH',
                              url: `/api/v2/assets/${formId}/deployment/`,
                          }),
                      ];
                  }
              }
              if (resource === 'submission') {
                  const formId = this.getNodeParameter('formId', i);
                  if (operation === 'getAll') {
                      const submissionQueryOptions = this.getNodeParameter('options', i);
                      const filterJson = this.getNodeParameter('filterJson', i, null);
                      responseData = await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                          url: `/api/v2/assets/${formId}/data/`,
                          qs: {
                              limit: this.getNodeParameter('limit', i, 1000),
                              ...(filterJson && { query: filterJson }),
                              ...(submissionQueryOptions.sort && { sort: submissionQueryOptions.sort }),
                              ...(submissionQueryOptions.fields && {
                                  fields: JSON.stringify((0, GenericFunctions_1.parseStringList)(submissionQueryOptions.fields)),
                              }),
                          },
                          scroll: this.getNodeParameter('returnAll', i),
                      });
                      if (submissionQueryOptions.reformat) {
                          responseData = responseData.map((submission) => {
                              return (0, GenericFunctions_1.formatSubmission)(submission, (0, GenericFunctions_1.parseStringList)(submissionQueryOptions.selectMask), (0, GenericFunctions_1.parseStringList)(submissionQueryOptions.numberMask));
                          });
                      }
                      if (submissionQueryOptions.download) {
                          for (const submission of responseData) {
                              binaryItems.push(await GenericFunctions_1.downloadAttachments.call(this, submission, submissionQueryOptions));
                          }
                      }
                  }
                  if (operation === 'get') {
                      const submissionId = this.getNodeParameter('submissionId', i);
                      const options = this.getNodeParameter('options', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              url: `/api/v2/assets/${formId}/data/${submissionId}`,
                              qs: {
                                  ...(options.fields && {
                                      fields: JSON.stringify((0, GenericFunctions_1.parseStringList)(options.fields)),
                                  }),
                              },
                          }),
                      ];
                      if (options.reformat) {
                          responseData = responseData.map((submission) => {
                              return (0, GenericFunctions_1.formatSubmission)(submission, (0, GenericFunctions_1.parseStringList)(options.selectMask), (0, GenericFunctions_1.parseStringList)(options.numberMask));
                          });
                      }
                      if (options.download) {
                          for (const submission of responseData) {
                              binaryItems.push(await GenericFunctions_1.downloadAttachments.call(this, submission, options));
                          }
                      }
                  }
                  if (operation === 'delete') {
                      const id = this.getNodeParameter('submissionId', i);
                      await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                          method: 'DELETE',
                          url: `/api/v2/assets/${formId}/data/${id}`,
                      });
                      responseData = [
                          {
                              success: true,
                          },
                      ];
                  }
                  if (operation === 'getValidation') {
                      const submissionId = this.getNodeParameter('submissionId', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              url: `/api/v2/assets/${formId}/data/${submissionId}/validation_status/`,
                          }),
                      ];
                  }
                  if (operation === 'setValidation') {
                      const submissionId = this.getNodeParameter('submissionId', i);
                      const status = this.getNodeParameter('validationStatus', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              method: 'PATCH',
                              url: `/api/v2/assets/${formId}/data/${submissionId}/validation_status/`,
                              body: {
                                  'validation_status.uid': status,
                              },
                          }),
                      ];
                  }
              }
              if (resource === 'hook') {
                  const formId = this.getNodeParameter('formId', i);
                  if (operation === 'getAll') {
                      responseData = await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                          url: `/api/v2/assets/${formId}/hooks/`,
                          qs: {
                              limit: this.getNodeParameter('limit', i, 1000),
                          },
                          scroll: this.getNodeParameter('returnAll', i),
                      });
                  }
                  if (operation === 'get') {
                      const hookId = this.getNodeParameter('hookId', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              url: `/api/v2/assets/${formId}/hooks/${hookId}`,
                          }),
                      ];
                  }
                  if (operation === 'retryAll') {
                      const hookId = this.getNodeParameter('hookId', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              method: 'PATCH',
                              url: `/api/v2/assets/${formId}/hooks/${hookId}/retry/`,
                          }),
                      ];
                  }
                  if (operation === 'getLogs') {
                      const hookId = this.getNodeParameter('hookId', i);
                      const startDate = this.getNodeParameter('startDate', i, null);
                      const endDate = this.getNodeParameter('endDate', i, null);
                      const status = this.getNodeParameter('status', i, null);
                      responseData = await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                          url: `/api/v2/assets/${formId}/hooks/${hookId}/logs/`,
                          qs: {
                              ...(startDate && { start: startDate }),
                              ...(endDate && { end: endDate }),
                              ...(status && { status }),
                          },
                      });
                  }
                  if (operation === 'retryOne') {
                      const hookId = this.getNodeParameter('hookId', i);
                      const logId = this.getNodeParameter('logId', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              method: 'PATCH',
                              url: `/api/v2/assets/${formId}/hooks/${hookId}/logs/${logId}/retry/`,
                          }),
                      ];
                  }
              }
              if (resource === 'file') {
                  const formId = this.getNodeParameter('formId', i);
                  if (operation === 'getAll') {
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              url: `/api/v2/assets/${formId}/files`,
                              qs: {
                                  file_type: 'form_media',
                              },
                              scroll: true,
                          }),
                      ];
                  }
                  if (operation === 'get') {
                      const fileId = this.getNodeParameter('fileId', i);
                      const download = this.getNodeParameter('download', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              url: `/api/v2/assets/${formId}/files/${fileId}`,
                          }),
                      ];
                      if ((responseData === null || responseData === void 0 ? void 0 : responseData[0]) && download) {
                          const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                          const binaryItem = {
                              json: responseData[0],
                              binary: {},
                          };
                          const response = await GenericFunctions_1.koBoToolboxRawRequest.call(this, {
                              url: `/api/v2/assets/${formId}/files/${fileId}/content`,
                              encoding: 'arraybuffer',
                          });
                          console.dir(response);
                          binaryItem.binary[binaryPropertyName] = await this.helpers.prepareBinaryData(response, responseData[0].metadata.filename);
                          binaryItems.push(binaryItem);
                      }
                  }
                  if (operation === 'delete') {
                      const fileId = this.getNodeParameter('fileId', i);
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              method: 'DELETE',
                              url: `/api/v2/assets/${formId}/files/${fileId}`,
                          }),
                      ];
                  }
                  if (operation === 'create') {
                      const fileMode = this.getNodeParameter('fileMode', i);
                      const body = {
                          description: 'Uploaded file',
                          file_type: 'form_media',
                      };
                      if ('binary' === fileMode) {
                          const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                          const item = items[i].binary;
                          const binaryData = item[binaryPropertyName];
                          body.base64Encoded = 'data:' + binaryData.mimeType + ';base64,' + binaryData.data;
                          body.metadata = {
                              filename: binaryData.fileName,
                          };
                      }
                      else {
                          const fileUrl = this.getNodeParameter('fileUrl', i);
                          body.metadata = {
                              redirect_url: fileUrl,
                          };
                      }
                      responseData = [
                          await GenericFunctions_1.koBoToolboxApiRequest.call(this, {
                              method: 'POST',
                              url: `/api/v2/assets/${formId}/files/`,
                              body,
                          }),
                      ];
                  }
              }
              returnData = returnData.concat(responseData);
          }
          return binaryItems.length > 0 ? [binaryItems] : [this.helpers.returnJsonArray(returnData)];
      }
  }
  exports.KoBoToolbox = KoBoToolbox;
  //# sourceMappingURL=KoBoToolbox.node.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: KoboToolbox credentials
  description: Documentation for KoboToolbox credentials. Use these credentials to authenticate KoboToolbox in n8n, a workflow automation platform.
  contentType: [integration, reference]
  ---

  # KoboToolbox credentials

  You can use these credentials to authenticate the following nodes:

  * [KoboToolbox trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.kobotoolboxtrigger.md)
  * [KoboToolbox](/integrations/builtin/app-nodes/n8n-nodes-base.kobotoolbox.md)

  ## Prerequisites

  Create a [KoboToolbox](https://www.kobotoolbox.org/){:target=_blank .external-link} account.

  ## Supported authentication methods

  - API token

  ## Related resources

  Refer to [KoboToolbox's API documentation](https://support.kobotoolbox.org/api.html){:target=_blank .external-link} for more information about the service.

  ## Using API token

  To configure this credential, you'll need:

  - An **API Root URL**: Enter the URL of the KoboToolbox server where you created your account. For the Global KoboToolbox Server, use `https://kf.kobotoolbox.org`. For the European Union KoboToolbox Server, use `https://eu.kobotoolbox.org`.
  - An **API Token**: Displayed in your **Account Settings**. Refer to [Getting your API token](https://support.kobotoolbox.org/api.html#getting-your-api-token){:target=_blank .external-link} for more information.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"e7e6fd0c-2d48-432d-bbac-46c34c590ae5","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"9aec2b81c1c1dabfb2d0a2eefaa6d65093b17098a24e6ca9dce659e09fde2886"}}


node_type: n8n-nodes-base.Kitemaker
name: Kitemaker
display_name: Kitemaker
description: Consume the Kitemaker GraphQL API
category: Other
code_hash: d77a6740a8ec5ce77b62d5069a0e2bd6349891c973f38cf5d4fc6242c854c0ba
documentation_url: https://docs.n8n.io/integrations/builtin/credentials/kitemaker
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:25
updated_at: 2025-06-08 08:05:25
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Kitemaker = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const descriptions_1 = require("./descriptions");
  const GenericFunctions_1 = require("./GenericFunctions");
  const queries_1 = require("./queries");
  const mutations_1 = require("./mutations");
  class Kitemaker {
      constructor() {
          this.description = {
              displayName: 'Kitemaker',
              name: 'kitemaker',
              icon: 'file:kitemaker.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
              description: 'Consume the Kitemaker GraphQL API',
              defaults: {
                  name: 'Kitemaker',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'kitemakerApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Organization',
                              value: 'organization',
                          },
                          {
                              name: 'Space',
                              value: 'space',
                          },
                          {
                              name: 'User',
                              value: 'user',
                          },
                          {
                              name: 'Work Item',
                              value: 'workItem',
                          },
                      ],
                      default: 'workItem',
                      required: true,
                  },
                  ...descriptions_1.organizationOperations,
                  ...descriptions_1.spaceOperations,
                  ...descriptions_1.spaceFields,
                  ...descriptions_1.userOperations,
                  ...descriptions_1.userFields,
                  ...descriptions_1.workItemOperations,
                  ...descriptions_1.workItemFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getLabels() {
                      const responseData = await GenericFunctions_1.kitemakerRequest.call(this, { query: queries_1.getLabels });
                      const { data: { organization: { spaces }, }, } = responseData;
                      return (0, GenericFunctions_1.createLoadOptions)(spaces[0].labels);
                  },
                  async getSpaces() {
                      const responseData = await GenericFunctions_1.kitemakerRequest.call(this, { query: queries_1.getSpaces });
                      const { data: { organization: { spaces }, }, } = responseData;
                      return (0, GenericFunctions_1.createLoadOptions)(spaces);
                  },
                  async getStatuses() {
                      const spaceId = this.getNodeParameter('spaceId', 0);
                      if (!spaceId.length) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Please choose a space to set for the work item to create.');
                      }
                      const responseData = await GenericFunctions_1.kitemakerRequest.call(this, { query: queries_1.getStatuses });
                      const { data: { organization: { spaces }, }, } = responseData;
                      const space = spaces.find((e) => e.id === spaceId);
                      return (0, GenericFunctions_1.createLoadOptions)(space.statuses);
                  },
                  async getUsers() {
                      const responseData = await GenericFunctions_1.kitemakerRequest.call(this, { query: queries_1.getUsers });
                      const { data: { organization: { users }, }, } = responseData;
                      return (0, GenericFunctions_1.createLoadOptions)(users);
                  },
                  async getWorkItems() {
                      const spaceId = this.getNodeParameter('spaceId', 0);
                      const responseData = await GenericFunctions_1.kitemakerRequest.call(this, {
                          query: queries_1.getWorkItems,
                          variables: { spaceId },
                      });
                      const { data: { workItems: { workItems }, }, } = responseData;
                      return (0, GenericFunctions_1.createLoadOptions)(workItems);
                  },
              },
          };
      }
      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++) {
              if (resource === 'organization') {
                  if (operation === 'get') {
                      responseData = await GenericFunctions_1.kitemakerRequest.call(this, {
                          query: queries_1.getOrganization,
                      });
                      responseData = responseData.data.organization;
                  }
              }
              else if (resource === 'space') {
                  if (operation === 'getAll') {
                      const allItems = await GenericFunctions_1.kitemakerRequestAllItems.call(this, {
                          query: queries_1.getAllSpaces,
                          variables: {},
                      });
                      responseData = allItems;
                  }
              }
              else if (resource === 'user') {
                  if (operation === 'getAll') {
                      const allItems = await GenericFunctions_1.kitemakerRequestAllItems.call(this, {
                          query: queries_1.getAllUsers,
                          variables: {},
                      });
                      responseData = allItems;
                  }
              }
              else if (resource === 'workItem') {
                  if (operation === 'create') {
                      const input = {
                          title: this.getNodeParameter('title', i),
                          statusId: this.getNodeParameter('statusId', i),
                      };
                      if (!input.statusId.length) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Please enter a status to set for the work item to create.', { itemIndex: i });
                      }
                      const additionalFields = this.getNodeParameter('additionalFields', i);
                      if (Object.keys(additionalFields).length) {
                          Object.assign(input, additionalFields);
                      }
                      responseData = await GenericFunctions_1.kitemakerRequest.call(this, {
                          query: mutations_1.createWorkItem,
                          variables: { input },
                      });
                      responseData = responseData.data.createWorkItem.workItem;
                  }
                  else if (operation === 'get') {
                      const workItemId = this.getNodeParameter('workItemId', i);
                      responseData = await GenericFunctions_1.kitemakerRequest.call(this, {
                          query: queries_1.getWorkItem,
                          variables: { workItemId },
                      });
                      responseData = responseData.data.workItem;
                  }
                  else if (operation === 'getAll') {
                      const allItems = await GenericFunctions_1.kitemakerRequestAllItems.call(this, {
                          query: queries_1.getAllWorkItems,
                          variables: {
                              spaceId: this.getNodeParameter('spaceId', i),
                          },
                      });
                      responseData = allItems;
                  }
                  else if (operation === 'update') {
                      const input = {
                          id: this.getNodeParameter('workItemId', i),
                      };
                      const updateFields = this.getNodeParameter('updateFields', i);
                      if (!Object.keys(updateFields).length) {
                          throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Please enter at least one field to update for the work item.', { itemIndex: i });
                      }
                      Object.assign(input, updateFields);
                      responseData = await GenericFunctions_1.kitemakerRequest.call(this, {
                          query: mutations_1.editWorkItem,
                          variables: { input },
                      });
                      responseData = responseData.data.editWorkItem.workItem;
                  }
              }
              const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
              returnData.push(...executionData);
          }
          return [returnData];
      }
  }
  exports.Kitemaker = Kitemaker;
  //# sourceMappingURL=Kitemaker.node.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: Kitemaker credentials
  description: Documentation for Kitemaker credentials. Use these credentials to authenticate Kitemaker in n8n, a workflow automation platform.
  contentType: [integration, reference]
  ---

  # Kitemaker credentials

  You can use these credentials to authenticate the following nodes:

  - [Kitemaker](/integrations/builtin/app-nodes/n8n-nodes-base.kitemaker.md)

  ## Prerequisites

  Create a [Kitemaker](https://www.kitemaker.co/){:target=_blank .external-link} account.

  ## Supported authentication methods

  - API access token

  ## Related resources

  Refer to [Kitemaker's API documentation](https://kitemakerhq.github.io/rest-docs/){:target=_blank .external-link} for more information about the service.

  ## Using API access token

  To configure this credential, you'll need:

  - A **Personal Access Token**: Generate a personal access token from **Manage > Developer settings**. Refer to [API Authentication](https://kitemakerhq.github.io/rest-docs/#documentationauthentication){:target=_blank .external-link} for more detailed instructions.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"94048411-cdd6-4da5-9b75-320c960ca419","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"dbdc1dcdd21d8b86cb19e158492e24b12c99186d98d2c43ba07350be46f97eea"}}


node_type: n8n-nodes-base.Ldap
name: Ldap
display_name: Ldap
description: Interact with LDAP servers
category: Other
code_hash: d672264081d30d100685786ddec6cc77a4750dd916eb833f83d2f27dd6ef18b2
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.ldap
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:25
updated_at: 2025-06-08 08:05:25
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Ldap = void 0;
  const n8n_workflow_1 = require("n8n-workflow");
  const ldapts_1 = require("ldapts");
  const LdapDescription_1 = require("./LdapDescription");
  const Helpers_1 = require("./Helpers");
  class Ldap {
      constructor() {
          this.description = {
              displayName: 'Ldap',
              name: 'ldap',
              icon: 'file:ldap.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Interact with LDAP servers',
              defaults: {
                  name: 'LDAP',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'ldap',
                      required: true,
                      testedBy: 'ldapConnectionTest',
                  },
              ],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Compare',
                              value: 'compare',
                              description: 'Compare an attribute',
                              action: 'Compare an attribute',
                          },
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a new entry',
                              action: 'Create a new entry',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete an entry',
                              action: 'Delete an entry',
                          },
                          {
                              name: 'Rename',
                              value: 'rename',
                              description: 'Rename the DN of an existing entry',
                              action: 'Rename the DN of an existing entry',
                          },
                          {
                              name: 'Search',
                              value: 'search',
                              description: 'Search LDAP',
                              action: 'Search LDAP',
                          },
                          {
                              name: 'Update',
                              value: 'update',
                              description: 'Update attributes',
                              action: 'Update attributes',
                          },
                      ],
                      default: 'search',
                  },
                  {
                      displayName: 'Debug',
                      name: 'nodeDebug',
                      type: 'boolean',
                      isNodeSetting: true,
                      default: false,
                      noDataExpression: true,
                  },
                  ...LdapDescription_1.ldapFields,
              ],
          };
          this.methods = {
              credentialTest: {
                  async ldapConnectionTest(credential) {
                      const credentials = credential.data;
                      const client = await (0, Helpers_1.createLdapClient)(credentials);
                      try {
                          await client.bind(credentials.bindDN, credentials.bindPassword);
                      }
                      catch (error) {
                          return {
                              status: 'Error',
                              message: error.message,
                          };
                      }
                      finally {
                          await client.unbind();
                      }
                      return {
                          status: 'OK',
                          message: 'Connection successful!',
                      };
                  },
              },
              loadOptions: {
                  async getAttributes() {
                      const credentials = await this.getCredentials('ldap');
                      const client = await (0, Helpers_1.createLdapClient)(credentials);
                      try {
                          await client.bind(credentials.bindDN, credentials.bindPassword);
                      }
                      catch (error) {
                          await client.unbind();
                          console.log(error);
                          return [];
                      }
                      let results;
                      const baseDN = this.getNodeParameter('baseDN', 0);
                      try {
                          results = await client.search(baseDN, { sizeLimit: 200, paged: false });
                      }
                      catch (error) {
                          console.log(error);
                          return [];
                      }
                      finally {
                          await client.unbind();
                      }
                      const unique = Object.keys(Object.assign({}, ...results.searchEntries));
                      return unique.map((x) => ({
                          name: x,
                          value: x,
                      }));
                  },
                  async getObjectClasses() {
                      const credentials = await this.getCredentials('ldap');
                      const client = await (0, Helpers_1.createLdapClient)(credentials);
                      try {
                          await client.bind(credentials.bindDN, credentials.bindPassword);
                      }
                      catch (error) {
                          await client.unbind();
                          console.log(error);
                          return [];
                      }
                      const baseDN = this.getNodeParameter('baseDN', 0);
                      let results;
                      try {
                          results = await client.search(baseDN, { sizeLimit: 10, paged: false });
                      }
                      catch (error) {
                          console.log(error);
                          return [];
                      }
                      finally {
                          await client.unbind();
                      }
                      const objects = [];
                      for (const entry of results.searchEntries) {
                          if (typeof entry.objectClass === 'string') {
                              objects.push(entry.objectClass);
                          }
                          else {
                              objects.push(...entry.objectClass);
                          }
                      }
                      const unique = [...new Set(objects)];
                      unique.push('custom');
                      const result = [];
                      for (const value of unique) {
                          if (value === 'custom') {
                              result.push({ name: 'custom', value: 'custom' });
                          }
                          else
                              result.push({ name: value, value: `(objectclass=${value})` });
                      }
                      return result;
                  },
                  async getAttributesForDn() {
                      const credentials = await this.getCredentials('ldap');
                      const client = await (0, Helpers_1.createLdapClient)(credentials);
                      try {
                          await client.bind(credentials.bindDN, credentials.bindPassword);
                      }
                      catch (error) {
                          await client.unbind();
                          console.log(error);
                          return [];
                      }
                      let results;
                      const baseDN = this.getNodeParameter('dn', 0);
                      try {
                          results = await client.search(baseDN, { sizeLimit: 1, paged: false });
                      }
                      catch (error) {
                          console.log(error);
                          return [];
                      }
                      finally {
                          await client.unbind();
                      }
                      const unique = Object.keys(Object.assign({}, ...results.searchEntries));
                      return unique.map((x) => ({
                          name: x,
                          value: x,
                      }));
                  },
              },
          };
      }
      async execute() {
          const nodeDebug = this.getNodeParameter('nodeDebug', 0);
          const items = this.getInputData();
          const returnItems = [];
          if (nodeDebug) {
              n8n_workflow_1.LoggerProxy.info(`[${this.getNode().type} | ${this.getNode().name}] - Starting with ${items.length} input items`);
          }
          const credentials = await this.getCredentials('ldap');
          const client = await (0, Helpers_1.createLdapClient)(credentials, nodeDebug, this.getNode().type, this.getNode().name);
          try {
              await client.bind(credentials.bindDN, credentials.bindPassword);
          }
          catch (error) {
              delete error.cert;
              await client.unbind();
              if (this.continueOnFail()) {
                  return [
                      items.map((x) => {
                          x.json.error = error.reason || 'LDAP connection error occurred';
                          return x;
                      }),
                  ];
              }
              else {
                  throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, {});
              }
          }
          const operation = this.getNodeParameter('operation', 0);
          for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
              try {
                  if (operation === 'compare') {
                      const dn = this.getNodeParameter('dn', itemIndex);
                      const attributeId = this.getNodeParameter('id', itemIndex);
                      const value = this.getNodeParameter('value', itemIndex, '');
                      const res = await client.compare(dn, attributeId, value);
                      returnItems.push({
                          json: { dn, attribute: attributeId, result: res },
                          pairedItem: { item: itemIndex },
                      });
                  }
                  else if (operation === 'create') {
                      const dn = this.getNodeParameter('dn', itemIndex);
                      const attributeFields = this.getNodeParameter('attributes', itemIndex);
                      const attributes = {};
                      if (Object.keys(attributeFields).length) {
                          attributeFields.attribute.map((attr) => {
                              attributes[attr.id] = attr.value;
                          });
                      }
                      await client.add(dn, attributes);
                      returnItems.push({
                          json: { dn, result: 'success' },
                          pairedItem: { item: itemIndex },
                      });
                  }
                  else if (operation === 'delete') {
                      const dn = this.getNodeParameter('dn', itemIndex);
                      await client.del(dn);
                      returnItems.push({
                          json: { dn, result: 'success' },
                          pairedItem: { item: itemIndex },
                      });
                  }
                  else if (operation === 'rename') {
                      const dn = this.getNodeParameter('dn', itemIndex);
                      const targetDn = this.getNodeParameter('targetDn', itemIndex);
                      await client.modifyDN(dn, targetDn);
                      returnItems.push({
                          json: { dn: targetDn, result: 'success' },
                          pairedItem: { item: itemIndex },
                      });
                  }
                  else if (operation === 'update') {
                      const dn = this.getNodeParameter('dn', itemIndex);
                      const attributes = this.getNodeParameter('attributes', itemIndex, {});
                      const changes = [];
                      for (const [action, attrs] of Object.entries(attributes)) {
                          attrs.map((attr) => changes.push(new ldapts_1.Change({
                              operation: action,
                              modification: new ldapts_1.Attribute({
                                  type: attr.id,
                                  values: [attr.value],
                              }),
                          })));
                      }
                      await client.modify(dn, changes);
                      returnItems.push({
                          json: { dn, result: 'success', changes },
                          pairedItem: { item: itemIndex },
                      });
                  }
                  else if (operation === 'search') {
                      const baseDN = this.getNodeParameter('baseDN', itemIndex);
                      let searchFor = this.getNodeParameter('searchFor', itemIndex);
                      const returnAll = this.getNodeParameter('returnAll', itemIndex);
                      const limit = this.getNodeParameter('limit', itemIndex, 0);
                      const options = this.getNodeParameter('options', itemIndex);
                      const pageSize = this.getNodeParameter('options.pageSize', itemIndex, 1000);
                      delete options.pageSize;
                      options.sizeLimit = returnAll ? 0 : limit;
                      if (pageSize) {
                          options.paged = { pageSize };
                      }
                      if (typeof options.attributes === 'string') {
                          options.attributes = options.attributes.split(',').map((attribute) => attribute.trim());
                      }
                      options.explicitBufferAttributes = Helpers_1.BINARY_AD_ATTRIBUTES;
                      if (searchFor === 'custom') {
                          searchFor = this.getNodeParameter('customFilter', itemIndex);
                      }
                      else {
                          const searchText = this.getNodeParameter('searchText', itemIndex);
                          const attribute = this.getNodeParameter('attribute', itemIndex);
                          searchFor = `(&${searchFor}(${attribute}=${searchText}))`;
                      }
                      searchFor = searchFor.replace(/\\\\/g, '\\5c');
                      searchFor = searchFor.replace(/\\\*/g, '\\2a');
                      searchFor = searchFor.replace(/\\\(/g, '\\28');
                      searchFor = searchFor.replace(/\\\)/g, '\\29');
                      options.filter = searchFor;
                      if (nodeDebug) {
                          n8n_workflow_1.LoggerProxy.info(`[${this.getNode().type} | ${this.getNode().name}] - Search Options ${JSON.stringify(options, null, 2)}`);
                      }
                      const results = await client.search(baseDN, options);
                      if (!returnAll) {
                          results.searchEntries = results.searchEntries.slice(0, limit);
                      }
                      (0, Helpers_1.resolveBinaryAttributes)(results.searchEntries);
                      returnItems.push.apply(returnItems, results.searchEntries.map((result) => ({
                          json: result,
                          pairedItem: { item: itemIndex },
                      })));
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnItems.push({ json: items[itemIndex].json, error, pairedItem: itemIndex });
                  }
                  else {
                      await client.unbind();
                      if (error.context) {
                          error.context.itemIndex = itemIndex;
                          throw error;
                      }
                      throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, {
                          itemIndex,
                      });
                  }
              }
          }
          if (nodeDebug) {
              n8n_workflow_1.LoggerProxy.info(`[${this.getNode().type} | ${this.getNode().name}] - Finished`);
          }
          await client.unbind();
          return [returnItems];
      }
  }
  exports.Ldap = Ldap;
  //# sourceMappingURL=Ldap.node.js.map

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

  # LDAP

  This node allows you to interact with your LDAP servers to create, find, and update objects.

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

  ## Operations

  * [**Compare**](#compare) an attribute
  * [**Create**](#create) a new entry
  * [**Delete**](#delete) an entry
  * [**Rename**](#rename) the DN of an existing entry
  * [**Search**](#search) LDAP
  * [**Update**](#update) attributes

  Refer to the sections below for details on configuring the node for each operation.

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

  ## Compare

  Configure this operation using these parameters:

  * **Credential to connect with**: Select or create an [LDAP credential](/integrations/builtin/credentials/ldap.md) to connect with.
  * **DN**: Enter the Distinguished Name (DN) of the entry to compare.
  * **Attribute ID**: Enter the ID of the attribute to compare.
  * **Value**: Enter the value to compare.

  ## Create

  Configure this operation using these parameters:

  * **Credential to connect with**: Select or create an [LDAP credential](/integrations/builtin/credentials/ldap.md) to connect with.
  * **DN**: Enter the Distinguished Name (DN) of the entry to create.
  * **Attributes**: Add the **Attribute ID**/**Value** pairs you'd like to create.

  ## Delete

  Configure this operation using these parameters:

  * **Credential to connect with**: Select or create an [LDAP credential](/integrations/builtin/credentials/ldap.md) to connect with.
  * **DN**: Enter the Distinguished Name (DN) of the entry to be deleted.

  ## Rename

  Configure this operation using these parameters:

  * **Credential to connect with**: Select or create an [LDAP credential](/integrations/builtin/credentials/ldap.md) to connect with.
  * **DN**: Enter the current Distinguished Name (DN) of the entry to rename.
  * **New DN**: Enter the new Distinguished Name (DN) for the entry in this field.

  ## Search

  Configure this operation using these parameters:

  * **Credential to connect with**: Select or create an [LDAP credential](/integrations/builtin/credentials/ldap.md) to connect with.
  * **Base DN**: Enter the Distinguished Name (DN) of the subtree to search in.
  * **Search For**: Select the directory object class to search for.
  * **Attribute**: Select the attribute to search for.
  * **Search Text**: Enter the text to search for. Use `*` for a wildcard.
  * **Return All**: When turned on, the node will return all results. When turned off, the node will return results up to the set **Limit**.
  * **Limit**: Only available when you turn off **Return All**. Enter the maximum number of results to return.

  ### Search options

  You can also configure this operation using these options:

  * **Attribute Names or IDs**: Enter a comma-separated list of attributes to return. Choose from the list or specify IDs using an expression.
  * **Page Size**: Enter the maximum number of results to request at one time. Set to 0 to disable paging.
  * **Scopes**: The set of entries at or below the **Base DN** to search for potential matches. Select from:
      * **Base Tree**: Often referred to as subordinateSubtree or just "subordinates," selecting this option will search the subordinates of the **Base DN** entry but not the **Base DN** entry itself.
      * **Single Level**: Often referred to as "one," selecting this option will search only the immediate children of the **Base DN** entry.
      * **Whole Subtree**: Often referred to as "sub," selecting this option will search the **Base DN** entry and all its subordinates to any depth.

  Refer to [The LDAP Search Operation](https://ldap.com/the-ldap-search-operation/){:target="_blank" .external-link} for more information on search scopes.

  ## Update

  Configure this operation using these parameters:

  * **Credential to connect with**: Select or create an [LDAP credential](/integrations/builtin/credentials/ldap.md) to connect with.
  * **DN**: Enter the Distinguished Name (DN) of the entry to update.
  * ***Update Attributes**: Select whether to **Add** new, **Remove** existing, or **Replace** existing attribute.
  * Then enter the **Attribute ID**/**Value** pair you'd like to update.

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"11d7c12d-d04a-4e59-8912-deb84bf87852","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"2504908089866b2830d5663c19891c6e182774a1309ec08a4d34590738167d9e"}}


node_type: n8n-nodes-base.Lemlist
name: Lemlist
display_name: Lemlist
description: Consume the Lemlist API
category: Other
code_hash: 874dd1c1de4d3bc41d4acb8e78a610448f7e2fbf0025090f94cbed80261b1fa8
documentation_url: https://docs.n8n.io/integrations/builtin/credentials/lemlist
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 08:05:25
updated_at: 2025-06-08 08:05:25
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.Lemlist = void 0;
  const descriptions_1 = require("./descriptions");
  const GenericFunctions_1 = require("./GenericFunctions");
  const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
  const omit_1 = __importDefault(require("lodash/omit"));
  class Lemlist {
      constructor() {
          this.description = {
              displayName: 'Lemlist',
              name: 'lemlist',
              icon: 'file:lemlist.svg',
              group: ['transform'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume the Lemlist API',
              defaults: {
                  name: 'Lemlist',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'lemlistApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Activity',
                              value: 'activity',
                          },
                          {
                              name: 'Campaign',
                              value: 'campaign',
                          },
                          {
                              name: 'Lead',
                              value: 'lead',
                          },
                          {
                              name: 'Team',
                              value: 'team',
                          },
                          {
                              name: 'Unsubscribe',
                              value: 'unsubscribe',
                          },
                      ],
                      default: 'activity',
                  },
                  ...descriptions_1.activityOperations,
                  ...descriptions_1.activityFields,
                  ...descriptions_1.campaignOperations,
                  ...descriptions_1.campaignFields,
                  ...descriptions_1.leadOperations,
                  ...descriptions_1.leadFields,
                  ...descriptions_1.teamOperations,
                  ...descriptions_1.teamFields,
                  ...descriptions_1.unsubscribeOperations,
                  ...descriptions_1.unsubscribeFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getCampaigns() {
                      const campaigns = await GenericFunctions_1.lemlistApiRequest.call(this, 'GET', '/campaigns');
                      return campaigns.map(({ _id, name }) => ({
                          name,
                          value: _id,
                      }));
                  },
              },
          };
      }
      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 === 'activity') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const qs = {};
                          const filters = this.getNodeParameter('filters', i);
                          if (!(0, isEmpty_1.default)(filters)) {
                              Object.assign(qs, filters);
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.lemlistApiRequestAllItems.call(this, 'GET', '/activities', qs);
                          }
                          else {
                              qs.limit = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'GET', '/activities', {}, qs);
                          }
                      }
                  }
                  else if (resource === 'campaign') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.lemlistApiRequestAllItems.call(this, 'GET', '/campaigns', {});
                          }
                          else {
                              const qs = {
                                  limit: this.getNodeParameter('limit', i),
                              };
                              responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'GET', '/campaigns', {}, qs);
                          }
                      }
                  }
                  else if (resource === 'lead') {
                      if (operation === 'create') {
                          const qs = {};
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          if (additionalFields.deduplicate !== undefined) {
                              qs.deduplicate = additionalFields.deduplicate;
                          }
                          const body = {};
                          const remainingAdditionalFields = (0, omit_1.default)(additionalFields, 'deduplicate');
                          if (!(0, isEmpty_1.default)(remainingAdditionalFields)) {
                              Object.assign(body, remainingAdditionalFields);
                          }
                          const campaignId = this.getNodeParameter('campaignId', i);
                          const email = this.getNodeParameter('email', i);
                          const endpoint = `/campaigns/${campaignId}/leads/${email}`;
                          responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'POST', endpoint, body, qs);
                      }
                      else if (operation === 'delete') {
                          const campaignId = this.getNodeParameter('campaignId', i);
                          const email = this.getNodeParameter('email', i);
                          const endpoint = `/campaigns/${campaignId}/leads/${email}`;
                          responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'DELETE', endpoint, {}, { action: 'remove' });
                      }
                      else if (operation === 'get') {
                          const email = this.getNodeParameter('email', i);
                          responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'GET', `/leads/${email}`);
                      }
                      else if (operation === 'unsubscribe') {
                          const campaignId = this.getNodeParameter('campaignId', i);
                          const email = this.getNodeParameter('email', i);
                          const endpoint = `/campaigns/${campaignId}/leads/${email}`;
                          responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'DELETE', endpoint);
                      }
                  }
                  else if (resource === 'team') {
                      if (operation === 'get') {
                          responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'GET', '/team');
                      }
                  }
                  else if (resource === 'unsubscribe') {
                      if (operation === 'add') {
                          const email = this.getNodeParameter('email', i);
                          responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'POST', `/unsubscribes/${email}`);
                      }
                      else if (operation === 'delete') {
                          const email = this.getNodeParameter('email', i);
                          responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'DELETE', `/unsubscribes/${email}`);
                      }
                      else if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.lemlistApiRequestAllItems.call(this, 'GET', '/unsubscribes', {});
                          }
                          else {
                              const qs = {
                                  limit: this.getNodeParameter('limit', i),
                              };
                              responseData = await GenericFunctions_1.lemlistApiRequest.call(this, 'GET', '/unsubscribes', {}, qs);
                          }
                      }
                  }
              }
              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.Lemlist = Lemlist;
  //# sourceMappingURL=Lemlist.node.js.map

documentation_markdown:
  ---
  #https://www.notion.so/n8n/Frontmatter-432c2b8dff1f43d4b1c8d20075510fe4
  title: Lemlist credentials
  description: Documentation for Lemlist credentials. Use these credentials to authenticate Lemlist in n8n, a workflow automation platform.
  contentType: [integration, reference]
  ---

  # Lemlist credentials

  You can use these credentials to authenticate the following nodes:

  - [Lemlist](/integrations/builtin/app-nodes/n8n-nodes-base.lemlist.md)
  - [Lemlist Trigger](/integrations/builtin/trigger-nodes/n8n-nodes-base.lemlisttrigger.md)

  ## Prerequisites

  Create an account on a [Lemlist](https://www.lemlist.com/){:target=_blank .external-link} instance.

  ## Supported authentication methods

  - API key

  ## Related resources

  Refer to [Lemlist's API documentation](https://developer.lemlist.com/){:target=_blank .external-link} for more information about the service.

  ## Using API key

  To configure this credential, you'll need:

  - An **API Key**: Access your API key in **Settings > Integrations**. Refer to the [API Authentication documentation](https://developer.lemlist.com/#authentication){:target=_blank .external-link} for more information.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"4dbb5a78-6b15-4641-84ea-1a96f966f908","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"3fc0d987310abafd345b1c18b40ff312f7ab4fc15ce9fbf2ef9b4abd644a90a9"}}


