# nodes

node_type: n8n-nodes-base.Intercom
name: Intercom
display_name: Intercom
description: Consume Intercom API
category: output
icon: file:intercom.png
code_hash: be4c08e687ac6d523ea522d1b9f22155077485762de518664618a8a40f427844
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.intercom
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:05
updated_at: 2025-06-08 09:18:05
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 node documentation
  description: Learn how to use the Intercom node in n8n. Follow technical documentation to integrate Intercom node into your workflows.
  contentType: [integration, reference]
  ---

  # Intercom node

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

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

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

  ## Operations

  * Company
      * Create a new company
      * Get data of a company
      * Get data of all companies
      * Update a company
      * List company's users
  * Lead
      * Create a new lead
      * Delete a lead
      * Get data of a lead
      * Get data of all leads
      * Update new lead
  * User
      * Create a new user
      * Delete a user
      * Get data of a user
      * Get data of all users
      * Update a user

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"2a56951c-28fd-4d7a-92ce-37bd3208cfef","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"01e011c7a54158e437c0a9bbb86f534c0c1c24dd278bf534af07fb3a8425fdb3"}}


node_type: n8n-nodes-base.InvoiceNinja
name: InvoiceNinja
display_name: Invoice Ninja
description: Consume Invoice Ninja API
category: output
icon: file:invoiceNinja.svg
code_hash: e826788255190576d2864bc51ab1a171463e343e67140ef1c5119c78e49acd8f
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.invoiceninjatrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
extracted_at: 2025-06-08 09:18:05
updated_at: 2025-06-08 09:18:05
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 Trigger node documentation
  description: Learn how to use the Invoice Ninja Trigger node in n8n. Follow technical documentation to integrate Invoice Ninja Trigger node into your workflows.
  contentType: [integration, reference]
  ---

  # Invoice Ninja Trigger node

  [Invoice Ninja](https://www.invoiceninja.com/){:target=_blank .external-link} is a free open-source online invoicing app for freelancers & businesses. It offers invoicing, payments, expense tracking, & time-tasks.

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

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"cd84b063-0bdf-44df-8346-ff8d3034e8a6","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"c803b7b3a1ddb3de28f84ce905d33bb44294e758e190f1f1070e1a79121d28a9"}}


node_type: n8n-nodes-base.Hunter
name: Hunter
display_name: Hunter
description: Consume Hunter API
category: output
icon: file:hunter.png
code_hash: 51c8bda9ec8694acf0c9362ae3c4ede9dc8e3fcf9b20e8b4d42731ce83b2c983
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.hunter
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:05
updated_at: 2025-06-08 09:18:05
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 node documentation
  description: Learn how to use the Hunter node in n8n. Follow technical documentation to integrate Hunter node into your workflows.
  contentType: [integration, reference]
  ---

  # Hunter node

  Use the Hunter node to automate work in Hunter, and integrate Hunter with other applications. n8n has built-in support for a wide range of Hunter features, including getting, generating, and verifying email addresses. 

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

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

  ## Operations

  * Get every email address found on the internet using a given domain name, with sources
  * Generate or retrieve the most likely email address from a domain name, a first name and a last name
  * Verify the deliverability of an email address

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"4ae9699a-3201-475c-81ca-ce80ac608221","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"cd7f9914a91c67b7b411a33f2b77d89b431de9055bd0a75f94818d88ebe52ff8"}}


node_type: n8n-nodes-base.Jenkins
name: Jenkins
display_name: Jenkins
description: Consume Jenkins API
category: output
icon: file:jenkins.svg
code_hash: f2cc66998d1891568379ae5503e6ad1467a505ba3e06e5df8209d990381c015e
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.jenkins
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:06
updated_at: 2025-06-08 09:18:06
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 node documentation
  description: Learn how to use the Jenkins node in n8n. Follow technical documentation to integrate Jenkins node into your workflows.
  contentType: [integration, reference]
  ---

  # Jenkins node

  Use the Jenkins node to automate work in Jenkins, and integrate Jenkins with other applications. n8n has built-in support for a wide range of Jenkins features, including listing builds, managing instances, and creating and copying jobs. 

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

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

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

  ## Operations

  * Build
      * List Builds
  * Instance
      * Cancel quiet down state
      * Put Jenkins in quiet mode, no builds can be started, Jenkins is ready for shutdown
      * Restart Jenkins immediately on environments where it's possible
      * Restart Jenkins once no jobs are running on environments where it's possible
      * Shutdown once no jobs are running
      * Shutdown Jenkins immediately
  * Job
      * Copy a specific job
      * Create a new job
      * Trigger a specific job
      * Trigger a specific job

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"e122b811-f215-4f3a-b331-4787eeb48acc","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"2e2ad6aeb81c9b8d7f0e52f538dd6229e6088ac304e0f9dc65eceab7ac230a9f"}}


node_type: n8n-nodes-base.Jira
name: Jira
display_name: Jira Software
description: Consume Jira Software API
category: output
icon: file:jira.svg
code_hash: 4e93fa0d77ac1881853591e98dea6a0effa65338c59c3a2097a06ff8c8d34278
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.jiratrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:06
updated_at: 2025-06-08 09:18:06
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 Trigger node documentation
  description: Learn how to use the Jira Trigger node in n8n. Follow technical documentation to integrate Jira Trigger node into your workflows.
  contentType: [integration, reference]
  priority: medium
  ---

  # Jira Trigger node

  [Jira](https://www.atlassian.com/software/jira){:target=_blank .external-link} is a proprietary issue tracking product developed by Atlassian that allows bug tracking and agile project management.

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

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"a8a24a3d-8cf3-41d2-859e-2ac4fb29c451","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"7a236c07fe2667eb0c0ec3fa3fd874f3d3ae4ccb3e0c0cfb48a94f1c70c64714"}}


node_type: n8n-nodes-base.Iterable
name: Iterable
display_name: Iterable
description: Consume Iterable API
category: input
icon: file:iterable.png
code_hash: a25bf56399e021962735e8a204bbfbeb4be8a9760a2650eb2534acd7ffed11d6
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.iterable
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:06
updated_at: 2025-06-08 09:18:06
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 node documentation
  description: Learn how to use the Iterable node in n8n. Follow technical documentation to integrate Iterable node into your workflows.
  contentType: [integration, reference]
  ---

  # Iterable node

  Use the Iterable node to automate work in Iterable, and integrate Iterable with other applications. n8n has built-in support for a wide range of Iterable features, including creating users, recording the actions performed by the users, and adding and removing users from the list. 

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

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

  ## Operations

  * Event
      * Record the actions a user perform
  * User
      * Create/Update a user
      * Delete a user
      * Get a user
  * User List
      * Add user to list
      * Remove a user from a list

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"9608c0e8-a98a-4548-acb9-2276995d8663","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"ff6080a00d5fe69509d73a45f3c85d774555c9ec510208211c06e25943cd09c8"}}


node_type: n8n-nodes-base.Keap
name: Keap
display_name: Keap
description: Consume Keap API
category: input
icon: file:keap.png
code_hash: 6edbc9075b37a91bd9f057729c08aa0d1296fdd8316a1790b34ba81da790c32e
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.keaptrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:06
updated_at: 2025-06-08 09:18:06
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 Trigger node documentation
  description: Learn how to use the Keap Trigger node in n8n. Follow technical documentation to integrate Keap Trigger node into your workflows.
  contentType: [integration, reference]
  ---

  # Keap Trigger node

  [Keap](https://keap.com/){:target=_blank .external-link} is an e-mail marketing and sales platform for small businesses, including products to manage and optimize the customer lifecycle, customer relationship management, marketing automation, lead capture, and e-commerce.

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

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"658ab2ab-c775-410e-b3eb-bbae02446aab","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"31b55405ef1f912c8e7b08a05ed4a1b0239d2f2daf39e3646b2ce71aa7c27b04"}}


node_type: n8n-nodes-base.Kafka
name: Kafka
display_name: Kafka
description: Sends messages to a Kafka topic
category: transform
icon: file:kafka.svg
code_hash: 74c45cee3cedf2f42356b732d5025dcedca4654fe4a2c472ffc62e2d27715f7f
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.kafkatrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:06
updated_at: 2025-06-08 09:18:06
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 Trigger node documentation
  description: Learn how to use the Kafka Trigger node in n8n. Follow technical documentation to integrate Kafka Trigger node into your workflows.
  contentType: [integration, reference]
  priority: medium
  ---

  # Kafka Trigger node

  [Kafka](https://kafka.apache.org/){:target=_blank .external-link} is an open-source distributed event streaming platform that one can use for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications.

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

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"8e0ef322-f0c7-4453-a818-ddaffae582ee","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"6e23d01713e275a445bbb7b422f7a8e1e283d740c0658dad412a52dce708117b"}}


node_type: n8n-nodes-base.Lemlist
name: Lemlist
display_name: Lemlist
description: Consume the Lemlist API
category: transform
icon: file:lemlist.svg
code_hash: 874dd1c1de4d3bc41d4acb8e78a610448f7e2fbf0025090f94cbed80261b1fa8
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.lemlisttrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:08
updated_at: 2025-06-08 09:18:08
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 Trigger node documentation
  description: Learn how to use the Lemlist Trigger node in n8n. Follow technical documentation to integrate Lemlist Trigger node into your workflows.
  contentType: [integration, reference]
  ---

  # Lemlist Trigger node

  [Lemlist](https://Lemlist.com){:target=_blank .external-link} is an email outreach platform that allows you to automatically generate personalized images and videos and send personalized cold emails.

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

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

  ## Events

  <!-- vale Vale.Spelling = NO -->
  - *
  - Aircall Created
  - Aircall Done
  - Aircall Ended
  - Aircall Interested
  - Aircall Not Interested
  - Api Done
  - Api Failed
  - Api Interested
  - Api Not Interested
  - Attracted
  - Connection Issue
  - Contacted
  - Custom Domain Errors
  - Emails Bounced
  - Emails Clicked
  - Emails Failed
  - Emails Interested
  - Emails Not Interested
  - Emails Opened
  - Emails Replied
  - Emails Send Failed
  - Emails Sent
  - Emails Unsubscribed
  - Hooked
  - Interested
  - Lemwarm Paused
  - LinkedIn Interested
  - LinkedIn Invite Accepted
  - LinkedIn Invite Done
  - LinkedIn Invite Failed
  - LinkedIn Not Interested
  - LinkedIn Replied
  - LinkedIn Send Failed
  - LinkedIn Sent
  - LinkedIn Visit Done
  - LinkedIn Visit Failed
  - LinkedIn Voice Note Done
  - LinkedIn Voice Note Failed
  - Manual Interested
  - Manual Not Interested
  - Not Interested
  - Opportunities Done
  - Paused
  - Resumed
  - Send Limit Reached
  - Skipped
  - Warmed
  <!-- vale Vale.Spelling = YES -->

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"3ea38c53-4459-4a29-8406-9d52daa811d4","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"932b7ce3dcfef48b34fb1a40c4f3081aab37cf6fa7b386785a3b90b6fe91a339"}}


node_type: n8n-nodes-base.Ldap
name: Ldap
display_name: Ldap
description: Interact with LDAP servers
category: transform
icon: file:ldap.svg
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
version: 1.0
extracted_at: 2025-06-08 09:18:08
updated_at: 2025-06-08 09:18:08
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":"cc0b7ad7-4d65-4c87-89cd-bb0c9449bc35","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"548e48d84f558d4bb37a897c17acd874aa4af11fa00bc304ac2be4fa30e15959"}}


node_type: n8n-nodes-base.KoBoToolbox
name: KoBoToolbox
display_name: KoBoToolbox
description: Work with KoBoToolbox forms and submissions
category: transform
icon: file:koBoToolbox.svg
code_hash: c9c4bb6871c6b52d5ab1470bb539737a94680fae02acf480bc6fb2b8b8c57a7f
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.kobotoolboxtrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:08
updated_at: 2025-06-08 09:18:08
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 Trigger node documentation
  description: Learn how to use the KoboToolbox Trigger node in n8n. Follow technical documentation to integrate KoboToolbox Trigger node into your workflows.
  contentType: [integration, reference]
  ---

  # KoboToolbox Trigger node

  [KoboToolbox](https://www.kobotoolbox.org/){:target=_blank .external-link} is a field survey and data collection tool to design interactive forms to be completed offline from mobile devices. It's available both as a free cloud solution or as a self-hosted version.

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

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

  This node starts a workflow upon new submissions of a specified form. The trigger node handles the creation/deletion of the hook, so you don't need to do any setup in KoboToolbox.

  It works the same way as the Get Submission operation in the [KoboToolbox](/integrations/builtin/app-nodes/n8n-nodes-base.kobotoolbox.md) node, including supporting the same reformatting options.

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"ea078603-621a-4b56-8d05-e9f152674c73","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"e618bf2a08ec54386e014be6ee046183afdd475b40bbaa2694f3ee788e4f82f0"}}


node_type: n8n-nodes-base.Linear
name: Linear
display_name: Linear
description: Consume Linear API
category: output
icon: file:linear.svg
code_hash: 03a0ceb98ba3b2007d39314f83e4819bde871064bef40846749d33477a352ed5
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.lineartrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:08
updated_at: 2025-06-08 09:18:08
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Linear = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const IssueDescription_1 = require("./IssueDescription");
  const Queries_1 = require("./Queries");
  class Linear {
      constructor() {
          this.description = {
              displayName: 'Linear',
              name: 'linear',
              icon: 'file:linear.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Linear API',
              defaults: {
                  name: 'Linear',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'linearApi',
                      required: true,
                      testedBy: 'linearApiTest',
                      displayOptions: {
                          show: {
                              authentication: ['apiToken'],
                          },
                      },
                  },
                  {
                      name: 'linearOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth2'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'API Token',
                              value: 'apiToken',
                          },
                          {
                              name: 'OAuth2',
                              value: 'oAuth2',
                          },
                      ],
                      default: 'apiToken',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Issue',
                              value: 'issue',
                          },
                      ],
                      default: 'issue',
                  },
                  ...IssueDescription_1.issueOperations,
                  ...IssueDescription_1.issueFields,
              ],
          };
          this.methods = {
              credentialTest: {
                  async linearApiTest(credential) {
                      try {
                          await GenericFunctions_1.validateCredentials.call(this, credential.data);
                      }
                      catch (error) {
                          const { error: err } = error;
                          const errors = err.errors;
                          const authenticationError = Boolean(errors.filter((e) => e.extensions.code === 'AUTHENTICATION_ERROR').length);
                          if (authenticationError) {
                              return {
                                  status: 'Error',
                                  message: 'The security token included in the request is invalid',
                              };
                          }
                      }
                      return {
                          status: 'OK',
                          message: 'Connection successful!',
                      };
                  },
              },
              loadOptions: {
                  async getTeams() {
                      const returnData = [];
                      const body = {
                          query: Queries_1.query.getTeams(),
                          variables: {
                              $first: 10,
                          },
                      };
                      const teams = await GenericFunctions_1.linearApiRequestAllItems.call(this, 'data.teams', body);
                      for (const team of teams) {
                          returnData.push({
                              name: team.name,
                              value: team.id,
                          });
                      }
                      return returnData;
                  },
                  async getUsers() {
                      const returnData = [];
                      const body = {
                          query: Queries_1.query.getUsers(),
                          variables: {
                              $first: 10,
                          },
                      };
                      const users = await GenericFunctions_1.linearApiRequestAllItems.call(this, 'data.users', body);
                      for (const user of users) {
                          returnData.push({
                              name: user.name,
                              value: user.id,
                          });
                      }
                      return returnData;
                  },
                  async getStates() {
                      var _a, _b, _c;
                      let teamId = this.getNodeParameter('teamId', null);
                      if (!teamId) {
                          const updateFields = this.getNodeParameter('updateFields', null);
                          if (!updateFields.teamId) {
                              const issueId = this.getNodeParameter('issueId');
                              const body = {
                                  query: Queries_1.query.getIssueTeam(),
                                  variables: {
                                      issueId,
                                  },
                              };
                              const responseData = await GenericFunctions_1.linearApiRequest.call(this, body);
                              teamId = (_c = (_b = (_a = responseData === null || responseData === void 0 ? void 0 : responseData.data) === null || _a === void 0 ? void 0 : _a.issue) === null || _b === void 0 ? void 0 : _b.team) === null || _c === void 0 ? void 0 : _c.id;
                          }
                          else {
                              teamId = updateFields.teamId;
                          }
                      }
                      const returnData = [];
                      const body = {
                          query: Queries_1.query.getStates(),
                          variables: {
                              $first: 10,
                              filter: {
                                  team: {
                                      id: {
                                          eq: teamId,
                                      },
                                  },
                              },
                          },
                      };
                      const states = await GenericFunctions_1.linearApiRequestAllItems.call(this, 'data.workflowStates', body);
                      for (const state of states) {
                          returnData.push({
                              name: state.name,
                              value: state.id,
                          });
                      }
                      return returnData.sort(GenericFunctions_1.sort);
                  },
              },
          };
      }
      async execute() {
          var _a, _b, _c, _d;
          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 === 'issue') {
                      if (operation === 'create') {
                          const teamId = this.getNodeParameter('teamId', i);
                          const title = this.getNodeParameter('title', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              query: Queries_1.query.createIssue(),
                              variables: {
                                  teamId,
                                  title,
                                  ...additionalFields,
                              },
                          };
                          responseData = await GenericFunctions_1.linearApiRequest.call(this, body);
                          responseData = (_a = responseData.data.issueCreate) === null || _a === void 0 ? void 0 : _a.issue;
                      }
                      if (operation === 'delete') {
                          const issueId = this.getNodeParameter('issueId', i);
                          const body = {
                              query: Queries_1.query.deleteIssue(),
                              variables: {
                                  issueId,
                              },
                          };
                          responseData = await GenericFunctions_1.linearApiRequest.call(this, body);
                          responseData = (_b = responseData === null || responseData === void 0 ? void 0 : responseData.data) === null || _b === void 0 ? void 0 : _b.issueDelete;
                      }
                      if (operation === 'get') {
                          const issueId = this.getNodeParameter('issueId', i);
                          const body = {
                              query: Queries_1.query.getIssue(),
                              variables: {
                                  issueId,
                              },
                          };
                          responseData = await GenericFunctions_1.linearApiRequest.call(this, body);
                          responseData = responseData.data.issue;
                      }
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const body = {
                              query: Queries_1.query.getIssues(),
                              variables: {
                                  first: 50,
                              },
                          };
                          if (returnAll) {
                              responseData = await GenericFunctions_1.linearApiRequestAllItems.call(this, 'data.issues', body);
                          }
                          else {
                              const limit = this.getNodeParameter('limit', 0);
                              body.variables.first = limit;
                              responseData = await GenericFunctions_1.linearApiRequest.call(this, body);
                              responseData = responseData.data.issues.nodes;
                          }
                      }
                      if (operation === 'update') {
                          const issueId = this.getNodeParameter('issueId', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const body = {
                              query: Queries_1.query.updateIssue(),
                              variables: {
                                  issueId,
                                  ...updateFields,
                              },
                          };
                          responseData = await GenericFunctions_1.linearApiRequest.call(this, body);
                          responseData = (_d = (_c = responseData === null || responseData === void 0 ? void 0 : responseData.data) === null || _c === void 0 ? void 0 : _c.issueUpdate) === null || _d === void 0 ? void 0 : _d.issue;
                      }
                  }
                  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.Linear = Linear;
  //# sourceMappingURL=Linear.node.js.map

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

  # Linear Trigger node

  [Linear](https://linear.app/){:target=_blank .external-link} is a SaaS issue tracking tool.

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

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

  ## Events

  - Comment Reaction
  - Cycle
  - Issue
  - Issue Comment
  - Issue Label
  - Project

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"15008ddb-c0bd-4b2c-be62-b2525508cf17","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"ff4b7296e7d31933b3d7a0bb1d489773cf755156ea99bd9dccae3112002e8efa"}}


node_type: n8n-nodes-base.Line
name: Line
display_name: Line
description: Consume Line API
category: input
icon: file:line.png
code_hash: c8d8b4834af3201e0b176fa5da6263bbb5882a92e7a82b42f8d86470310e9fda
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.lineartrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:08
updated_at: 2025-06-08 09:18:08
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.Line = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const NotificationDescription_1 = require("./NotificationDescription");
  class Line {
      constructor() {
          this.description = {
              displayName: 'Line',
              name: 'line',
              icon: 'file:line.png',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Line API',
              defaults: {
                  name: 'Line',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'lineNotifyOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['notification'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Notification',
                              value: 'notification',
                          },
                      ],
                      default: 'notification',
                  },
                  ...NotificationDescription_1.notificationOperations,
                  ...NotificationDescription_1.notificationFields,
              ],
          };
      }
      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 === 'notification') {
                      if (operation === 'send') {
                          const message = this.getNodeParameter('message', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          const body = {
                              message,
                          };
                          Object.assign(body, additionalFields);
                          if (body.hasOwnProperty('notificationDisabled')) {
                              body.notificationDisabled = body.notificationDisabled ? 'true' : 'false';
                          }
                          if (body.stickerUi) {
                              const sticker = body.stickerUi.stickerValue;
                              if (sticker) {
                                  body.stickerId = sticker.stickerId;
                                  body.stickerPackageId = sticker.stickerPackageId;
                              }
                              delete body.stickerUi;
                          }
                          if (body.imageUi) {
                              const image = body.imageUi.imageValue;
                              if (image && image.binaryData === true) {
                                  const binaryProperty = image.binaryProperty;
                                  const binaryData = this.helpers.assertBinaryData(i, binaryProperty);
                                  const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty);
                                  body.imageFile = {
                                      value: binaryDataBuffer,
                                      options: {
                                          filename: binaryData.fileName,
                                      },
                                  };
                              }
                              else {
                                  body.imageFullsize = image.imageFullsize;
                                  body.imageThumbnail = image.imageThumbnail;
                              }
                              delete body.imageUi;
                          }
                          responseData = await GenericFunctions_1.lineApiRequest.call(this, 'POST', '', {}, {}, 'https://notify-api.line.me/api/notify', { formData: body });
                      }
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                  returnData.push(...executionData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionErrorData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionErrorData);
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.Line = Line;
  //# sourceMappingURL=Line.node.js.map

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

  # Linear Trigger node

  [Linear](https://linear.app/){:target=_blank .external-link} is a SaaS issue tracking tool.

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

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

  ## Events

  - Comment Reaction
  - Cycle
  - Issue
  - Issue Comment
  - Issue Label
  - Project

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"951c20f5-aa67-48a5-975e-cfc991281ccc","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"5826827ae0dadc24dc204a1a3ac65cc5c1568602c78eca05b33f86a6b8d5a9b8"}}


node_type: n8n-nodes-base.LingvaNex
name: LingvaNex
display_name: LingvaNex
description: Consume LingvaNex API
category: output
icon: file:lingvanex.png
code_hash: 29d29315fd6ef3b4f9454e49bfcd822bf94f31464bab1c11b494288d33fce502
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.lingvanex
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:08
updated_at: 2025-06-08 09:18:08
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.LingvaNex = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  class LingvaNex {
      constructor() {
          this.description = {
              displayName: 'LingvaNex',
              name: 'lingvaNex',
              icon: 'file:lingvanex.png',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume LingvaNex API',
              defaults: {
                  name: 'LingvaNex',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'lingvaNexApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Translate',
                              value: 'translate',
                              description: 'Translate data',
                              action: 'Translate data',
                          },
                      ],
                      default: 'translate',
                  },
                  {
                      displayName: 'Text',
                      name: 'text',
                      type: 'string',
                      default: '',
                      description: 'The input text to translate',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['translate'],
                          },
                      },
                  },
                  {
                      displayName: 'Translate To',
                      name: 'translateTo',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLanguages',
                      },
                      default: '',
                      description: 'The language to use for translation of the input text, set to one of the language codes listed in <a href="https://cloud.google.com/translate/docs/languages">Language Support</a>. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['translate'],
                          },
                      },
                  },
                  {
                      displayName: 'Additional Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['translate'],
                          },
                      },
                      options: [
                          {
                              displayName: 'From',
                              name: 'from',
                              type: 'options',
                              typeOptions: {
                                  loadOptionsMethod: 'getLanguages',
                              },
                              default: '',
                              description: 'The language code in the format “language code_code of the country”. If this parameter is not present, the auto-detect language mode is enabled. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'Platform',
                              name: 'platform',
                              type: 'string',
                              default: 'api',
                          },
                          {
                              displayName: 'Translate Mode',
                              name: 'translateMode',
                              type: 'string',
                              default: '',
                              description: 'Describe the input text format. Possible value is "html" for translating and preserving html structure. If value is not specified or is other than "html" than plain text is translating.',
                          },
                      ],
                  },
              ],
          };
          this.methods = {
              loadOptions: {
                  async getLanguages() {
                      const returnData = [];
                      const data = await GenericFunctions_1.lingvaNexApiRequest.call(this, 'GET', '/getLanguages', {}, { platform: 'api' });
                      for (const language of data.result) {
                          returnData.push({
                              name: language.englishName,
                              value: language.full_code,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const length = items.length;
          const operation = this.getNodeParameter('operation', 0);
          const responseData = [];
          for (let i = 0; i < length; i++) {
              if (operation === 'translate') {
                  const text = this.getNodeParameter('text', i);
                  const translateTo = this.getNodeParameter('translateTo', i);
                  const options = this.getNodeParameter('options', i);
                  const body = {
                      data: text,
                      to: translateTo,
                      platform: 'api',
                  };
                  Object.assign(body, options);
                  const response = await GenericFunctions_1.lingvaNexApiRequest.call(this, 'POST', '/translate', body);
                  responseData.push(response);
              }
          }
          return [this.helpers.returnJsonArray(responseData)];
      }
  }
  exports.LingvaNex = LingvaNex;
  //# sourceMappingURL=LingvaNex.node.js.map

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

  # LingvaNex node

  Use the LingvaNex node to automate work in LingvaNex, and integrate LingvaNex with other applications. n8n has built-in support for translating data with LingvaNex.

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

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

  ## Operations

  - Translate data

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"a0f6b52c-d72d-4ba6-bb61-3cbb2f2a5a1a","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"3bd5df2ff1c57d4d0543fe3835ea8673e43301bca1c9bdeea24a15cefc7dd778"}}


node_type: n8n-nodes-base.Kitemaker
name: Kitemaker
display_name: Kitemaker
description: Consume the Kitemaker GraphQL API
category: input
icon: file:kitemaker.svg
code_hash: d77a6740a8ec5ce77b62d5069a0e2bd6349891c973f38cf5d4fc6242c854c0ba
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.kitemaker
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:08
updated_at: 2025-06-08 09:18:08
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 node documentation
  description: Learn how to use the Kitemaker node in n8n. Follow technical documentation to integrate Kitemaker node into your workflows.
  contentType: [integration, reference]
  ---

  # Kitemaker node

  Use the Kitemaker node to automate work in Kitemaker, and integrate Kitemaker with other applications. n8n has built-in support for a wide range of Kitemaker features, including retrieving data on organizations, spaces and users, as well as creating, getting, and updating work items. 

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

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

  ## Operations

  * Organization
      * Retrieve data on the logged-in user's organization.
  * Space
      * Retrieve data on all the spaces in the logged-in user's organization.
  * User
      * Retrieve data on all the users in the logged-in user's organization.
  * Work Item
      * Create
      * Get
      * Get All
      * Update

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"ce2ca140-8356-4776-9d49-4f98623ed49f","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"add054fe084a4c8299b0d583ac0d84bece1844358853f03d6dc1d84085e83c54"}}


node_type: n8n-nodes-base.LinkedIn
name: LinkedIn
display_name: LinkedIn
description: Consume LinkedIn API
category: input
icon: file:linkedin.svg
code_hash: 1148fe37efdd5c3bbaee912c4f44399c3e83f8a16501e9aaa0ad2ba84214b8ef
documentation_url: https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.linkedin
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:10
updated_at: 2025-06-08 09:18:10
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.LinkedIn = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const PostDescription_1 = require("./PostDescription");
  class LinkedIn {
      constructor() {
          this.description = {
              displayName: 'LinkedIn',
              name: 'linkedIn',
              icon: 'file:linkedin.svg',
              group: ['input'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume LinkedIn API',
              defaults: {
                  name: 'LinkedIn',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'linkedInOAuth2Api',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Post',
                              value: 'post',
                          },
                      ],
                      default: 'post',
                  },
                  ...PostDescription_1.postOperations,
                  ...PostDescription_1.postFields,
              ],
          };
          this.methods = {
              loadOptions: {
                  async getPersonUrn() {
                      const returnData = [];
                      const person = await GenericFunctions_1.linkedInApiRequest.call(this, 'GET', '/me', {});
                      returnData.push({
                          name: `${person.localizedFirstName} ${person.localizedLastName}`,
                          value: person.id,
                      });
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          let responseData;
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          let body = {};
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'post') {
                      if (operation === 'create') {
                          const text = this.getNodeParameter('text', i);
                          const shareMediaCategory = this.getNodeParameter('shareMediaCategory', i);
                          const postAs = this.getNodeParameter('postAs', i);
                          const additionalFields = this.getNodeParameter('additionalFields', i);
                          let authorUrn = '';
                          let visibility = 'PUBLIC';
                          if (postAs === 'person') {
                              const personUrn = this.getNodeParameter('person', i);
                              visibility = additionalFields.visibility || 'PUBLIC';
                              authorUrn = `urn:li:person:${personUrn}`;
                          }
                          else {
                              const organizationUrn = this.getNodeParameter('organization', i);
                              authorUrn = `urn:li:organization:${organizationUrn}`;
                          }
                          let description = '';
                          let title = '';
                          let originalUrl = '';
                          body = {
                              author: authorUrn,
                              lifecycleState: 'PUBLISHED',
                              distribution: {
                                  feedDistribution: 'MAIN_FEED',
                                  thirdPartyDistributionChannels: [],
                              },
                              visibility,
                          };
                          if (shareMediaCategory === 'IMAGE') {
                              if (additionalFields.title) {
                                  title = additionalFields.title;
                              }
                              const registerRequest = {
                                  initializeUploadRequest: {
                                      owner: authorUrn,
                                  },
                              };
                              const registerObject = await GenericFunctions_1.linkedInApiRequest.call(this, 'POST', '/images?action=initializeUpload', registerRequest);
                              const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
                              this.helpers.assertBinaryData(i, binaryPropertyName);
                              const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
                              const { uploadUrl, image } = registerObject.value;
                              await GenericFunctions_1.linkedInApiRequest.call(this, 'POST', uploadUrl, buffer, true);
                              const imageBody = {
                                  content: {
                                      media: {
                                          title,
                                          id: image,
                                      },
                                  },
                                  commentary: text,
                              };
                              Object.assign(body, imageBody);
                          }
                          else if (shareMediaCategory === 'ARTICLE') {
                              if (additionalFields.description) {
                                  description = additionalFields.description;
                              }
                              if (additionalFields.title) {
                                  title = additionalFields.title;
                              }
                              if (additionalFields.originalUrl) {
                                  originalUrl = additionalFields.originalUrl;
                              }
                              const articleBody = {
                                  content: {
                                      article: {
                                          title,
                                          description,
                                          source: originalUrl,
                                      },
                                  },
                                  commentary: text,
                              };
                              Object.assign(body, articleBody);
                              if (description === '') {
                                  delete body.description;
                              }
                              if (title === '') {
                                  delete body.title;
                              }
                          }
                          else {
                              Object.assign(body, { commentary: text });
                          }
                          const endpoint = '/posts';
                          responseData = await GenericFunctions_1.linkedInApiRequest.call(this, 'POST', endpoint, body);
                      }
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                  returnData.push(...executionData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionData);
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.LinkedIn = LinkedIn;
  //# sourceMappingURL=LinkedIn.node.js.map

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

  # LinkedIn node

  Use the LinkedIn node to automate work in LinkedIn, and integrate LinkedIn with other applications. n8n supports creating posts.

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

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

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

  ## Operations

  * Post
      * Create

  ## Parameters

  * **Post As**: choose whether to post as a **Person** or **Organization**.
  * **Person Name or ID** and **Organization URN**: enter an identifier for the person or organization.

  	/// note | Posting as organization
  	If posting as an Organization enter the organization number in the URN field. For example, `03262013` not `urn:li:company:03262013`.
  	///
  	
  * **Text**: the post contents.
  * **Media Category**: use this when including images or article URLs in your post.

  ## Templates and examples

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

  ## Related resources

  Refer to [LinkedIn's API documentation](https://learn.microsoft.com/en-us/linkedin/){:target=_blank .external-link} for more information about the service.

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"898627e2-66d5-4a33-8c02-8eb0bac76206","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"7642fcda04082310b5f052424a5f08353629be686d2c008eceda2565ca72b18b"}}


node_type: n8n-nodes-base.LocalFileTrigger
name: LocalFileTrigger
display_name: Local File Trigger
description: Triggers a workflow on file system changes
category: trigger
icon: fa:folder-open
code_hash: 0b091f165d93567d21a8b943d4cab4e6fd20ccf85e00e1d733456047688a0737
documentation_url: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.localfiletrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:10
updated_at: 2025-06-08 09:18:10
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.LocalFileTrigger = void 0;
  const chokidar_1 = require("chokidar");
  class LocalFileTrigger {
      constructor() {
          this.description = {
              displayName: 'Local File Trigger',
              name: 'localFileTrigger',
              icon: 'fa:folder-open',
              group: ['trigger'],
              version: 1,
              subtitle: '=Path: {{$parameter["path"]}}',
              description: 'Triggers a workflow on file system changes',
              eventTriggerDescription: '',
              defaults: {
                  name: 'Local File Trigger',
                  color: '#404040',
              },
              triggerPanel: {
                  header: '',
                  executionsHelp: {
                      inactive: "<b>While building your workflow</b>, click the 'listen' button, then make a change to your watched file or folder. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Once you're happy with your workflow</b>, <a data-key='activate'>activate</a> it. Then every time a change is detected, the workflow will execute. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.",
                      active: "<b>While building your workflow</b>, click the 'listen' button, then make a change to your watched file or folder. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Your workflow will also execute automatically</b>, since it's activated. Every time a change is detected, this node will trigger an execution. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.",
                  },
                  activationHint: "Once you’ve finished building your workflow, <a data-key='activate'>activate</a> it to have it also listen continuously (you just won’t see those executions here).",
              },
              inputs: [],
              outputs: ['main'],
              properties: [
                  {
                      displayName: 'Trigger On',
                      name: 'triggerOn',
                      type: 'options',
                      options: [
                          {
                              name: 'Changes to a Specific File',
                              value: 'file',
                          },
                          {
                              name: 'Changes Involving a Specific Folder',
                              value: 'folder',
                          },
                      ],
                      required: true,
                      default: '',
                  },
                  {
                      displayName: 'File to Watch',
                      name: 'path',
                      type: 'string',
                      displayOptions: {
                          show: {
                              triggerOn: ['file'],
                          },
                      },
                      default: '',
                      placeholder: '/data/invoices/1.pdf',
                  },
                  {
                      displayName: 'Folder to Watch',
                      name: 'path',
                      type: 'string',
                      displayOptions: {
                          show: {
                              triggerOn: ['folder'],
                          },
                      },
                      default: '',
                      placeholder: '/data/invoices',
                  },
                  {
                      displayName: 'Watch for',
                      name: 'events',
                      type: 'multiOptions',
                      displayOptions: {
                          show: {
                              triggerOn: ['folder'],
                          },
                      },
                      options: [
                          {
                              name: 'File Added',
                              value: 'add',
                              description: 'Triggers whenever a new file was added',
                          },
                          {
                              name: 'File Changed',
                              value: 'change',
                              description: 'Triggers whenever a file was changed',
                          },
                          {
                              name: 'File Deleted',
                              value: 'unlink',
                              description: 'Triggers whenever a file was deleted',
                          },
                          {
                              name: 'Folder Added',
                              value: 'addDir',
                              description: 'Triggers whenever a new folder was added',
                          },
                          {
                              name: 'Folder Deleted',
                              value: 'unlinkDir',
                              description: 'Triggers whenever a folder was deleted',
                          },
                      ],
                      required: true,
                      default: [],
                      description: 'The events to listen to',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      options: [
                          {
                              displayName: 'Include Linked Files/Folders',
                              name: 'followSymlinks',
                              type: 'boolean',
                              default: true,
                              description: 'Whether linked files/folders will also be watched (this includes symlinks, aliases on MacOS and shortcuts on Windows). Otherwise only the links themselves will be monitored).',
                          },
                          {
                              displayName: 'Ignore',
                              name: 'ignored',
                              type: 'string',
                              default: '',
                              placeholder: '**/*.txt',
                              description: 'Files or paths to ignore. The whole path is tested, not just the filename. Supports <a href="https://github.com/micromatch/anymatch">Anymatch</a>- syntax.',
                          },
                          {
                              displayName: 'Max Folder Depth',
                              name: 'depth',
                              type: 'options',
                              options: [
                                  {
                                      name: '1 Levels Down',
                                      value: 1,
                                  },
                                  {
                                      name: '2 Levels Down',
                                      value: 2,
                                  },
                                  {
                                      name: '3 Levels Down',
                                      value: 3,
                                  },
                                  {
                                      name: '4 Levels Down',
                                      value: 4,
                                  },
                                  {
                                      name: '5 Levels Down',
                                      value: 5,
                                  },
                                  {
                                      name: 'Top Folder Only',
                                      value: 0,
                                  },
                                  {
                                      name: 'Unlimited',
                                      value: -1,
                                  },
                              ],
                              default: -1,
                              description: 'How deep into the folder structure to watch for changes',
                          },
                      ],
                  },
              ],
          };
      }
      async trigger() {
          const triggerOn = this.getNodeParameter('triggerOn');
          const path = this.getNodeParameter('path');
          const options = this.getNodeParameter('options', {});
          let events;
          if (triggerOn === 'file') {
              events = ['change'];
          }
          else {
              events = this.getNodeParameter('events', []);
          }
          const watcher = (0, chokidar_1.watch)(path, {
              ignored: options.ignored === '' ? undefined : options.ignored,
              persistent: true,
              ignoreInitial: true,
              followSymlinks: options.followSymlinks === undefined ? true : options.followSymlinks,
              depth: [-1, undefined].includes(options.depth)
                  ? undefined
                  : options.depth,
          });
          const executeTrigger = (event, pathString) => {
              this.emit([this.helpers.returnJsonArray([{ event, path: pathString }])]);
          };
          for (const eventName of events) {
              watcher.on(eventName, (pathString) => executeTrigger(eventName, pathString));
          }
          async function closeFunction() {
              return watcher.close();
          }
          return {
              closeFunction,
          };
      }
  }
  exports.LocalFileTrigger = LocalFileTrigger;
  //# sourceMappingURL=LocalFileTrigger.node.js.map

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

  # Local File Trigger node

  The Local File Trigger node starts a workflow when it detects changes on the file system. These changes involve a file or folder getting added, changed, or deleted.

  /// note | Self-hosted n8n only
  This node isn't available on n8n Cloud.
  ///

  ## Node parameters

  You can choose what event to watch for using the **Trigger On** parameter.

  ## Changes to a Specific File

  The node triggers when the specified file changes.

  Enter the path for the file to watch in **File to Watch**.

  ## Changes Involving a Specific Folder

  The node triggers when a change occurs in the selected folder.

  Configure these parameters:

  - **Folder to Watch**: Enter the path of the folder to watch.
  - **Watch for**: Select the type of change to watch for.


  ## Node options

  Use the node **Options** to include or exclude files and folders.

  - **Include Linked Files/Folders**: also watch for changes to linked files or folders.
  - **Ignore**: files or paths to ignore. n8n tests the whole path, not just the filename. Supports the [Anymatch](https://github.com/micromatch/anymatch){:target=_blank .external-link} syntax.
  - **Max Folder Depth**: how deep into the folder structure to watch for changes.

  ### Examples for Ignore

  Ignore a single file:

  ```sh
  **/<fileName>.<suffix>
  # For example, **/myfile.txt
  ```

  Ignore a sub-directory of a directory you're watching:

  ```sh
  **/<directoryName>/**
  # For example, **/myDirectory/**
  ```

  ## Templates and examples

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"93bc8f92-4b78-411f-ae3c-d397421815be","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"8e0df810a53b105255b8b138dce3f6e039b43f95c75d97a0518bf39209a441bb"}}


node_type: n8n-nodes-base.LoneScale
name: LoneScale
display_name: LoneScale
description: Create List, add / delete items
category: transform
icon: file:lonescale-logo.svg
code_hash: 87192faf002fbba84590b3c3dd0d367a26378865321adb7fd5cf70349fec00e3
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.lonescaletrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:10
updated_at: 2025-06-08 09:18:10
source_code:
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.LoneScale = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  class LoneScale {
      constructor() {
          this.description = {
              displayName: 'LoneScale',
              name: 'loneScale',
              group: ['transform'],
              icon: 'file:lonescale-logo.svg',
              version: 1,
              description: 'Create List, add / delete items',
              subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
              defaults: {
                  name: 'LoneScale',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'loneScaleApi',
                      required: true,
                  },
              ],
              properties: [
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      options: [
                          {
                              name: 'List',
                              value: 'list',
                              description: 'Manipulate list',
                          },
                          {
                              name: 'Item',
                              value: 'item',
                              description: 'Manipulate item',
                          },
                      ],
                      default: 'list',
                      noDataExpression: true,
                      required: true,
                      description: 'Create a new list',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      displayOptions: {
                          show: {
                              resource: ['list'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a list',
                              action: 'Create a list',
                          },
                      ],
                      default: 'create',
                      noDataExpression: true,
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      displayOptions: {
                          show: {
                              resource: ['item'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'add',
                              description: 'Create an item',
                              action: 'Create a item',
                          },
                      ],
                      default: 'add',
                      noDataExpression: true,
                  },
                  {
                      displayName: 'Type',
                      name: 'type',
                      type: 'options',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['item'],
                          },
                      },
                      options: [
                          {
                              name: 'Company',
                              value: 'COMPANY',
                              description: 'List of company',
                          },
                          {
                              name: 'Contact',
                              value: 'PEOPLE',
                              description: 'List of contact',
                          },
                      ],
                      default: 'PEOPLE',
                      description: 'Type of your list',
                      noDataExpression: true,
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      displayOptions: {
                          show: {
                              resource: ['item'],
                          },
                      },
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                          loadOptionsDependsOn: ['type'],
                      },
                      default: '',
                      description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>',
                      required: true,
                  },
                  {
                      displayName: 'First Name',
                      name: 'first_name',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['add'],
                              resource: ['item'],
                              type: ['PEOPLE'],
                          },
                      },
                      default: '',
                      description: 'Contact first name',
                      required: true,
                  },
                  {
                      displayName: 'Last Name',
                      name: 'last_name',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['add'],
                              resource: ['item'],
                              type: ['PEOPLE'],
                          },
                      },
                      default: '',
                      description: 'Contact last name',
                      required: true,
                  },
                  {
                      displayName: 'Company Name',
                      name: 'company_name',
                      type: 'string',
                      displayOptions: {
                          show: {
                              operation: ['add'],
                              resource: ['item'],
                              type: ['COMPANY'],
                          },
                      },
                      default: '',
                      description: 'Contact company name',
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'peopleAdditionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['add'],
                              resource: ['item'],
                              type: ['PEOPLE'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Full Name',
                              name: 'full_name',
                              type: 'string',
                              default: '',
                              description: 'Contact full name',
                          },
                          {
                              displayName: 'Contact Email',
                              name: 'email',
                              type: 'string',
                              placeholder: 'name@email.com',
                              default: '',
                          },
                          {
                              displayName: 'Company Name',
                              name: 'company_name',
                              type: 'string',
                              default: '',
                              description: 'Contact company name',
                          },
                          {
                              displayName: 'Current Position',
                              name: 'current_position',
                              type: 'string',
                              default: '',
                              description: 'Contact current position',
                          },
                          {
                              displayName: 'Company Domain',
                              name: 'domain',
                              type: 'string',
                              default: '',
                              description: 'Contact company domain',
                          },
                          {
                              displayName: 'Linkedin Url',
                              name: 'linkedin_url',
                              type: 'string',
                              default: '',
                              description: 'Contact Linkedin URL',
                          },
                          {
                              displayName: 'Contact Location',
                              name: 'location',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'Contact ID',
                              name: 'contact_id',
                              type: 'string',
                              default: '',
                              description: 'Contact ID from your source',
                          },
                      ],
                  },
                  {
                      displayName: 'Additional Fields',
                      name: 'companyAdditionalFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              operation: ['add'],
                              resource: ['item'],
                              type: ['COMPANY'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Linkedin Url',
                              name: 'linkedin_url',
                              type: 'string',
                              default: '',
                              description: 'Company Linkedin URL',
                          },
                          {
                              displayName: 'Company Domain',
                              name: 'domain',
                              type: 'string',
                              default: '',
                              description: 'Company company domain',
                          },
                          {
                              displayName: 'Contact Location',
                              name: 'location',
                              type: 'string',
                              default: '',
                          },
                          {
                              displayName: 'Contact ID',
                              name: 'contact_id',
                              type: 'string',
                              default: '',
                              description: 'Contact ID from your source',
                          },
                      ],
                  },
                  {
                      displayName: 'Name',
                      name: 'name',
                      type: 'string',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['list'],
                          },
                      },
                      default: '',
                      placeholder: 'list name',
                      description: 'Name of your list',
                  },
                  {
                      displayName: 'Type',
                      name: 'type',
                      type: 'options',
                      required: true,
                      displayOptions: {
                          show: {
                              operation: ['create'],
                              resource: ['list'],
                          },
                      },
                      options: [
                          {
                              name: 'Company',
                              value: 'COMPANY',
                              description: 'Create a list of companies',
                              action: 'Create a list of companies',
                          },
                          {
                              name: 'Contact',
                              value: 'PEOPLE',
                              description: 'Create a list of contacts',
                              action: 'Create a list of contacts',
                          },
                      ],
                      default: 'COMPANY',
                      description: 'Type of your list',
                      noDataExpression: true,
                  },
              ],
          };
          this.methods = {
              loadOptions: {
                  async getLists() {
                      var _a;
                      const type = this.getNodeParameter('type');
                      const data = await GenericFunctions_1.lonescaleApiRequest.call(this, 'GET', '/lists', {}, { entity: type });
                      return (_a = data === null || data === void 0 ? void 0 : data.list) === null || _a === void 0 ? void 0 : _a.filter((l) => l.entity === type).map((d) => ({
                          name: d.name,
                          value: d.id,
                      }));
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          let responseData;
          const returnData = [];
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < items.length; i++) {
              try {
                  if (resource === 'list') {
                      if (operation === 'create') {
                          const name = this.getNodeParameter('name', i);
                          const entity = this.getNodeParameter('type', i);
                          const body = {
                              name,
                              entity,
                          };
                          responseData = await GenericFunctions_1.lonescaleApiRequest.call(this, 'POST', '/lists', body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                  }
                  if (resource === 'item') {
                      if (operation === 'add') {
                          let firstName = '';
                          let lastName = '';
                          let currentPosition = '';
                          let fullName = '';
                          let email = '';
                          let linkedinUrl = '';
                          let companyName = '';
                          let domain = '';
                          let location = '';
                          let contactId = '';
                          const entity = this.getNodeParameter('type', i);
                          const listId = this.getNodeParameter('list', i);
                          if (entity === 'PEOPLE') {
                              const peopleAdditionalFields = this.getNodeParameter('peopleAdditionalFields', i);
                              firstName = this.getNodeParameter('first_name', i);
                              lastName = this.getNodeParameter('last_name', i);
                              fullName = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.full_name;
                              currentPosition = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.current_position;
                              email = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.email;
                              linkedinUrl = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.linkedin_url;
                              companyName = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.company_name;
                              domain = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.domain;
                              location = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.location;
                              contactId = peopleAdditionalFields === null || peopleAdditionalFields === void 0 ? void 0 : peopleAdditionalFields.contact_id;
                          }
                          if (entity === 'COMPANY') {
                              const companyAdditionalFields = this.getNodeParameter('companyAdditionalFields', i);
                              companyName = this.getNodeParameter('company_name', i);
                              linkedinUrl = companyAdditionalFields === null || companyAdditionalFields === void 0 ? void 0 : companyAdditionalFields.linkedin_url;
                              domain = companyAdditionalFields === null || companyAdditionalFields === void 0 ? void 0 : companyAdditionalFields.domain;
                              location = companyAdditionalFields === null || companyAdditionalFields === void 0 ? void 0 : companyAdditionalFields.location;
                              contactId = companyAdditionalFields === null || companyAdditionalFields === void 0 ? void 0 : companyAdditionalFields.contact_id;
                          }
                          const body = {
                              ...(firstName && { first_name: firstName }),
                              ...(lastName && { last_name: lastName }),
                              ...(fullName && { full_name: fullName }),
                              ...(linkedinUrl && { linkedin_url: linkedinUrl }),
                              ...(companyName && { company_name: companyName }),
                              ...(currentPosition && { current_position: currentPosition }),
                              ...(domain && { domain }),
                              ...(location && { location }),
                              ...(email && { email }),
                              ...(contactId && { contact_id: contactId }),
                          };
                          responseData = await GenericFunctions_1.lonescaleApiRequest.call(this, 'POST', `/lists/${listId}/item`, body);
                          const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                          returnData.push(...executionData);
                      }
                  }
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray({ error: error.message }), { itemData: { item: i } });
                      returnData.push(...executionData);
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.LoneScale = LoneScale;
  //# sourceMappingURL=LoneScale.node.js.map

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

  # LoneScale Trigger node

  Use the LoneScale Trigger node to respond to workflow events in [LoneScale](https://www.lonescale.com/){:target=_blank .external-link} and integrate LoneScale with other applications.

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

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

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

  ## Events

  - On new LoneScale event

  ## Related resources

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

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"c748b820-3a2e-419c-a6d5-92430ec843ad","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"8c63dfb3892dd2aec17e49cbfe2055f331add40a2453fad3ed12901544d3081e"}}


node_type: n8n-nodes-base.Mailchimp
name: Mailchimp
display_name: Mailchimp
description: Consume Mailchimp API
category: output
icon: file:mailchimp.svg
code_hash: f2caad087950dacb0627fb1424523c92a542b7bedb79535d47eb21809f69f722
documentation_url: https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.mailchimptrigger
example_parameters: {}
properties_schema: []
package_name: n8n-nodes-base
version: 1.0
extracted_at: 2025-06-08 09:18:10
updated_at: 2025-06-08 09:18:10
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.Mailchimp = void 0;
  const GenericFunctions_1 = require("./GenericFunctions");
  const moment_1 = __importDefault(require("moment"));
  var Status;
  (function (Status) {
      Status["subscribe"] = "subscribe";
      Status["unsubscribed"] = "unsubscribe";
      Status["cleaned"] = "cleaned";
      Status["pending"] = "pending";
      Status["transactional"] = "transactional";
  })(Status || (Status = {}));
  class Mailchimp {
      constructor() {
          this.description = {
              displayName: 'Mailchimp',
              name: 'mailchimp',
              icon: 'file:mailchimp.svg',
              group: ['output'],
              version: 1,
              subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
              description: 'Consume Mailchimp API',
              defaults: {
                  name: 'Mailchimp',
              },
              inputs: ['main'],
              outputs: ['main'],
              credentials: [
                  {
                      name: 'mailchimpApi',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['apiKey'],
                          },
                      },
                  },
                  {
                      name: 'mailchimpOAuth2Api',
                      required: true,
                      displayOptions: {
                          show: {
                              authentication: ['oAuth2'],
                          },
                      },
                  },
              ],
              properties: [
                  {
                      displayName: 'Authentication',
                      name: 'authentication',
                      type: 'options',
                      options: [
                          {
                              name: 'API Key',
                              value: 'apiKey',
                          },
                          {
                              name: 'OAuth2',
                              value: 'oAuth2',
                          },
                      ],
                      default: 'apiKey',
                  },
                  {
                      displayName: 'Resource',
                      name: 'resource',
                      type: 'options',
                      noDataExpression: true,
                      options: [
                          {
                              name: 'Campaign',
                              value: 'campaign',
                          },
                          {
                              name: 'List Group',
                              value: 'listGroup',
                          },
                          {
                              name: 'Member',
                              value: 'member',
                          },
                          {
                              name: 'Member Tag',
                              value: 'memberTag',
                          },
                      ],
                      default: 'member',
                      required: true,
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['member'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Create a new member on list',
                              action: 'Create a member',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete a member on list',
                              action: 'Delete a member',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a member on list',
                              action: 'Get a member',
                          },
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'Get many members on a list',
                              action: 'Get many members',
                          },
                          {
                              name: 'Update',
                              value: 'update',
                              description: 'Update a new member on list',
                              action: 'Update a member',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['memberTag'],
                          },
                      },
                      options: [
                          {
                              name: 'Create',
                              value: 'create',
                              description: 'Add tags from a list member',
                              action: 'Create a member tag',
                          },
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Remove tags from a list member',
                              action: 'Delete a member tag',
                          },
                      ],
                      default: 'create',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['listGroup'],
                          },
                      },
                      options: [
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'Get many groups',
                              action: 'Get many list groups',
                          },
                      ],
                      default: 'getAll',
                  },
                  {
                      displayName: 'Operation',
                      name: 'operation',
                      type: 'options',
                      noDataExpression: true,
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['campaign'],
                          },
                      },
                      options: [
                          {
                              name: 'Delete',
                              value: 'delete',
                              description: 'Delete a campaign',
                              action: 'Delete a campaign',
                          },
                          {
                              name: 'Get',
                              value: 'get',
                              description: 'Get a campaign',
                              action: 'Get a campaign',
                          },
                          {
                              name: 'Get Many',
                              value: 'getAll',
                              description: 'Get many campaigns',
                              action: 'Get many campaigns',
                          },
                          {
                              name: 'Replicate',
                              value: 'replicate',
                              description: 'Replicate a campaign',
                              action: 'Replicate a campaign',
                          },
                          {
                              name: 'Resend',
                              value: 'resend',
                              description: 'Creates a Resend to Non-Openers version of this campaign',
                              action: 'Resend a campaign',
                          },
                          {
                              name: 'Send',
                              value: 'send',
                              description: 'Send a campaign',
                              action: 'Send a campaign',
                          },
                      ],
                      default: 'getAll',
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                      },
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                      description: 'List of lists. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                          },
                      },
                      default: '',
                      description: 'Email address for a subscriber',
                  },
                  {
                      displayName: 'Status',
                      name: 'status',
                      type: 'options',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                          },
                      },
                      options: [
                          {
                              name: 'Cleaned',
                              value: 'cleaned',
                          },
                          {
                              name: 'Pending',
                              value: 'pending',
                          },
                          {
                              name: 'Subscribed',
                              value: 'subscribed',
                          },
                          {
                              name: 'Transactional',
                              value: 'transactional',
                          },
                          {
                              name: 'Unsubscribed',
                              value: 'unsubscribed',
                          },
                      ],
                      default: '',
                      description: "Subscriber's current status",
                  },
                  {
                      displayName: 'JSON Parameters',
                      name: 'jsonParameters',
                      type: 'boolean',
                      default: false,
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                          },
                      },
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Email Type',
                              name: 'emailType',
                              type: 'options',
                              options: [
                                  {
                                      name: 'HTML',
                                      value: 'html',
                                  },
                                  {
                                      name: 'Text',
                                      value: 'text',
                                  },
                              ],
                              default: '',
                              description: 'Type of email this member asked to get',
                          },
                          {
                              displayName: 'Language',
                              name: 'language',
                              type: 'string',
                              default: '',
                              description: "If set/detected, the subscriber's language",
                          },
                          {
                              displayName: 'Opt-in IP',
                              name: 'ipOptIn',
                              type: 'string',
                              default: '',
                              description: 'The IP address the subscriber used to confirm their opt-in status',
                          },
                          {
                              displayName: 'Signup IP',
                              name: 'ipSignup',
                              type: 'string',
                              default: '',
                              description: 'IP address the subscriber signed up from',
                          },
                          {
                              displayName: 'Signup Timestamp',
                              name: 'timestampSignup',
                              type: 'dateTime',
                              default: '',
                              description: 'The date and time the subscriber signed up for the list in ISO 8601 format',
                          },
                          {
                              displayName: 'Tags',
                              name: 'tags',
                              type: 'string',
                              default: '',
                              description: 'The tags that are associated with a member separeted by ,',
                          },
                          {
                              displayName: 'Vip',
                              name: 'vip',
                              type: 'boolean',
                              default: false,
                              description: 'Vip status for subscribers',
                          },
                          {
                              displayName: 'Opt-in Timestamp',
                              name: 'timestampOpt',
                              type: 'dateTime',
                              default: '',
                              description: 'The date and time the subscribe confirmed their opt-in status in ISO 8601 format',
                          },
                      ],
                  },
                  {
                      displayName: 'Location',
                      name: 'locationFieldsUi',
                      type: 'fixedCollection',
                      placeholder: 'Add Location',
                      default: {},
                      description: 'Subscriber location information.n',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                              jsonParameters: [false],
                          },
                      },
                      options: [
                          {
                              name: 'locationFieldsValues',
                              displayName: 'Location',
                              values: [
                                  {
                                      displayName: 'Latitude',
                                      name: 'latitude',
                                      type: 'string',
                                      required: true,
                                      description: 'The location latitude',
                                      default: '',
                                  },
                                  {
                                      displayName: 'Longitude',
                                      name: 'longitude',
                                      type: 'string',
                                      required: true,
                                      description: 'The location longitude',
                                      default: '',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Merge Fields',
                      name: 'mergeFieldsUi',
                      placeholder: 'Add Merge Fields',
                      type: 'fixedCollection',
                      default: {},
                      typeOptions: {
                          multipleValues: true,
                      },
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                              jsonParameters: [false],
                          },
                      },
                      description: 'An individual merge var and value for a member',
                      options: [
                          {
                              name: 'mergeFieldsValues',
                              displayName: 'Field',
                              typeOptions: {
                                  multipleValueButtonText: 'Add Field',
                              },
                              values: [
                                  {
                                      displayName: 'Field Name or ID',
                                      name: 'name',
                                      type: 'options',
                                      typeOptions: {
                                          loadOptionsMethod: 'getMergeFields',
                                          loadOptionsDependsOn: ['list'],
                                      },
                                      required: true,
                                      description: 'Merge Field name. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                                      default: '',
                                  },
                                  {
                                      displayName: 'Field Value',
                                      name: 'value',
                                      required: true,
                                      type: 'string',
                                      default: '',
                                      description: 'Merge field value',
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Merge Fields',
                      name: 'mergeFieldsJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                              jsonParameters: [true],
                          },
                      },
                  },
                  {
                      displayName: 'Location',
                      name: 'locationJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                              jsonParameters: [true],
                          },
                      },
                  },
                  {
                      displayName: 'Interest Groups',
                      name: 'groupsUi',
                      placeholder: 'Add Interest Group',
                      type: 'fixedCollection',
                      default: {},
                      typeOptions: {
                          multipleValues: true,
                      },
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                              jsonParameters: [false],
                          },
                      },
                      options: [
                          {
                              name: 'groupsValues',
                              displayName: 'Group',
                              typeOptions: {
                                  multipleValueButtonText: 'Add Interest Group',
                              },
                              values: [
                                  {
                                      displayName: 'Category Name or ID',
                                      name: 'categoryId',
                                      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: 'getGroupCategories',
                                          loadOptionsDependsOn: ['list'],
                                      },
                                      default: '',
                                  },
                                  {
                                      displayName: 'Category Field ID',
                                      name: 'categoryFieldId',
                                      type: 'string',
                                      default: '',
                                  },
                                  {
                                      displayName: 'Value',
                                      name: 'value',
                                      type: 'boolean',
                                      default: false,
                                  },
                              ],
                          },
                      ],
                  },
                  {
                      displayName: 'Interest Groups',
                      name: 'groupJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['create'],
                              jsonParameters: [true],
                          },
                      },
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                      },
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['delete'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                      description: 'List of lists. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['delete'],
                          },
                      },
                      default: '',
                      required: true,
                      description: "Member's email",
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                      },
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['get'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                      description: 'List of lists. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['get'],
                          },
                      },
                      default: '',
                      required: true,
                      description: "Member's email",
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['get'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Fields',
                              name: 'fields',
                              type: 'string',
                              default: '',
                              description: 'A comma-separated list of fields to return',
                          },
                          {
                              displayName: 'Exclude Fields',
                              name: 'excludeFields',
                              type: 'string',
                              default: '',
                              description: 'A comma-separated list of fields to exclude',
                          },
                      ],
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                      },
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['getAll'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                      description: 'List of lists. 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',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['getAll'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['getAll'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 1000,
                      },
                      default: 500,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['getAll'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Before Last Changed',
                              name: 'beforeLastChanged',
                              type: 'dateTime',
                              default: '',
                              description: 'Restrict results to subscribers whose information changed before the set timeframe',
                          },
                          {
                              displayName: 'Before Timestamp Opt',
                              name: 'beforeTimestampOpt',
                              type: 'dateTime',
                              default: '',
                              description: 'Restrict results to subscribers who opted-in before the set timeframe',
                          },
                          {
                              displayName: 'Email Type',
                              name: 'emailType',
                              type: 'options',
                              options: [
                                  {
                                      name: 'HTML',
                                      value: 'html',
                                  },
                                  {
                                      name: 'Text',
                                      value: 'text',
                                  },
                              ],
                              default: '',
                              description: 'Type of email this member asked to get',
                          },
                          {
                              displayName: 'Status',
                              name: 'status',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Cleaned',
                                      value: 'cleaned',
                                  },
                                  {
                                      name: 'Pending',
                                      value: 'pending',
                                  },
                                  {
                                      name: 'Subscribed',
                                      value: 'subscribed',
                                  },
                                  {
                                      name: 'Transactional',
                                      value: 'transactional',
                                  },
                                  {
                                      name: 'Unsubscribed',
                                      value: 'unsubscribed',
                                  },
                              ],
                              default: '',
                              description: "Subscriber's current status",
                          },
                          {
                              displayName: 'Since Last Changed',
                              name: 'sinceLastChanged',
                              type: 'dateTime',
                              default: '',
                              description: 'Restrict results to subscribers whose information changed after the set timeframe',
                          },
                      ],
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                      },
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['update'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                      description: 'List of lists. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['update'],
                          },
                      },
                      default: '',
                      description: 'Email address of the subscriber',
                  },
                  {
                      displayName: 'JSON Parameters',
                      name: 'jsonParameters',
                      type: 'boolean',
                      default: false,
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['update'],
                          },
                      },
                  },
                  {
                      displayName: 'Update Fields',
                      name: 'updateFields',
                      type: 'collection',
                      placeholder: 'Add Field',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['update'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Email Type',
                              name: 'emailType',
                              type: 'options',
                              options: [
                                  {
                                      name: 'HTML',
                                      value: 'html',
                                  },
                                  {
                                      name: 'Text',
                                      value: 'text',
                                  },
                              ],
                              default: '',
                              description: 'Type of email this member asked to get',
                          },
                          {
                              displayName: 'Interest Groups',
                              name: 'groupsUi',
                              placeholder: 'Add Interest Group',
                              type: 'fixedCollection',
                              default: {},
                              typeOptions: {
                                  multipleValues: true,
                              },
                              displayOptions: {
                                  show: {
                                      '/resource': ['member'],
                                      '/operation': ['update'],
                                      '/jsonParameters': [false],
                                  },
                              },
                              options: [
                                  {
                                      name: 'groupsValues',
                                      displayName: 'Group',
                                      typeOptions: {
                                          multipleValueButtonText: 'Add Interest Group',
                                      },
                                      values: [
                                          {
                                              displayName: 'Category Name or ID',
                                              name: 'categoryId',
                                              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: 'getGroupCategories',
                                                  loadOptionsDependsOn: ['list'],
                                              },
                                              default: '',
                                          },
                                          {
                                              displayName: 'Category Field ID',
                                              name: 'categoryFieldId',
                                              type: 'string',
                                              default: '',
                                          },
                                          {
                                              displayName: 'Value',
                                              name: 'value',
                                              type: 'boolean',
                                              default: false,
                                          },
                                      ],
                                  },
                              ],
                          },
                          {
                              displayName: 'Language',
                              name: 'language',
                              type: 'string',
                              default: '',
                              description: "If set/detected, the subscriber's language",
                          },
                          {
                              displayName: 'Merge Fields',
                              name: 'mergeFieldsUi',
                              placeholder: 'Add Merge Fields',
                              type: 'fixedCollection',
                              default: {},
                              typeOptions: {
                                  multipleValues: true,
                              },
                              displayOptions: {
                                  show: {
                                      '/resource': ['member'],
                                      '/operation': ['update'],
                                      '/jsonParameters': [false],
                                  },
                              },
                              description: 'An individual merge var and value for a member',
                              options: [
                                  {
                                      name: 'mergeFieldsValues',
                                      displayName: 'Field',
                                      typeOptions: {
                                          multipleValueButtonText: 'Add Field',
                                      },
                                      values: [
                                          {
                                              displayName: 'Field Name or ID',
                                              name: 'name',
                                              type: 'options',
                                              typeOptions: {
                                                  loadOptionsMethod: 'getMergeFields',
                                                  loadOptionsDependsOn: ['list'],
                                              },
                                              required: true,
                                              description: 'Merge Field name. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                                              default: '',
                                          },
                                          {
                                              displayName: 'Field Value',
                                              name: 'value',
                                              required: true,
                                              type: 'string',
                                              default: '',
                                              description: 'Merge field value',
                                          },
                                      ],
                                  },
                              ],
                          },
                          {
                              displayName: 'Opt-in IP',
                              name: 'ipOptIn',
                              type: 'string',
                              default: '',
                              description: 'The IP address the subscriber used to confirm their opt-in status',
                          },
                          {
                              displayName: 'Signup IP',
                              name: 'ipSignup',
                              type: 'string',
                              default: '',
                              description: 'IP address the subscriber signed up from',
                          },
                          {
                              displayName: 'Signup Timestamp',
                              name: 'timestampSignup',
                              type: 'dateTime',
                              default: '',
                              description: 'The date and time the subscriber signed up for the list in ISO 8601 format',
                          },
                          {
                              displayName: 'Skip Merge Validation',
                              name: 'skipMergeValidation',
                              type: 'boolean',
                              default: false,
                              description: 'Whether member data will be accepted without merge field values, even if the merge field is usually required',
                          },
                          {
                              displayName: 'Status',
                              name: 'status',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Cleaned',
                                      value: 'cleaned',
                                  },
                                  {
                                      name: 'Pending',
                                      value: 'pending',
                                  },
                                  {
                                      name: 'Subscribed',
                                      value: 'subscribed',
                                  },
                                  {
                                      name: 'Transactional',
                                      value: 'transactional',
                                  },
                                  {
                                      name: 'Unsubscribed',
                                      value: 'unsubscribed',
                                  },
                              ],
                              default: '',
                              description: "Subscriber's current status",
                          },
                          {
                              displayName: 'Vip',
                              name: 'vip',
                              type: 'boolean',
                              default: false,
                              description: 'Vip status for subscribers',
                          },
                          {
                              displayName: 'Location',
                              name: 'locationFieldsUi',
                              type: 'fixedCollection',
                              placeholder: 'Add Location',
                              default: {},
                              description: 'Subscriber location information.n',
                              displayOptions: {
                                  show: {
                                      '/resource': ['member'],
                                      '/operation': ['update'],
                                      '/jsonParameters': [false],
                                  },
                              },
                              options: [
                                  {
                                      name: 'locationFieldsValues',
                                      displayName: 'Location',
                                      values: [
                                          {
                                              displayName: 'Latitude',
                                              name: 'latitude',
                                              type: 'string',
                                              required: true,
                                              description: 'The location latitude',
                                              default: '',
                                          },
                                          {
                                              displayName: 'Longitude',
                                              name: 'longitude',
                                              type: 'string',
                                              required: true,
                                              description: 'The location longitude',
                                              default: '',
                                          },
                                      ],
                                  },
                              ],
                          },
                          {
                              displayName: 'Opt-in Timestamp',
                              name: 'timestampOpt',
                              type: 'dateTime',
                              default: '',
                              description: 'The date and time the subscribe confirmed their opt-in status in ISO 8601 format',
                          },
                      ],
                  },
                  {
                      displayName: 'Merge Fields',
                      name: 'mergeFieldsJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['update'],
                              jsonParameters: [true],
                          },
                      },
                  },
                  {
                      displayName: 'Location',
                      name: 'locationJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['update'],
                              jsonParameters: [true],
                          },
                      },
                  },
                  {
                      displayName: 'Interest Groups',
                      name: 'groupJson',
                      type: 'json',
                      typeOptions: {
                          alwaysOpenEditWindow: true,
                      },
                      default: '',
                      displayOptions: {
                          show: {
                              resource: ['member'],
                              operation: ['update'],
                              jsonParameters: [true],
                          },
                      },
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                      },
                      displayOptions: {
                          show: {
                              resource: ['memberTag'],
                              operation: ['create', 'delete'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                      description: 'List of lists. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Email',
                      name: 'email',
                      type: 'string',
                      placeholder: 'name@email.com',
                      required: true,
                      displayOptions: {
                          show: {
                              resource: ['memberTag'],
                              operation: ['create', 'delete'],
                          },
                      },
                      default: '',
                      description: 'Email address of the subscriber',
                  },
                  {
                      displayName: 'Tags',
                      name: 'tags',
                      type: 'string',
                      typeOptions: {
                          multipleValues: true,
                          multipleValueButtonText: 'Add Tag',
                      },
                      displayOptions: {
                          show: {
                              resource: ['memberTag'],
                              operation: ['create', 'delete'],
                          },
                      },
                      default: [],
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['memberTag'],
                              operation: ['create', 'delete'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Is Syncing',
                              name: 'isSyncing',
                              type: 'boolean',
                              default: false,
                              description: 'Whether automations based on the tags in the request will not fire',
                          },
                      ],
                  },
                  {
                      displayName: 'List Name or ID',
                      name: 'list',
                      type: 'options',
                      typeOptions: {
                          loadOptionsMethod: 'getLists',
                      },
                      displayOptions: {
                          show: {
                              resource: ['listGroup'],
                              operation: ['getAll'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                      description: 'List of lists. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                  },
                  {
                      displayName: 'Group Category Name or ID',
                      name: 'groupCategory',
                      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: 'getGroupCategories',
                          loadOptionsDependsOn: ['list'],
                      },
                      displayOptions: {
                          show: {
                              resource: ['listGroup'],
                              operation: ['getAll'],
                          },
                      },
                      default: '',
                      options: [],
                      required: true,
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              resource: ['listGroup'],
                              operation: ['getAll'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              resource: ['listGroup'],
                              operation: ['getAll'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 1000,
                      },
                      default: 500,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Return All',
                      name: 'returnAll',
                      type: 'boolean',
                      displayOptions: {
                          show: {
                              resource: ['campaign'],
                              operation: ['getAll'],
                          },
                      },
                      default: false,
                      description: 'Whether to return all results or only up to a given limit',
                  },
                  {
                      displayName: 'Limit',
                      name: 'limit',
                      type: 'number',
                      displayOptions: {
                          show: {
                              resource: ['campaign'],
                              operation: ['getAll'],
                              returnAll: [false],
                          },
                      },
                      typeOptions: {
                          minValue: 1,
                          maxValue: 1000,
                      },
                      default: 10,
                      description: 'Max number of results to return',
                  },
                  {
                      displayName: 'Options',
                      name: 'options',
                      type: 'collection',
                      placeholder: 'Add Option',
                      default: {},
                      displayOptions: {
                          show: {
                              resource: ['campaign'],
                              operation: ['getAll'],
                          },
                      },
                      options: [
                          {
                              displayName: 'Before Create Time',
                              name: 'beforeCreateTime',
                              type: 'dateTime',
                              default: '',
                              description: 'Restrict the response to campaigns created before the set time',
                          },
                          {
                              displayName: 'Before Send Time',
                              name: 'beforeSendTime',
                              type: 'dateTime',
                              default: '',
                              description: 'Restrict the response to campaigns sent before the set time',
                          },
                          {
                              displayName: 'Exclude Field Names or IDs',
                              name: 'excludeFields',
                              type: 'multiOptions',
                              typeOptions: {
                                  loadOptionsMethod: 'getCampaignsFields',
                              },
                              default: [],
                              description: 'A comma-separated list of fields to exclude. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'Field Names or IDs',
                              name: 'fields',
                              type: 'multiOptions',
                              typeOptions: {
                                  loadOptionsMethod: 'getCampaignsFields',
                              },
                              default: [
                                  'campaigns.id',
                                  'campaigns.status',
                                  'campaigns.tracking',
                                  'campaigns.settings.from_name',
                                  'campaigns.settings.reply_to',
                                  'campaigns.settings.title',
                              ],
                              description: 'A comma-separated list of fields to return. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'List Name or ID',
                              name: 'listId',
                              type: 'options',
                              typeOptions: {
                                  loadOptionsMethod: 'getLists',
                              },
                              default: '',
                              description: 'List of lists. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
                          },
                          {
                              displayName: 'Since Create Time',
                              name: 'sinceCreateTime',
                              type: 'dateTime',
                              default: '',
                              description: 'Restrict the response to campaigns created after the set time',
                          },
                          {
                              displayName: 'Since Send Time',
                              name: 'sinceSendTime',
                              type: 'dateTime',
                              default: '',
                              description: 'Restrict the response to campaigns sent after the set time',
                          },
                          {
                              displayName: 'Sort Direction',
                              name: 'sortDirection',
                              type: 'options',
                              options: [
                                  {
                                      name: 'ASC',
                                      value: 'ASC',
                                  },
                                  {
                                      name: 'DESC',
                                      value: 'DESC',
                                  },
                              ],
                              default: '',
                              description: 'Determines the order direction for sorted results',
                          },
                          {
                              displayName: 'Sort Field',
                              name: 'sortField',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Create Time',
                                      value: 'create_time',
                                  },
                                  {
                                      name: 'Send Time',
                                      value: 'send_time',
                                  },
                              ],
                              default: '',
                              description: 'Returns files sorted by the specified field',
                          },
                          {
                              displayName: 'Status',
                              name: 'status',
                              type: 'options',
                              options: [
                                  {
                                      name: 'Save',
                                      value: 'save',
                                  },
                                  {
                                      name: 'Sending',
                                      value: 'sending',
                                  },
                                  {
                                      name: 'Sent',
                                      value: 'sent',
                                  },
                                  {
                                      name: 'Schedule',
                                      value: 'schedule',
                                  },
                              ],
                              default: '',
                              description: 'The status of the campaign',
                          },
                      ],
                  },
                  {
                      displayName: 'Campaign ID',
                      name: 'campaignId',
                      type: 'string',
                      displayOptions: {
                          show: {
                              resource: ['campaign'],
                              operation: ['send', 'get', 'delete', 'replicate', 'resend'],
                          },
                      },
                      required: true,
                      default: '',
                      description: 'List of Campaigns',
                      options: [],
                  },
              ],
          };
          this.methods = {
              loadOptions: {
                  async getLists() {
                      const returnData = [];
                      const lists = await GenericFunctions_1.mailchimpApiRequestAllItems.call(this, '/lists', 'GET', 'lists');
                      for (const list of lists) {
                          const listName = list.name;
                          const listId = list.id;
                          returnData.push({
                              name: listName,
                              value: listId,
                          });
                      }
                      return returnData;
                  },
                  async getMergeFields() {
                      const returnData = [];
                      const listId = this.getCurrentNodeParameter('list');
                      const { merge_fields } = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/merge-fields`, 'GET');
                      for (const mergeField of merge_fields) {
                          const mergeFieldName = mergeField.name;
                          const mergeFieldId = mergeField.tag;
                          returnData.push({
                              name: mergeFieldName,
                              value: mergeFieldId,
                          });
                      }
                      return returnData;
                  },
                  async getGroupCategories() {
                      const returnData = [];
                      const listId = this.getCurrentNodeParameter('list');
                      const { categories } = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/interest-categories`, 'GET');
                      for (const category of categories) {
                          const categoryName = category.title;
                          const categoryId = category.id;
                          returnData.push({
                              name: categoryName,
                              value: categoryId,
                          });
                      }
                      return returnData;
                  },
                  async getCampaigns() {
                      const returnData = [];
                      const campaigns = await GenericFunctions_1.mailchimpApiRequestAllItems.call(this, '/campaigns', 'GET', 'campaigns');
                      for (const campaign of campaigns) {
                          const campaignName = campaign.settings.title;
                          const campaignId = campaign.id;
                          returnData.push({
                              name: campaignName,
                              value: campaignId,
                          });
                      }
                      return returnData;
                  },
                  async getCampaignsFields() {
                      const returnData = [];
                      for (const campaignFields of GenericFunctions_1.campaignFieldsMetadata) {
                          returnData.push({
                              name: campaignFields,
                              value: campaignFields,
                          });
                      }
                      return returnData;
                  },
              },
          };
      }
      async execute() {
          const items = this.getInputData();
          const returnData = [];
          const length = items.length;
          let responseData;
          const qs = {};
          const resource = this.getNodeParameter('resource', 0);
          const operation = this.getNodeParameter('operation', 0);
          for (let i = 0; i < length; i++) {
              try {
                  if (resource === 'listGroup') {
                      if (operation === 'getAll') {
                          const listId = this.getNodeParameter('list', i);
                          const categoryId = this.getNodeParameter('groupCategory', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          if (returnAll) {
                              responseData = await GenericFunctions_1.mailchimpApiRequestAllItems.call(this, `/lists/${listId}/interest-categories/${categoryId}/interests`, 'GET', 'interests', {}, qs);
                          }
                          else {
                              qs.count = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/interest-categories/${categoryId}/interests`, 'GET', {}, qs);
                              responseData = responseData.interests;
                          }
                      }
                  }
                  if (resource === 'member') {
                      if (operation === 'create') {
                          const listId = this.getNodeParameter('list', i);
                          const email = this.getNodeParameter('email', i);
                          const status = this.getNodeParameter('status', i);
                          const options = this.getNodeParameter('options', i);
                          const jsonActive = this.getNodeParameter('jsonParameters', i);
                          const body = {
                              listId,
                              email_address: email,
                              status,
                          };
                          if (options.emailType) {
                              body.email_type = options.emailType;
                          }
                          if (options.language) {
                              body.language = options.language;
                          }
                          if (options.vip) {
                              body.vip = options.vip;
                          }
                          if (options.ipSignup) {
                              body.ip_signup = options.ipSignup;
                          }
                          if (options.ipOptIn) {
                              body.ip_opt = options.ipOptIn;
                          }
                          if (options.timestampOpt) {
                              body.timestamp_opt = (0, moment_1.default)(options.timestampOpt).format('YYYY-MM-DD HH:MM:SS');
                          }
                          if (options.timestampSignup) {
                              body.timestamp_signup = (0, moment_1.default)(options.timestampSignup).format('YYYY-MM-DD HH:MM:SS');
                          }
                          if (options.tags) {
                              body.tags = options.tags.split(',');
                          }
                          if (!jsonActive) {
                              const locationValues = this.getNodeParameter('locationFieldsUi', i)
                                  .locationFieldsValues;
                              if (locationValues) {
                                  const location = {};
                                  for (const key of Object.keys(locationValues)) {
                                      if (key === 'latitude') {
                                          location.latitude = parseFloat(locationValues[key]);
                                      }
                                      else if (key === 'longitude') {
                                          location.longitude = parseFloat(locationValues[key]);
                                      }
                                  }
                                  body.location = location;
                              }
                              const mergeFieldsValues = this.getNodeParameter('mergeFieldsUi', i)
                                  .mergeFieldsValues;
                              if (mergeFieldsValues) {
                                  const mergeFields = {};
                                  for (let index = 0; index < mergeFieldsValues.length; index++) {
                                      mergeFields[mergeFieldsValues[index].name] = mergeFieldsValues[index].value;
                                  }
                                  body.merge_fields = mergeFields;
                              }
                              const groupsValues = this.getNodeParameter('groupsUi', i)
                                  .groupsValues;
                              if (groupsValues) {
                                  const groups = {};
                                  for (let index = 0; index < groupsValues.length; index++) {
                                      groups[groupsValues[index].categoryFieldId] = groupsValues[index].value;
                                  }
                                  body.interests = groups;
                              }
                          }
                          else {
                              const locationJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('locationJson', i));
                              const mergeFieldsJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('mergeFieldsJson', i));
                              const groupJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('groupJson', i));
                              if (locationJson) {
                                  body.location = locationJson;
                              }
                              if (mergeFieldsJson) {
                                  body.merge_fields = mergeFieldsJson;
                              }
                              if (groupJson) {
                                  body.interests = groupJson;
                              }
                          }
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/members`, 'POST', body);
                      }
                      if (operation === 'delete') {
                          const listId = this.getNodeParameter('list', i);
                          const email = this.getNodeParameter('email', i);
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/members/${email}/actions/delete-permanent`, 'POST');
                          responseData = { success: true };
                      }
                      if (operation === 'get') {
                          const listId = this.getNodeParameter('list', i);
                          const email = this.getNodeParameter('email', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.fields) {
                              qs.fields = options.fields;
                          }
                          if (options.excludeFields) {
                              qs.exclude_fields = options.excludeFields;
                          }
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/members/${email}`, 'GET', {}, qs);
                      }
                      if (operation === 'getAll') {
                          const listId = this.getNodeParameter('list', i);
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.beforeLastChanged) {
                              qs.before_last_changed = options.beforeLastChanged;
                          }
                          if (options.beforeTimestampOpt) {
                              qs.before_timestamp_opt = options.beforeTimestampOpt;
                          }
                          if (options.emailType) {
                              qs.email_type = options.emailType;
                          }
                          if (options.status) {
                              qs.status = options.status;
                          }
                          if (options.sinceLastChanged) {
                              qs.since_last_changed = options.sinceLastChanged;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.mailchimpApiRequestAllItems.call(this, `/lists/${listId}/members`, 'GET', 'members', {}, qs);
                          }
                          else {
                              qs.count = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/members`, 'GET', {}, qs);
                              responseData = responseData.members;
                          }
                      }
                      if (operation === 'update') {
                          const listId = this.getNodeParameter('list', i);
                          const email = this.getNodeParameter('email', i);
                          const updateFields = this.getNodeParameter('updateFields', i);
                          const jsonActive = this.getNodeParameter('jsonParameters', i);
                          const body = {
                              listId,
                              email_address: email,
                          };
                          if (updateFields.skipMergeValidation) {
                              qs.skip_merge_validation = updateFields.skipMergeValidation;
                          }
                          if (updateFields.status) {
                              body.status = updateFields.status;
                          }
                          if (updateFields.emailType) {
                              body.email_type = updateFields.emailType;
                          }
                          if (updateFields.language) {
                              body.language = updateFields.language;
                          }
                          if (updateFields.vip) {
                              body.vip = updateFields.vip;
                          }
                          if (updateFields.ipSignup) {
                              body.ip_signup = updateFields.ipSignup;
                          }
                          if (updateFields.ipOptIn) {
                              body.ip_opt = updateFields.ipOptIn;
                          }
                          if (updateFields.timestampOpt) {
                              body.timestamp_opt = (0, moment_1.default)(updateFields.timestampOpt).format('YYYY-MM-DD HH:MM:SS');
                          }
                          if (updateFields.timestampSignup) {
                              body.timestamp_signup = (0, moment_1.default)(updateFields.timestampSignup).format('YYYY-MM-DD HH:MM:SS');
                          }
                          if (!jsonActive) {
                              if (updateFields.locationFieldsUi) {
                                  const locationValues = updateFields.locationFieldsUi
                                      .locationFieldsValues;
                                  if (locationValues) {
                                      const location = {};
                                      for (const key of Object.keys(locationValues)) {
                                          if (key === 'latitude') {
                                              location.latitude = parseFloat(locationValues[key]);
                                          }
                                          else if (key === 'longitude') {
                                              location.longitude = parseFloat(locationValues[key]);
                                          }
                                      }
                                      body.location = location;
                                  }
                              }
                              if (updateFields.mergeFieldsUi) {
                                  const mergeFieldsValues = updateFields.mergeFieldsUi
                                      .mergeFieldsValues;
                                  if (mergeFieldsValues) {
                                      const mergeFields = {};
                                      for (let index = 0; index < mergeFieldsValues.length; index++) {
                                          mergeFields[mergeFieldsValues[index].name] = mergeFieldsValues[index].value;
                                      }
                                      body.merge_fields = mergeFields;
                                  }
                              }
                              if (updateFields.groupsUi) {
                                  const groupsValues = updateFields.groupsUi
                                      .groupsValues;
                                  if (groupsValues) {
                                      const groups = {};
                                      for (let index = 0; index < groupsValues.length; index++) {
                                          groups[groupsValues[index].categoryFieldId] = groupsValues[index].value;
                                      }
                                      body.interests = groups;
                                  }
                              }
                          }
                          else {
                              const locationJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('locationJson', i));
                              const mergeFieldsJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('mergeFieldsJson', i));
                              const groupJson = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('groupJson', i));
                              if (locationJson) {
                                  body.location = locationJson;
                              }
                              if (mergeFieldsJson) {
                                  body.merge_fields = mergeFieldsJson;
                              }
                              if (groupJson) {
                                  body.interests = groupJson;
                              }
                          }
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/members/${email}`, 'PUT', body);
                      }
                  }
                  if (resource === 'memberTag') {
                      if (operation === 'create') {
                          const listId = this.getNodeParameter('list', i);
                          const email = this.getNodeParameter('email', i);
                          const tags = this.getNodeParameter('tags', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              tags: [],
                          };
                          if (options.isSyncing) {
                              body.is_syncing = options.isSyncing;
                          }
                          for (const tag of tags) {
                              body.tags.push({
                                  name: tag,
                                  status: 'active',
                              });
                          }
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/members/${email}/tags`, 'POST', body);
                          responseData = { success: true };
                      }
                      if (operation === 'delete') {
                          const listId = this.getNodeParameter('list', i);
                          const email = this.getNodeParameter('email', i);
                          const tags = this.getNodeParameter('tags', i);
                          const options = this.getNodeParameter('options', i);
                          const body = {
                              tags: [],
                          };
                          if (options.isSyncing) {
                              body.is_syncing = options.isSyncing;
                          }
                          for (const tag of tags) {
                              body.tags.push({
                                  name: tag,
                                  status: 'inactive',
                              });
                          }
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/lists/${listId}/members/${email}/tags`, 'POST', body);
                          responseData = { success: true };
                      }
                  }
                  if (resource === 'campaign') {
                      if (operation === 'getAll') {
                          const returnAll = this.getNodeParameter('returnAll', i);
                          const options = this.getNodeParameter('options', i);
                          if (options.status) {
                              qs.status = options.status;
                          }
                          if (options.beforeCreateTime) {
                              qs.before_create_time = options.beforeCreateTime;
                          }
                          if (options.beforeSendTime) {
                              qs.before_send_time = options.beforeSendTime;
                          }
                          if (options.excludeFields) {
                              qs.exclude_fields = options.exclude_fields.join(',');
                          }
                          if (options.fields) {
                              qs.fields = options.fields.join(',');
                              if (options.fields.includes('*')) {
                                  qs.fields = GenericFunctions_1.campaignFieldsMetadata.join(',');
                              }
                          }
                          else {
                              qs.fields = [
                                  'campaigns.id',
                                  'campaigns.status',
                                  'campaigns.tracking',
                                  'campaigns.settings.from_name',
                                  'campaigns.settings.title',
                                  'campaigns.settings.reply_to',
                              ].join(',');
                          }
                          if (options.listId) {
                              qs.list_id = options.listId;
                          }
                          if (options.sinceCreateTime) {
                              qs.since_create_time = options.sinceCreateTime;
                          }
                          if (options.sinceSendTime) {
                              qs.since_send_time = options.sinceSendTime;
                          }
                          if (options.sortDirection) {
                              qs.sort_dir = options.sortDirection;
                          }
                          if (options.sortField) {
                              qs.sort_field = options.sortField;
                          }
                          if (returnAll) {
                              responseData = await GenericFunctions_1.mailchimpApiRequestAllItems.call(this, '/campaigns', 'GET', 'campaigns', {}, qs);
                          }
                          else {
                              qs.count = this.getNodeParameter('limit', i);
                              responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, '/campaigns', 'GET', {}, qs);
                              responseData = responseData.campaigns;
                          }
                      }
                      if (operation === 'send') {
                          const campaignId = this.getNodeParameter('campaignId', i);
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/campaigns/${campaignId}/actions/send`, 'POST', {});
                          responseData = { success: true };
                      }
                      if (operation === 'get') {
                          const campaignId = this.getNodeParameter('campaignId', i);
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/campaigns/${campaignId}`, 'GET', {});
                      }
                      if (operation === 'delete') {
                          const campaignId = this.getNodeParameter('campaignId', i);
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/campaigns/${campaignId}`, 'DELETE', {});
                          responseData = { success: true };
                      }
                      if (operation === 'replicate') {
                          const campaignId = this.getNodeParameter('campaignId', i);
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/campaigns/${campaignId}/actions/replicate`, 'POST', {});
                      }
                      if (operation === 'resend') {
                          const campaignId = this.getNodeParameter('campaignId', i);
                          responseData = await GenericFunctions_1.mailchimpApiRequest.call(this, `/campaigns/${campaignId}/actions/create-resend`, 'POST', {});
                      }
                  }
                  const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
                  returnData.push(...executionData);
              }
              catch (error) {
                  if (this.continueOnFail()) {
                      returnData.push({ json: { error: error.message } });
                      continue;
                  }
                  throw error;
              }
          }
          return [returnData];
      }
  }
  exports.Mailchimp = Mailchimp;
  //# sourceMappingURL=Mailchimp.node.js.map

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

  # Mailchimp Trigger node

  [Mailchimp](https://mailchimp.com/){:target=_blank .external-link} is an integrated marketing platform that allows business owners to automate their email campaigns and track user engagement.

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

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

example_workflow:
  {"nodes":[{"parameters":{},"type":"n8n-nodes-base.node","typeVersion":1,"position":[220,120],"id":"abe4c748-9b0a-4353-8725-e30c231b7c3a","name":"Node"}],"connections":{"Node":{"main":[[]]}},"pinData":{},"meta":{"templateCredsSetupCompleted":true,"instanceId":"0965439c060767cbfcdb49ff7cf0b2b94951cebf3610631c55b126e4eb6bf753"}}


